Skip to content

Instantly share code, notes, and snippets.

View phpdude's full-sized avatar
Working from home

Alexandr Shurigin phpdude

Working from home
View GitHub Profile
phpdude /
Last active August 29, 2015 13:56
Django user timezones
from django.conf import settings
from django.utils import timezone
import pygeoip
import pytz
db_loaded = False
db = None
def load_db():
phpdude / Boot log
Last active August 29, 2015 13:56
Django Settings Splitter
Loading project.settings submodules: env, paths, apps, assets, cache, celery, compressor, crispy, db, emails, facebook, geoip, i18n, logging, middleware, paypal, portal, security, sessions, template, urls, wsgi
phpdude / jquery.ezPhotoUploader.js
Created September 1, 2014 15:52
@md5 jQuery ezPhotoUploader.js
(function($) {
var defaults = {
'buttonTitle':'загрузить фотографию',
'limit':5, // number of files
'limitSize':4, // filesize limit in Mb
'data':null, // additional data
phpdude /
Created October 10, 2014 20:24
import json
from django.http import QueryDict
class JSONMiddleware(object):
Process application/json requests data from GET and POST requests.
phpdude / .profile
Last active August 29, 2015 14:10
Auto activate virtualenv & activate_env alias
alias activate_env='ENVDIR=""; for d in *; do if [ -f $d/bin/activate ]; then ENVDIR="$d/bin/activate"; fi; done; if [ "$ENVDIR" ]; then source $ENVDIR; else echo Virtualenv dir not found; fi'
ENVDIR=""; for d in *; do if [ -f $d/bin/activate ]; then ENVDIR="$d/bin/activate"; fi; done; if [ "$ENVDIR" ]; then source $ENVDIR; fi
phpdude / Info.plist
Last active August 29, 2015 14:10
How to install Skype poll fix into skype autoload libraries
phpdude /
Created December 31, 2014 20:29
Send a gift in myself :)
curl -H 'Cookie: YOUR COOKIES HERE' '' -d act=do_send -d al=1 -d confirm=1 -d from=profile -d hash=$HASH_FROM_AJAX_REQUESTS -d mids=$YOUR_ID -d need_module=0 -d number=$GIFT_ID -d tab=new_year -d text= -d type=0 | iconv -f cp1251
# You can get cookie from your browser by any developer browser extension
# $HASH_FROM_AJAX_REQUESTS you can get from nay ajax request.
# $GIFT_ID - Gift ID. Can get it with developer tools from gift select box.
# $YOUR_ID - Your ID.
server {
listen 80;
server_name *;
proxy_redirect off;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
phpdude / nginx.conf
Created April 13, 2015 01:38
Lifehack! Nginx proxy django static files with DEBUG=True.
location /static {
root /path/to/project/;
try_files $uri @django;
gulp = require 'gulp'
watchify = require 'watchify'
browserify = require 'browserify'
source = require 'vinyl-source-stream'
buffer = require 'vinyl-buffer'
gutil = require 'gulp-util'
assign = require 'lodash.assign'
rename = require 'rename'