Skip to content

Instantly share code, notes, and snippets.

View TheML9I's full-sized avatar
👨‍💻
Open to make of goodness! Python/Go -DM

Sierj Khaletski TheML9I

👨‍💻
Open to make of goodness! Python/Go -DM
  • U.S.
View GitHub Profile
export p=/Users/$(whoami)/.pyenv/versions/2.7.6
sed -i -e "s~python.exe~${p}/bin/python2.7~g" "$p/lib/python2.7/_sysconfigdata.py"
@TheML9I
TheML9I / update_permissions.py
Created January 19, 2017 09:46 — forked from zaan/update_permissions.py
Update permissions in Django auth app.
from django.core.management import setup_environ
try:
import settings
except ImportError:
import sys
sys.stderr.write("Couldn't find the settings.py module.")
sys.exit(1)
setup_environ(settings)
@TheML9I
TheML9I / ngx_lua_get_args_str
Created November 1, 2016 05:48
Nginx lua. Make a list of args of request
function get_args_str()
local args_str = "?"
local keys = {}
if #args < 0 then
return ""
end
for key, val in pairs(args) do
table.insert(keys, key)
@TheML9I
TheML9I / git_groc
Last active October 28, 2016 09:49
Got grog alias
git config --global alias.grog 'log --graph --abbrev-commit --decorate --all --format=format:"%C(bold blue)%h%C(reset) - %C(bold cyan)%aD%C(dim white) - %an%C(reset) %C(bold green)(%ar)%C(reset)%C(bold yellow)%d%C(reset)%n %C(white)%s%C(reset)"'
--more information about formatting https://git-scm.com/docs/pretty-formats
@TheML9I
TheML9I / cprofile_decorator.py
Created April 13, 2016 09:29
Just a cProfile decorator to profile methods or funtions
def do_cprofile(func):
import cProfile
def profiled_func(*args, **kwargs):
profile = cProfile.Profile()
try:
profile.enable()
result = func(*args, **kwargs)
profile.disable()
return result
finally: