Skip to content

Instantly share code, notes, and snippets.

View dedy-purwanto's full-sized avatar

Dedy Purwanto dedy-purwanto

  • Pekanbaru, Indonesia
  • 11:00 (UTC +07:00)
View GitHub Profile
class BananaModelSerializer(object):
@property
def errors(self):
err = super(BananaModelSerializer, self).errors
if err:
new_err = dict( detail='validation error', code='validation-error', errors=err,)
return new_err
@dedy-purwanto
dedy-purwanto / _readme.md
Last active August 29, 2015 14:15 — forked from shime/_readme.md

Having trouble installing the latest stable version of tmux?

I know, official package for your OS/distro is outdated and you just want the newest version of tmux.

Well, this script should save you some time with that.

Prerequisities

  • gcc
@dedy-purwanto
dedy-purwanto / gist:1290777
Created October 16, 2011 11:15
Hello world
def __init__(self, *args, **kwargs):
print "Hello world"
@dedy-purwanto
dedy-purwanto / gist:1291857
Created October 17, 2011 03:09
GVIM custom background
style "vim-background" {
bg[NORMAL] = "#202020"
}
widget "vim-main-window.*.GtkForm" style "vim-background"
@dedy-purwanto
dedy-purwanto / gist:1809013
Created February 12, 2012 15:16
VIM indent/outdent with tab
vnoremap <silent><S-TAB> <gv
vnoremap <silent><TAB> >gv
@dedy-purwanto
dedy-purwanto / gist:1809045
Created February 12, 2012 15:24
vim relocate swap & undo files
set dir=~/.vim/swaps//,/var/tmp//,/tmp//,.
set undodir=~/.vim/undos//,/var/tmp//,/tmp//,.
@dedy-purwanto
dedy-purwanto / gist:3051434
Created July 5, 2012 04:42
Bash: Copy files with list of excluded files.
Say you need to copy files in a folder to somewhere else, except that you have a list of files that might be exist in the source folder but you don't want them to be copied. Your text file that has this list is named list.txt:
------------------------
exclude1.mp3
dont_copy.mpeg
nyancat.jpg
------------------------
$ cd source/
$ cat /path/to/list.txt | tr '\n' '#' | sed 's/.$//g' | sed 's/#/\\\\|/g' | xargs -i sh -c "ls | grep -v '{}'" | xargs -i cp -v -u {} /path/to/dest/
@dedy-purwanto
dedy-purwanto / ga_aggregate_report
Created January 10, 2013 05:40
Aggregates number of page views from individual URLS based on arguments in GA. Uses CSV.
import operator
import csv
import sys
import re
source = sys.argv[1]
output = sys.argv[2]
column = sys.argv[3]
reader = csv.reader(open(source, 'rb'), delimiter=',', quotechar='"')
<form action="vbshout.php.?{$session['sessionurl']}" method="post" name="vbshoutform" onsubmit="return postShout(this)">
<input type='hidden' name='do' value='shout' />
<input type='hidden' name='color' />
<input type='hidden' name='fontFamily' />
<input type='hidden' name='fontWeight' />
<input type='hidden' name='textDecoration' />
<input type='hidden' name='fontStyle' />
<div id='shout_emo' style='display:none'>