Skip to content

Instantly share code, notes, and snippets.

View neilkod's full-sized avatar

neil kodner neilkod

View GitHub Profile
#!/bin/ksh
#
# Name: multiple_tkprof.sh
# Author: Kodner
# Date: 13-Apr-2010
# Purpose:
#
# Take all of the trace files with an identifier and run tkprof on them
# giving each output file an intelligent name - charging_date_serialNum.out.
# We're going to use the default sort on all of the tkprofs
#!/usr/bin/python
import sys
# command line arguments are stored in list sys.argv
# sys.argv[0] is the name of the python program itself.
print sys.argv
print "done!"
# not my code but very similar to what i'm trying to accomplish
"""
Formula:
Na = number of set A elements
Nb = number of set B elements
Nc = number of common items
T = Nc / (Na + Nb - Nc)
"""
def tanimoto(a, b):
neil-kodners-MacBook-Pro:gardenhose nkodner$ grep -iPo 'g+o+a+l+' gardenhose.out|sort|uniq -c
2 GOAAAAAALLL
1 GOAAAAALLLLL
1 GOAAAAL
6 GOAAAL
137 GOAL
3 GOALLL
4 GOALLLLL
5 GOALLLLLLLLL
1 GOALLLLLLLLLLLLLLLLL
#!/usr/bin/python
import MySQLdb
conn = MySQLdb.connect (host = "localhost",user="root",db="test")
cursor = conn.cursor()
cursor.execute("SELECT VERSION()")
row = cursor.fetchone()
print "server version:", row[0]
cursor.close()
cursor=conn.cursor()
conn.close()
neil-kodners-MacBook-Pro:gardenhose nkodner$ time cat *.json|grep -iPo 'g+o+a+l+' |sort|uniq -c|sort -rg
50225 goal
11727 Goal
4202 GOAL
798 goAl
340 goall
92 GOAAAL
88 goaL
75 Goall
69 GoaL
71977 goal
17674 Goal
8125 GOAL
390 goall
197 GOAAAL
128 GOALLL
115 GOal
114 GOALLLLL
111 goaaaal
104 Gooooooaaall
71977 goal
17674 Goal
8125 GOAL
390 goall
197 GOAAAL
128 GOALLL
115 GOal
114 GOALLLLL
111 goaaaal
104 Gooooooaaall
neil-kodners-MacBook-Pro:gardenhose nkodner$ time cat *.json|grep -iPo "#(usa|mex|hon|bra|par|chi|arg|uru|alg|civ|gha|nga|cmr|rsa|prk|jpn|kor|aus|nzl|eng|fra|esp|por|ned|den|ger|sui|ita|svk|svn|srb|gre)\b"|tr '[:upper:]' '[:lower:']|sort|uniq -c|sort -rg
358362 #bra
40091 #arg
36495 #usa
34797 #esp
34221 #jpn
33834 #civ
32353 #ger
30116 #chi
29841 #eng
112725 gol
82963 goal
20344 Goal
17272 Gol
14193 GOL
9626 GOAL
2862 gool
1770 ggol
1404 goll
1292 GOOOL