Skip to content

Instantly share code, notes, and snippets.

View kunev's full-sized avatar
🐻
I break things to see how they (don't) work | I pass the butter

Evgeni Ku kunev

🐻
I break things to see how they (don't) work | I pass the butter
View GitHub Profile
@kunev
kunev / pre-commit
Last active August 29, 2015 14:00
python pre-commit hook
#!/bin/sh
# Get all the python files staged for committing
py_files=`git diff --name-only HEAD|grep '.py$'`
# If we;re trying to commit a pdb.set_trace() display an error message and exit right away with status 1
grep -n 'pdb.set_trace()' $py_files && echo -e "\033[1;31m Debugger statements!!!\033[0m" && exit 1
# Run pyflakes on all the files beign committed and exit with status 0 if there are no errors, else show error message
pyflakes $py_files && exit || echo -e "\033[1;31m Lint error!\033[0m"
# If we’re here, then pyflakes failed, exit with status 1
@kunev
kunev / gist:11046770
Last active August 29, 2015 14:00
stylish dark evans
@namespace url(http://www.w3.org/1999/xhtml);
@-moz-document domain("fmi.py-bg.net"), domain("fmi.ruby.bg"), domain("fmi.clojure.bg"), domain("fmi.golang.bg") {
body {
background-color: #151515;
color: #fefefe;
}
header {
background: inherit !important;
@kunev
kunev / xkcd_now_downloader
Last active February 2, 2017 19:40
download all images from http://xkcd.com/now/
#!/bin/bash
for h in {0..23}
do
hour=`printf "%02d" $h`
for minutes in 00 15 30 45
do
wget https://sslimgs.xkcd.com/comics/now/${hour}h${minutes}m.png
done
done
@kunev
kunev / url-pkcon
Created February 12, 2014 15:56
minimal script for isntalling rpm files from a URL with pkcon
#!/bin/bash
pkg_path=$1
filename=$(basename $pkg_path)
curl "$pkg_path" -o "$HOME/rpms/$filename"
pkcon install-local "$HOME/rpms/$filename"
function sum(a, b) { return a + b; }
function mult(a, b) { return a * b; }
Function.prototype.curry = function ( ) {
var slice = Array.prototype.slice,
args = slice.apply(arguments),
that = this;
return function ( ) {
return that.apply(null, args.concat(slice.apply(arguments)));
};
@kunev
kunev / github_zenburn_greenish.css
Last active December 21, 2015 19:09
github zenburn greenish
.commit-group-item .gobutton {
background-color: #2b2b2b;
background-image: none;
}
.commit-group-item:nth-child(2n+1) .gobutton {
background-color: #3f3f3f;
background-image: none;
}
@kunev
kunev / dark_twitter_batmop_fix.css
Last active December 19, 2015 13:59
dark twitter theme fix for new tweet actions
.vellip, .vellip:before,
.vellip:after,
.conversation-module > li:after,
.conversation-module > li:before {
background-color: #4E9E20;
}
.conversation-module>li:after, .conversation-module>li:before {
width: 2px;
left: -10px;
@kunev
kunev / smart_throttle.js
Created February 8, 2013 15:07
Custom throttle extender for knockout.js that throttles input but updates the binding immediately when blurring the text field bound to it. Based on the original throttle extender.
ko.extenders.smart_throttle = function(target, timeout) {
target['throttleEvaluation'] = timeout;
target['lastUpdatedValue'] = null;
var writeTimeoutInstance = null;
return ko.computed({
'read': target,
'write': function(value) {
if (value == target()) {
clearTimeout(writeTimeoutInstance);
@kunev
kunev / gist:2938791
Created June 15, 2012 21:30
Watch information for torrents being downloaded with deluge
watch -n 5 "deluge-console info|ack-grep 'State: Downloading' -A 5 -B 2"
@kunev
kunev / sample_spec.rb
Created December 16, 2011 07:44 — forked from psstoev/sample_spec.rb
Sample spec for task 6(add a few missing shoulds)
# encoding: utf-8
describe GameOfLife::Board do
describe 'initialization' do
it 'accepts multiple coords in the constructor' do
board = new_board [0, 0], [1, 1], [2, 2]
end
end
describe 'corner cases' do