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 / 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
#!/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 / 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
@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 / install_python.sh
Last active May 14, 2020 05:43
Install local Python 2.7.10 on CentOS 7
TMP_PATH=~/tmp_install_python
# Versions section
PYTHON_MAJOR=2.7
PYTHON_VERSION=$PYTHON_MAJOR.10
mkdir $TMP_PATH && cd $TMP_PATH
# Update yum and libraries
yum -y update
from tastypie import fields
from tastypie.authentication import Authentication
from tastypie.authorization import Authorization
from tastypie.bundle import Bundle
from tastypie.exceptions import NotFound
from tastypie.resources import Resource
# a dummy class representing a row of data
class Row(object):
@andriisoldatenko
andriisoldatenko / constdereference.patch
Created July 12, 2012 18:55 — forked from laruence/constdereference.patch
Const array/string dereference
diff --git a/Zend/zend_language_parser.y b/Zend/zend_language_parser.y
index d0730b7..893e013 100644
--- a/Zend/zend_language_parser.y
+++ b/Zend/zend_language_parser.y
@@ -789,8 +789,8 @@ expr_without_variable:
| T_EXIT exit_expr { zend_do_exit(&$$, &$2 TSRMLS_CC); }
| '@' { zend_do_begin_silence(&$1 TSRMLS_CC); } expr { zend_do_end_silence(&$1 TSRMLS_CC); $$ = $3; }
| scalar { $$ = $1; }
- | T_ARRAY '(' array_pair_list ')' { $$ = $3; }
- | '[' array_pair_list ']' { $$ = $2; }