Skip to content

Instantly share code, notes, and snippets.

View vovanbo's full-sized avatar
💭
I am

Vladimir Bolshakov vovanbo

💭
I am
View GitHub Profile
@vovanbo
vovanbo / startproject.sh
Last active December 30, 2015 10:29
Dash.app snippet for starting django project using template with context.
django-startproject.py __project-name__ --extension="py,rst,conf,wsgi" --template=https://github.com/tangentlabs/tangent-django-boilerplate/zipball/master --extra_context='{"client":"__client__", "project_code":"__project-code__", "domain":"__domain__", "timezone":"__timezone__"}'
@vovanbo
vovanbo / internal_links.js
Last active August 29, 2015 13:56
Find all Internal Links
@vovanbo
vovanbo / techique_#4.js
Last active August 29, 2015 13:56
Target Only External Links
// http://css-tricks.com/snippets/jquery/target-only-external-links/
$('a').each(function() {
var a = new RegExp('/' + window.location.host + '/');
if (!a.test(this.href)) {
// This is an external link
}
});
@vovanbo
vovanbo / dabblet.css
Created March 20, 2014 18:04 — forked from kizu/dabblet.css
Vertical text
/*
Vertical text
by @kizmarh
*/
.vertical-text {
display: inline-block;
overflow: hidden;
width: 1.5em;
}
.vertical-text__inner {
@vovanbo
vovanbo / redis.sh
Last active February 3, 2016 14:37
Proper /etc/init.d/redis script of Redis on socket in Ubuntu
#/bin/sh
#Configurations injected by install_server below....
EXEC=/usr/local/bin/redis-server
CLIEXEC=/usr/local/bin/redis-cli
PIDFILE=/var/run/redis_6379.pid
CONF=/etc/redis/6379.conf
REDISPORT=6379
REDISSOCKET=/var/run/redis_6379.sock
SOCKET_USER=www-data
@vovanbo
vovanbo / production.conf
Last active August 29, 2015 14:05
Nginx config with maintenance support (PHP, CodeIgniter, Nginx)
server {
listen 80;
server_name example.com;
charset utf-8;
rewrite_log on;
access_log /var/log/nginx/access.log;
error_log /var/log/nginx/error.log notice;
client_max_body_size 20M;
root /usr/share/nginx/www/example.com/public;
@vovanbo
vovanbo / dockers.sh
Last active August 29, 2015 14:15
Local dockers with docker-compose
#!/bin/bash
PATH_TO_CONFIG='docker-compose.yml'
unamestr=$(uname)
cmd_prefix='sudo '
if [ "${unamestr}" == "Darwin" ]; then
cmd_prefix=''
docker-machine ip dev
fi
@vovanbo
vovanbo / strategy.py
Last active August 29, 2015 14:20
Oscar's structured strategy with min/max prices
from collections import namedtuple
from operator import attrgetter
from oscar.apps.partner import prices
from oscar.apps.partner.strategy import Structured
# A container for policies
ExtendedPurchaseInfo = namedtuple(
'ExtendedPurchaseInfo', ['price',
'min_price',
@vovanbo
vovanbo / nginx_blocking_bots_config
Last active February 19, 2016 19:55
Blocking all bots except a few with Nginx (from http://stackoverflow.com/a/24820722/3890323)
map $http_user_agent $limit_bots {
default 0;
~*(google|bing|yandex|msnbot) 1;
~*(AltaVista|Googlebot|Slurp|BlackWidow|Bot|ChinaClaw|Custo|DISCo|Download|Demon|eCatch|EirGrabber|EmailSiphon|EmailWolf|SuperHTTP|Surfbot|WebWhacker) 1;
~*(Express|WebPictures|ExtractorPro|EyeNetIE|FlashGet|GetRight|GetWeb!|Go!Zilla|Go-Ahead-Got-It|GrabNet|Grafula|HMView|Go!Zilla|Go-Ahead-Got-It) 1;
~*(rafula|HMView|HTTrack|Stripper|Sucker|Indy|InterGET|Ninja|JetCar|Spider|larbin|LeechFTP|Downloader|tool|Navroad|NearSite|NetAnts|tAkeOut|WWWOFFLE) 1;
~*(GrabNet|NetSpider|Vampire|NetZIP|Octopus|Offline|PageGrabber|Foto|pavuk|pcBrowser|RealDownload|ReGet|SiteSnagger|SmartDownload|SuperBot|WebSpider) 1;
~*(Teleport|VoidEYE|Collector|WebAuto|WebCopier|WebFetch|WebGo|WebLeacher|WebReaper|WebSauger|eXtractor|Quester|WebStripper|WebZIP|Wget|Widow|Zeus) 1;
~*(Twengabot|htmlparser|libwww|Python|perl|urllib|scan|Curl|email|PycURL|Pyth|PyQ|WebCollector|WebCopy|webcraw) 1;
}
@vovanbo
vovanbo / schematics_atoms_benchmark.py
Last active March 17, 2017 19:33
Improved atoms iterator benchmark
from schematics.undefined import Undefined
from schematics.compat import iteritems
from schematics.iteration import Atom
from schematics.types import IntType, ListType, DictType, ModelType
from schematics import Model
def old_atoms(schema, mapping, keys=Atom._fields, filter=None):