Skip to content

Instantly share code, notes, and snippets.

View ikatson's full-sized avatar

Igor Katson ikatson

  • Facebook
  • London
  • 13:07 (UTC +01:00)
View GitHub Profile

Keybase proof

I hereby claim:

  • I am ikatson on github.
  • I am ikatson (https://keybase.io/ikatson) on keybase.
  • I have a public key ASBpq1eRv5jbAZSPKXwTe0tbPi-mesRfv7mZuADIEMmDRgo

To claim this, I am signing this object:

@ikatson
ikatson / fswatch_propagate_pwd_changes_to_docker.sh
Created October 16, 2014 06:24
fswatch_propagate_pwd_changes_to_docker
function fswatch_propagate_pwd_changes_to_docker () {
echo "Starting fswatch on $PWD"
# tracking previous not to get into endless loop of changing the same file
local previous=''
fswatch -r "$PWD" | while read file; do
if [[ previous != "$file" ]]; then
docker run --rm -v "$PWD":"$PWD" busybox touch -c "$file"
fi
previous="$file"
done
@ikatson
ikatson / README
Created April 12, 2020 11:36
Rust gltf shaders
shaders
@ikatson
ikatson / .gitignore
Created February 16, 2019 17:56 — forked from ArthurHlt/gen-custom.sh
Generate json schema for intellij terraform plugin on a community provider
schemas
@ikatson
ikatson / websockets_test.py
Last active June 23, 2016 23:44
uwsgi websocket gevent
uwsgi.websocket_handshake(...)
user_id = get_user_id_from_environ(environ)
ready = gevent.event.Event()
dead = gevent.event.Event()
def ws_socket_waiter():
while not dead.is_set():
gevent.socket.wait_read(websocket_fd)
def get_or_create_contact_from_phones(phones_list):
return load_json(request(
'POST /api/v1/contact/get_or_create_from_phones/',
as_json({'phone': phones_list})
))
def find_contact_by_email(email):
for contact in load_json(request('GET /api/v1/contact/?q=' + email)):
if email in contact['emails']:
return contact
@ikatson
ikatson / gist:7686087
Created November 28, 2013 01:45
pandas bug: Series become empty somehow.
import pandas
class AggregatedValue(object):
def __init__(self, aggfunc, value=None, original=None):
self.aggfunc = aggfunc
self.value = value
self.original = original
def __repr__(self):
*** Starting uWSGI 1.9.18.2 (64bit) on [Tue Nov 19 20:44:14 2013] ***
compiled with version: 4.6.3 on 23 October 2013 03:45:04
os: Linux-3.2.0-23-generic #36-Ubuntu SMP Tue Apr 10 20:39:51 UTC 2012
nodename: precise64
machine: x86_64
clock source: unix
detected number of CPU cores: 2
current working directory: /src/uwsgi_includes
detected binary path: /usr/src/uwsgi-1.9.18.2/uwsgi
@ikatson
ikatson / profiling.py
Last active December 28, 2015 02:19
Simple django profiling
# coding: utf-8
# Profiling middleware and decorator, that allows to profile any django
# view easily for superusers.
__author__ = 'igor.katson@gmail.com'
import cProfile
import pstats
import tempfile
import os
import uwsgi
import gevent
import gevent.select
import gevent.socket
class ProxyMiddleware(object):