Skip to content

Instantly share code, notes, and snippets.

View onjin's full-sized avatar

Marek Wywiał onjin

View GitHub Profile
" When started as "evim", evim.vim will already have done these settings.
if v:progname =~? "evim"
finish
endif
" Use Vim settings, rather then Vi settings (much better!).
" This must be first, because it changes other options as a side effect.
set nocompatible
" allow backspacing over everything in insert mode
@onjin
onjin / gist:1231714
Created September 21, 2011 09:58
.vimrc commons
" where i'm
set number
set cursorline
set nocursorcolumn
" work with .vimrc
map ,v :sp ~/.vimrc<cr> " edit my .vimrc file in a split
map ,e :e ~/.vimrc<cr> " edit my .vimrc file
map ,u :source ~/.vimrc<cr> " update the system settings from my vimrc file
@onjin
onjin / gist:1234533
Created September 22, 2011 10:54
mini gallery
mkdir -p mini; for img in `ls *.jpg`; do convert -fill white -geometry 100x200 -size 100x200 -scale 100x200 $img mini/$img; echo "<a style='display: block; width: 100px; height: 200px; float: left; margin: 10px; border: solid 1pX #ccc' href='$img' onclick='window.open(this.href); return false'><img src='mini/$img' /></a>"; done > gallery.html
google-chrome gallery.html
@onjin
onjin / average_ttfb_ttlb.py
Created October 30, 2012 12:47
Get average TTFB, TTLB for website
import numpy
import urllib2
import time
import sys
if len(sys.argv) < 2:
sys.stout.write( "Usage: %s http://page/ counter\n" % sys.argv[0])
sys.exit(0)
site = sys.argv[1]
@onjin
onjin / randomrun.py
Last active December 15, 2015 22:59
Find files recursively using given file extensions and run given command on random 'n' files
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Find files recursively using given file extensions and run given command on random 'n' files:
* python randomrun.py -e mkv,avi,ogm -r vlc -c 4 /some/dir/ # run 4 random moves using vlc
* python randomrun.py -e txt,dat -r cat -c 3 -p /some/dir/ # run cat on 3 random files parallelly
"""
import argparse
@onjin
onjin / conkybtc
Last active December 16, 2015 01:09
Some bitcoins data for conky panel
#!/bin/bash
# put jsgrep into ~/bin
# wget https://gist.github.com/onjin/5353305
#
# crontab:
# * * * * ~/path/to/conkybtc
#
# .conkyrc:
# ${execpi 30 cat .conkybtc }
#
@onjin
onjin / gist:5353305
Created April 10, 2013 09:50
json grep utility
#!/usr/bin/env python
import sys
import re
import json
def jsongrep(d, patterns):
try:
pattern = patterns.pop(0)
except IndexError:
@onjin
onjin / commit-msg.py
Last active November 5, 2019 01:49
Git commit hook to check commit message according to angularjs guidelines: https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
#!/usr/bin/env python
"""
Git commit hook:
.git/hooks/commit-msg
Check commit message according to angularjs guidelines:
* https://docs.google.com/document/d/1QrDFcIiPjSLDn3EL15IJygNPiHORgU1_OOAqWjiDU5Y/edit#
"""
import sys
@onjin
onjin / cgminer.conf
Created April 29, 2013 06:41
My cgminer config for 7950
{
"pools" : [
{
"url" : "http://stratum.d7.lt:3333",
"user" : "user.1",
"pass" : "pass"
}
]
,
@onjin
onjin / docker
Created July 12, 2013 08:19
/etc/init.d/docker file for debian
#!/bin/sh
# https://launchpad.net/~dotcloud/+archive/lxc-docker/+packages
### BEGIN INIT INFO
# Provides: docker
# Required-Start: $local_fs $remote_fs
# Required-Stop: $local_fs $remote_fs
# Should-Start: autofs $network $named alsa-utils pulseaudio
# Should-Stop: autofs $network $named alsa-utils pulseaudio
# Default-Start: 2 3 4 5