Full writeup here: http://blog.samsandberg.com/2014/09/18/auto-rotate-tabs-using-applescript/
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
$ mktmpenv | |
New python executable in tmp-f4732394b48189f9/bin/python | |
Installing setuptools............done. | |
Installing pip...............done. | |
This is a temporary environment. It will be deleted when you run 'deactivate'. | |
(tmp-f4732394b48189f9) sallah:~/.virtualenvs/tmp-f4732394b48189f9$ deactivate | |
Removing temporary environment: tmp-f4732394b48189f9 | |
Removing tmp-f4732394b48189f9... |
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
# Goes a little something like this: | |
import os | |
files = [ f for f in os.listdir('.') if os.path.isfile(os.path.join('.',f)) and f.endswith('.jpg') ] | |
for i, file in enumerate(sorted(files)): | |
os.rename(file, 'image%03d.jpg' % i) | |
# Now with them renamed you can do something like: |
Race center: https://racecenter.lavuelta.es/en
Mozilla event stream docs: https://developer.mozilla.org/en-US/docs/Web/API/Server-sent_events/Using_server-sent_events
Sample cURL:
$ curl 'https://racecenter.lavuelta.es/live-stream' \
-H 'Accept: text/event-stream' \
-H 'Accept-Language: en-US,en;q=0.5' --compressed \
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
# One liner for counting unique IP addresses from nginx logs | |
# Feel free to comment with better ideas - I'm sure it's not the best way of doing this (I'm no awk ninja!) | |
# | |
# Sample output: | |
# | |
# $ cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' | |
# 66.65.145.220 49 | |
# 92.63.28.68 126 | |
cat example.com.access.log | awk -F " " '{a[$1]++ } END { for (b in a) { print b, "\t", a[b] } }' |
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
{ | |
"exclamations": [ | |
"Holy Agility", | |
"Holy Almost", | |
"Holy Alphabet", | |
"Holy Alps", | |
"Holy Alter Ego", | |
"Holy Anagram", | |
"Holy Apparition", | |
"Holy Armadillo", |
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 | |
DICT="/usr/share/dict/words" | |
NUM_WORDS=$(wc -l $DICT | awk -F " " '{print $1}') | |
NUM_DIGITS=${#NUM_WORDS} | |
while true | |
do | |
NUM="" |
- Early voting locations: https://elections.sos.ga.gov/Elections/advancedVotingInfo.do
- Personalized info: https://www.mvp.sos.ga.gov/MVP/mvp.do
Fulton County locations: https://www.mapcustomizer.com/map/Atlanta%20Early%20Voting%20Locations
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
$ python test_setattr.py | |
test_setattr 0.11335835400000001 | |
test_direct_object_manipulation 0.04550438199999998 | |
$ python test_setattr_data_types.py | |
int | |
setattr() 0.104297199 | |
direct obj manipulation 0.046985358000000005 | |
float | |
setattr() 0.097025698 |