Skip to content

Instantly share code, notes, and snippets.

ffmpeg -f x11grab -r 30 -s 1280x800 -i :46991 -b 30k -qscale 1 -s 1280x800 -r 15 -ar 44100 -f flv capture.flv
@jvorcak
jvorcak / gist:108314398eae466f384d
Created September 4, 2014 14:24
Automatically set attributes in a class
class User(object):
def __init__(self, **kwargs):
self.name = None
self.__dict__.update(kwargs)
u = User(name="Jan")
@jvorcak
jvorcak / gist:7f6acdd090990608afd6
Created July 17, 2015 14:05
Get all tables names in a Django project
from django.db import connection
tables = connection.introspection.table_names()
seen_models = connection.introspection.installed_models(tables)
[model._meta.db_table for model in seen_models]
@jvorcak
jvorcak / gist:0dfff10a2f95e1bf2a0f
Created September 18, 2015 07:56
Mysql: update a value with incrementing number
mysql> select @i := 0;
mysql> update bar set c = (select @i := @i + 1);
@jvorcak
jvorcak / inject-angular-service.js
Created September 25, 2015 11:26
Inject angular service from a console
var service = angular.element(document.body).injector().get('someService')
@jvorcak
jvorcak / getoauthtoken.py
Last active December 14, 2015 22:08
Getting oAuth token in Django's UserSocialAuth
from social_auth.models import UserSocialAuth
UserSocialAuth.objects.filter(user=user_object, provider='facebook').all()
# then just call tokens on each of the objects
@jvorcak
jvorcak / gist:5270442
Created March 29, 2013 12:04
Install sty file
yum install 'tex(file.sty)'
@jvorcak
jvorcak / gist:6060153
Created July 23, 2013 05:54
Colorcolumn in Vim
:hi CursorColumn cterm=NONE ctermbg=darkred ctermfg=white guibg=darkred guifg=white
:set cursorcolumn
@jvorcak
jvorcak / gist:6060613
Created July 23, 2013 07:56
How to change author of old commits
git filter-branch --commit-filter 'if [ "$GIT_AUTHOR_NAME" = "Jan Vorcak" ];
then export GIT_AUTHOR_NAME="Jan Vorcak"; export GIT_AUTHOR_EMAIL=jan@example.com;
fi; git commit-tree "$@"'
console.log('%c WARN %c This is just wrong! ', 'background: #B99508; color: white', 'background: #FFF8DC');