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 / 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"
@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 / 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 / pattach
Last active August 29, 2015 14:03
tmux attach with percol
function pattach() {
if [[ $1 == "" ]]; then
PERCOL=percol
else
PERCOL="precol --query $1"
fi
sessions=$(tmux ls)
[ $? -ne 0 ] && return
session=$(echo $sessions | eval $PERCOL | cut -d : -f 1)
if [[ -n "$session" ]]; then
@kunev
kunev / keybase.md
Created October 25, 2014 10:42
keybase.md

Keybase proof

I hereby claim:

  • I am kunev on github.
  • I am kunev (https://keybase.io/kunev) on keybase.
  • I have a public key whose fingerprint is 1A89 8964 FF14 2DF6 EF0E C6C2 A3F7 AD9C FB5D 25E8

To claim this, I am signing this object:

@kunev
kunev / swap_quotation_marks
Created December 1, 2014 09:52
swap " and '
'<,'>s/\v("|')/\={'"': "'", "'": '"'}[submatch(0)]/g
@kunev
kunev / mail_filter.py
Last active September 14, 2015 17:02
display date header in local time in mutt
#!/usr/bin/env python
# Save this in a file somewhere
# In your mutt config add the following line
# set display_filter="/PATH/TO/THIS/PYTHON/FILE"
import sys
import re
import os
@kunev
kunev / pyServer.sh
Created August 25, 2011 14:36
Easy file sharing with commandline python
python -c 'import SimpleHTTPServer; SimpleHTTPServer.test()'
@kunev
kunev / gist:1189922
Created September 2, 2011 21:08
verbose function call snooping
import inspect
def print_args(func):
argspec = inspect.getargspec(func)
expected_arguments, expected_varargs = argspec.args, argspec.varargs
def rslt(*args, **kwargs):
print 'Calling {0}\n\tArguments: {1}\n\tKeyword arguments: {2}'.format(func.__name__, args, kwargs)
return_val = func(*args, **kwargs)
print '\n\tReturned value: {0}'.format(return_val)
@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