This file contains hidden or 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
- name: compress capture file | |
command: gzip ${cap_file} chdir=/tmp | |
- name: copy logs to local boxes webroot | |
fetch: src=/tmp/${cap_file}.gz dest=/var/www/ flat=yes |
This file contains hidden or 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
- name: remove files from server | |
file: path=/tmp/${cap_file}.gz state=absent |
This file contains hidden or 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
(ENV)> ansible-playbook parallel-tcpdump.yml -i hosts |
This file contains hidden or 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
(ENV)> ls -1 /var/www/ | grep packet_capture | |
packet_capture_server1_1376450197.cap.gz | |
packet_capture_server2_1376450500.cap.gz | |
packet_capture_server3_1376451234.cap.gz |
This file contains hidden or 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 collections import defaultdict | |
def auto_nested_dict(): | |
return defaultdict(auto_nested_dict) | |
if __name __ == '__main__': | |
d = auto_nested_dict() | |
d['wats']['up']['world'] = 'Here I am!' |
This file contains hidden or 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
http { | |
map $http_accept $extension { | |
default html; | |
application/json json; | |
} | |
server { | |
listen 80; | |
error_page 500 /500; |
This file contains hidden or 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
> pip install git+ssh://[email protected]/lextoumbourou/MyProject.git#egg=MyModule[extra] |
This file contains hidden or 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 get_regionserver_heap_size( | |
storage_capacity_in_gb, | |
region_max_filesize=10737418240, | |
memstore_flush_size=134217728, | |
replication_factor=3, | |
memstore_heap_fraction=0.4 | |
): | |
""" | |
Calculates heap size required based on storage requirements. | |
This file contains hidden or 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
BASE_PATH=./ | |
yum install -y wget | |
wget https://copr.fedorainfracloud.org/coprs/vbatts/bazel/repo/epel-7/vbatts-bazel-epel-7.repo -O /etc/yum.repos.d/vbatts-bazel-epel-7.repo | |
# Appear to have to run this twice to get it to run reliably. | |
yum install -y bazel; yum install -y bazel | |
if [ ! -d "$BASE_PATH/env" ]; then |
This file contains hidden or 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 torchtext import data | |
class DataFrameDataset(data.Dataset): | |
def __init__(self, df, text_field, label_field, is_test=False, **kwargs): | |
fields = [('text', text_field), ('label', label_field)] | |
examples = [] | |
for i, row in df.iterrows(): | |
label = row.sentiment if not is_test else None | |
text = row.text |