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
#!/bin/bash | |
# herein we backup our indexes! this script should run at like 6pm or something, after logstash | |
# rotates to a new ES index and theres no new data coming in to the old one. we grab metadatas, | |
# compress the data files, create a restore script, and push it all up to S3. | |
TODAY=`date +"%Y.%m.%d"` | |
INDEXNAME="logstash-$TODAY" # this had better match the index name in ES | |
INDEXDIR="/usr/local/elasticsearch/data/logstash/nodes/0/indices/" | |
BACKUPCMD="/usr/local/backupTools/s3cmd --config=/usr/local/backupTools/s3cfg put" | |
BACKUPDIR="/mnt/es-backups/" | |
YEARMONTH=`date +"%Y-%m"` |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.0.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.csv.js?2.0.0"></script> | |
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.time.js?2.0.0"></script> | |
<style type="text/css"> | |
body { | |
font: 10px sans-serif; |
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 doit(text): | |
import re | |
matches=re.findall(r'\"(.+?)\"',text) | |
#matches1= re.findall(r'(.+?)\"',text) | |
# matches is now ['String 1', 'String 2', 'String3'] | |
print matches | |
return ",".join(matches) | |
q='"Terrified, mortified, petrified, stupified by you." said John Nash, "alright"' |
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 pandas as pd | |
from pytz import datetime | |
import gzip, cPickle | |
from urlparse import parse_qs | |
f = gzip.open('user_query_tuple.data','rb') | |
data_dt = cPickle.load(f) | |
f.close() | |
f = gzip.open('query_dict.data','rb') | |
data = cPickle.load(f) |
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
# Takes a user input, hashes it with MD5 crypt, and attempts to match it via brute force | |
import hashlib, time | |
md = hashlib.md5() | |
print("Welcome to a brute force MD5 cracker. \n") | |
password = input("Enter a password, composed of a number up to 99,999,999: ") | |
md.update(str(password).encode("utf-8")) | |
hashed_password = md.hexdigest() |
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 Crypto.Cipher import AES,DES,Blowfish,CAST, XOR | |
from Crypto.Hash import MD5,SHA256,hashalgo, SHA,SHA512 | |
import base64 | |
import os | |
def encryption(privateInfo): | |
BLOCK_SIZE = 16 | |
PADDING = '{' | |
def encryption(privateInfo): | |
BLOCK_SIZE = 16 |
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 pyhashxx import hashxx | |
import pyparsing | |
pyparsing? | |
from pyparsing import Word, alphas | |
greet = Word( alphas ) + "," + Word( alphas ) + "!" | |
hello = "Hello, World!" | |
print (hello, "->", greet.parseString( hello )) | |
hashxx(b'Hello World!') | |
hashxx(b'Hello', b' ', b'World!') | |
hashxx((b'Hello', b' ', b'World!')) |
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 pandas as pd | |
import numpy as np | |
import sys | |
sys.version_info | |
print sys.version_info | |
pd.version | |
pd.__version__ | |
t = np.linspace(1,27,27).reshape(3,3,3) | |
pan = pd.Panel(t) | |
print pan |
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 __future__ import with_statement # we'll use this later, has to be here | |
from argparse import ArgumentParser | |
import requests | |
from BeautifulSoup import BeautifulStoneSoup as Soup | |
def parse_sitemap(url): | |
resp = requests.get(url) | |
# we didn't get a valid response, bail |
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
pwd | |
s1 = open('stopwords.txt','r').read().split() | |
s1 | |
s2 = open('../scholarec/corpus/stopwords.txt','r').read().split() | |
s2 | |
set(s1) | |
set(s2) | |
set(s1)-set(s2) | |
l | |
ls |
OlderNewer