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 / uuid6.sql
Created September 17, 2023 13:11 — forked from fabiolimace/UUIDv6.sql
Functions for generating UUIDv6 and UUIDv7 on PostgreSQL
/*
* MIT License
*
* Copyright (c) 2023 Fabio Lima
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@vovanbo
vovanbo / find_common.sh
Created May 3, 2018 21:40
Find common strings in files via awk
#!/bin/bash
awk 'END {
# the END block is executed after
# all the input has been read
# loop over the rec array
# and build the dup array indxed by the nuber of
# filenames containing a given record
for (R in rec) {
n = split(rec[R], t, "/")
if (n > 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):
@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 / 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 / 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 / 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 / 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 / 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 {