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
Bitly tech talk 4/22/2010 | |
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here! | |
# jehiah | |
# in place file regex replacement | |
perl -pi -e 's/this/that/g' filename_pattern | |
# print the last column |
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
Bitly tech talk 4/22/2010 | |
On 4/22 we held a bit.ly tech talk on 'Command Line Fu', where we invited talented hackers to come share their best moves. Please correct my notes and add your fu here! | |
# @jehiah | |
# in place file regex replacement | |
perl -pi -e 's/this/that/g' filename_pattern | |
# print the last column of a file ($NF stands for 'Number of Fields' or more commonly Last Field). |
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
curl 'http://api.nytimes.com/svc/search/v1/article?query=justin%20beiber&api-key=f7b4a1749764aec0364b215c354e3a0f:18:25759498' |
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 sys, os | |
import urllib, urllib2 | |
import json | |
def main(query, api_key): | |
h = urllib.urlopen("http://api.nytimes.com/svc/search/v1/article?%s" % (urllib.urlencode({'api-key': api_key, 'query': query}))) | |
return json.loads(h.read()) | |
if __name__ == '__main__': | |
print main("title:data","f7b4a1749764aec0364b215c354e3a0f:18:25759498") |
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 sys, os | |
import json | |
if __name__ == '__main__': | |
f = open("formatted_tweets.json") | |
data = f.read() | |
f.close() | |
tweets = json.loads(data) | |
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 | |
function addnext { | |
NUM=$1 | |
sleep 1 | |
echo HI $NUM | |
NUM=$(expr $NUM + 1) | |
echo addnext $NUM >> $0 | |
} |
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
$ whois facebook.com | |
Whois Server Version 2.0 | |
Domain names in the .com and .net domains can now be registered | |
with many different competing registrars. Go to http://www.internic.net | |
for detailed information. | |
FACEBOOK.COM.ZZZZZ.GET.LAID.AT.WWW.SWINGINGCOMMUNITY.COM | |
FACEBOOK.COM.MORE.INFO.AT.WWW.BEYONDWHOIS.COM |
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 sys | |
import os | |
import json | |
import csv | |
import time | |
import pickle | |
import requests | |
API_KEY = [YOUR API KEY GOES HERE] |