Skip to content

Instantly share code, notes, and snippets.

View andriisoldatenko's full-sized avatar
🏠
Working from home

Andrii Soldatenko andriisoldatenko

🏠
Working from home
View GitHub Profile
@andriisoldatenko
andriisoldatenko / teamcity_messages_decorator.py
Created September 7, 2015 15:48
Fabric decorator for build script interaction with TeamCity
from functools import wraps
def teamcity_messages(f):
"""
Decorator for Build Script Interaction with TeamCity
https://confluence.jetbrains.com/display/
TCD9/Build+Script+Interaction+with+TeamCity
"""
@wraps(f)
def wrapper(*args, **kwds):
@andriisoldatenko
andriisoldatenko / pre-commit.py
Created September 9, 2015 14:46
PEP8 pre commit git hook
#!/usr/bin/env python
from __future__ import with_statement
import os
import re
import shutil
import subprocess
import sys
import tempfile
@andriisoldatenko
andriisoldatenko / load_test_data.sh
Created October 2, 2015 07:27 — forked from clintongormley/load_test_data.sh
Run these commands in your shell to setup the test data for Chapter 5
curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d '
{
"email" : "john@smith.com",
"name" : "John Smith",
"username" : "@john"
}
'
curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d '
{
@andriisoldatenko
andriisoldatenko / commit-msg
Created October 30, 2015 10:24 — forked from remi/commit-msg
Git commit message spell check hook (kind of a proof of concept, but still usable)
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
#!/usr/bin/env ruby
# 1. Install hunspell
# $ brew install hunspell
# 2. Download a dictionary and install it in a path listed by `hunspell -D`
# $ open http://wiki.services.openoffice.org/wiki/Dictionaries
# 3. Move this file into your repository
# $ mv commit-msg /path/to/repo/.git/hooks
@andriisoldatenko
andriisoldatenko / latency.txt
Last active February 18, 2018 07:16 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@andriisoldatenko
andriisoldatenko / collocations_example.py
Created September 3, 2016 07:38
Collocations example
import pprint
from nltk.corpus import stopwords
from nltk.corpus import webtext
from nltk.collocations import BigramCollocationFinder
from nltk.metrics import BigramAssocMeasures
stopset = set(stopwords.words('english'))
filter_stops = lambda w: len(w) < 3 or w in stopset
words = [w.lower() for w in webtext.words('grail.txt')]
import re
replacement_patterns = [
(r'won\'t', 'will not'),
(r'can\'t', 'can not'),
(r'i\'m', 'i am'),
(r'ain\'t', 'is not'),
(r'(\w+)\'ll', '\g<1> will'),
(r'(\w+)n\'t', '\g<1> not'),
(r'(\w+)\'ve', '\g<1> have'),
from django.core.files.storage import get_storage_class
from storages.backends.s3boto3 import S3Boto3Storage
class StaticS3Boto3Storage(S3Boto3Storage):
file_overwrite = True
class CachedS3BotoStorage(S3Boto3Storage):
"""

Keybase proof

I hereby claim:

  • I am andriisoldatenko on github.
  • I am andriisoldatenko (https://keybase.io/andriisoldatenko) on keybase.
  • I have a public key whose fingerprint is A0D6 256A D866 BB57 9B69 FCAD 1B11 C0C2 8C75 CD5A

To claim this, I am signing this object: