View bootstrap_homeshick.sh
#!/bin/bash -ex
# Paste this into ssh
# curl -sL https://gist.github.com/andsens/2913223/raw/bootstrap_homeshick.sh | tar -xzO | /bin/bash -ex
# When forking, you can get the URL from the raw (<>) button.
### Set some command variables depending on whether we are root or not ###
# This assumes you use a debian derivate, replace with yum, pacman etc.
aptget='sudo apt-get'
chsh='sudo chsh'
View boto3_iam_access_key_rotation.py
## Meant to be scheudled on a cron/timer of 90 days (CIS Benchmark)
## The target keys need permissions to rotate themselves
import boto3
from botocore.exceptions import ClientError
import os
from datetime import datetime
import shutil
from ConfigParser import SafeConfigParser
View permissions.sql
CREATE ROLE [user_read_only] WITH LOGIN PASSWORD 'mysuperstrongpassword' NOSUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION VALID UNTIL 'infinity';
GRANT CONNECT ON DATABASE [database_name] TO [user_read_only];
GRANT USAGE ON SCHEMA public TO [user_read_only];
GRANT SELECT ON [table_name] TO [user_read_only];
REVOKE ALL ON DATABASE [database_name] FROM [user_read_only];
REVOKE ALL ON SCHEMA public FROM [user_read_only];
REVOKE ALL ON [table_name] FROM [user_read_only];
DROP USER [user_read_only];
View jsonschema_example.py
# pip install jsonschema
import json
from jsonschema import Draft4Validator
lista_exemplo = [
{'attr1': 'A', 'attr2': 2, 'attr3': 3, 'attr4': 4},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4, 'attr5': 5},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4},
{'attr1': 1, 'attr2': 2, 'attr3': 3, 'attr4': 4},
View mongodb_snippets.md

basic search

db.getCollection('collection_1').find({});

projection

db.getCollection('collection_1').find({}, {'_id': 1});
View word2vec.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View NLTK and Named Entity Recognition (Person).ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View pep20_by_example.py
#!/usr/bin/env python
"""
=====================================
PEP 20 (The Zen of Python) by example
=====================================
Usage: %prog
:Author: Hunter Blanks, hblanks@artifex.org / hblanks@monetate.com
View collection_size.py
from pymongo import MongoClient
MONGO_URI = ''
DATABASE_NAME = ''
client = MongoClient(MONGO_URI)
db = client[DATABASE_NAME]
collections = db.collection_names()
def readable_size(file_size):
View GeoIP.dat
This file has been truncated, but you can view the full file.
0100 0002 0000 0300 0004 0000 5fa0 0060
a000 0500 0006 0000 4e34 004f 3400 0700
0008 0000 aa10 00ab 1000 0900 000a 0000
9e09 009f 0900 0b00 000c 0000 5a07 005b
0700 0d00 000e 0000 3301 00e1 ffff 00ff
ff0f 0000 6900 006a 0000 1000 0011 0000
1200 0013 0000 5a00 005b 0000 1400 0015
0000 5400 0055 0000 1600 0017 0000 4a00
004b 0000 1800 0019 0000 4700 0030 ffff