Skip to content

Instantly share code, notes, and snippets.

Working from home

Alexandr Shurigin phpdude

Working from home
View GitHub Profile
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 /
Created Dec 31, 2014
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.
phpdude / Info.plist
Last active Aug 29, 2015
How to install Skype poll fix into skype autoload libraries
View Info.plist
phpdude / .profile
Last active Aug 29, 2015
Auto activate virtualenv & activate_env alias
View .profile
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 /
Created Oct 10, 2014
import json
from django.http import QueryDict
class JSONMiddleware(object):
Process application/json requests data from GET and POST requests.
View jquery.ezPhotoUploader.js
(function($) {
var defaults = {
'buttonTitle':'загрузить фотографию',
'limit':5, // number of files
'limitSize':4, // filesize limit in Mb
'data':null, // additional data
phpdude / Git hook sync modification time to last commit time
Last active May 20, 2018
Git post-merge & post-checkout hook for sync changed files timestamps with last commit time (Linux, FreeBSD, Mac OS)
View Git hook sync modification time to last commit time
Git hook post-merge and post-checkout for sync modification time to last commit time.
You can download scripts manually and install them yourself, or you can install it with command
> curl -s | sh
This command will download post-merge script, chmod it, and create post-checkout symlink to post-merge hook.
You can also start this script manually with environment variable $GIT_MERGE_LIMIT=100 to updated timestamp of last 100 commits for example.
phpdude /
Created Mar 9, 2014
Django Simple asynchronous email backend (Celery 3.1+)
from celery import shared_task
from celery.contrib.methods import task_method
from django.core.mail.backends.smtp import EmailBackend as BaseEmailBackend
class FakeLock(object):
__enter__ = lambda x: None
__exit__ = lambda a, b, c, d: None
phpdude /
Last active Oct 11, 2017
Django LocaleByDomainMiddleware - Locale By Domain Middleware
from django.conf import settings
from django.utils import translation
class LocaleByDomainMiddleware():
def process_request(self, request):
host = request.META['HTTP_HOST'].lower()
locales = dict(settings.LOCALE_DOMAINS)
if not host in locales:
phpdude / Boot log
Last active Aug 29, 2015
Django Settings Splitter
View Boot log
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