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
def utf8(data): | |
"""Takes in str or unicode, returns utf-8 string, stripping invalid chars.""" | |
if type(data) not in [str, unicode]: | |
raise TypeError("'data' must be str or unicode") | |
try: | |
if type(data) is unicode: | |
s = data.encode('utf-8', 'ignore') | |
elif type(data) is str: |
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
export M2_HOME=/usr/local/share/apache-maven-3.2.1 | |
export PATH=$PATH:$M2_HOME/bin | |
export JAVA_HOME=`/usr/libexec/java_home -v 1.7` |
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
$ foo='() { echo not patched; }' bash -c foo | |
bash: foo: command not found | |
w00t! Not vulnerable. |
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
def chunker(iterable=None, chunklen=None): | |
"""Collects data into fixed-length chunks. | |
Returns: iterator of iterators. Does not pad the last chunk. | |
Raises: TypeError on bad iterable or chunklen | |
Example: chunker("abcde", 2) returns (('a', 'b'), ('c', 'd'), ('e')) | |
This is better than the functools 'grouper' recipe (using izip on | |
[iter(iterable)] * n) in that there is no performance penalty for |
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 -s 'localhost:9200/_cat/indices' | grep close | awk '{ printf "http://localhost:9200/%s\n", $2 }' | xargs -n 1 curl -i -XDELETE |
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 -XGET 'http://localhost:9200/_cluster/health?pretty=true' -s \ | |
| grep 'status' \ | |
| test 'green' == `awk -F '"' '{ print $4 }'` ; |
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/esbench_stats/bench/351b0aa5' -d '{"cluster": {"cluster_name": "mik_local", "node_count": 1, "ok": true, "nodes": {"eQDp6TjSQ8C-9_5ktiyLDA": {"thread_pool": {"index": {"max": 8, "queue_size": "200", "type": "fixed", "min": 8}, "search": {"max": 24, "queue_size": "1k", "type": "fixed", "min": 24}, "management": {"max": 5, "keep_alive": "5m", "type": "scaling", "min": 1}, "get": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "generic": {"keep_alive": "30s", "type": "cached"}, "suggest": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "refresh": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "bulk": {"max": 8, "queue_size": "50", "type": "fixed", "min": 8}, "merge": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "snapshot": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "percolate": {"max": 8, "queue_size": "1k", "type": "fixed", "min": 8}, "flush": {"max": 4, "keep_alive": "5m", "type": "scaling", "min": 1}, "warm |
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
vagrant ssh -c 'ifconfig eth1' | awk '/inet addr/{print substr($2,6)}' |
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/python | |
import os | |
# pip install psutil | |
import psutil | |
mb = psutil.Process(os.getpid()).memory_info()[0]>>20 | |
print(mb) |
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
[ ca ] | |
default_ca = ca_default | |
[ ca_default ] | |
base_dir = $ENV::HOME/.ssh | |
certificate = $base_dir/datapipe-ca.crt | |
copy_extensions = copy | |
database = $base_dir/index.txt | |
default_days = 365 | |
default_md = sha256 |
OlderNewer