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
| #!/usr/bin/python | |
| import sys | |
| s = sys.argv[1] | |
| n=len(s) | |
| print ''.join([s[i] for i in range(n-1,-1,-1)]) |
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
| #!/usr/bin/python | |
| import sys | |
| s = sys.argv[1] | |
| n=len(s) | |
| print ''.join([s[i] if i%2 == 0 else s[i].upper() for i in range(n-1,-1,-1)]) |
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
| #!/usr/bin/perl | |
| #Format of ip Month/Year/DateThour:minute:seconds | |
| use Time::Local; | |
| my ($date,$time) = split 'T' , $ARGV[$1]; | |
| #print $date."\n".$time."\n"; | |
| my ($month, $day, $year) = split '/', $date; | |
| $month = $month - 1; #this is because timelocal wants the month to be zero indexed | |
| #print $month."\n"; | |
| my ($hr, $ |
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
| netstat -tuanp | grep LISTEN | grep (port number) #listening ports using netstat #use -p to list process id also |
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 ngram(words,n): | |
| return ["_".join(words[i:i+n]) for i in range(0,len(words)-n+1)] |
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
| private <K,T> List<Map.Entry<K, T>> denormalizeMap(Map<K,List<T>> nestedListMap) { | |
| List<Map.Entry<K, T>> denormalizedEntryList = new ArrayList<Map.Entry<K,T>>(); | |
| for(Map.Entry<K, List<T>> entry:nestedListMap.entrySet()) { | |
| for(T t:entry.getValue()) { | |
| denormalizedEntryList.add(new AbstractMap.SimpleEntry<K,T>(entry.getKey(), t)); | |
| } | |
| } | |
| return denormalizedEntryList; | |
| } |
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
| git branch --set-upstream branch_name upstream/branch_name |
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
| Test Gist |
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
| import math | |
| def lpm(*args): | |
| return sum([math.log(x) for x in args]) | |
| lpm(0.1,0.2) |
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
| public void open() { | |
| new Thread() { | |
| public void run() { | |
| loadData((Schema)null, _file); | |
| } | |
| }.start(); | |
| } | |
| @Override | |
| protected boolean processRecord(GenericRecord data) { |
OlderNewer