This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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')] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
curl -XPUT 'http://localhost:9200/us/user/1?pretty=1' -d ' | |
{ | |
"email" : "[email protected]", | |
"name" : "John Smith", | |
"username" : "@john" | |
} | |
' | |
curl -XPUT 'http://localhost:9200/gb/user/2?pretty=1' -d ' | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
from __future__ import with_statement | |
import os | |
import re | |
import shutil | |
import subprocess | |
import sys | |
import tempfile | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# based on this | |
# https://wiki.centos.org/HowTos/Network/SecuringSSH | |
# https://www.digitalocean.com/community/tutorials/how-to-add-and-delete-users-on-a-centos-7-server | |
# Create user | |
sudo adduser newuser | |
sudo /usr/sbin/visudo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
A = [[1, 2, 3], | |
[1, 2, 3], | |
[1, 2, 3], | |
[1, 2, 3]] | |
B = [[1, 2, 3, 4], | |
[1, 2, 3, 4], | |
[1, 2, 3, 4]] | |