Skip to content

Instantly share code, notes, and snippets.

View jasoncartwright's full-sized avatar
👋
🐦

Jason Cartwright jasoncartwright

👋
🐦
View GitHub Profile
@jasoncartwright
jasoncartwright / 1984.txt
Last active December 3, 2018 11:34
Nineteen Eighty-Four, one line per sentence
PART ONE
Chapter 1
It was a bright cold day in April, and the clocks were striking thirteen.
Winston Smith, his chin nuzzled into his breast in an effort to escape the vile wind, slipped quickly through the glass doors of Victory Mansions, though not quickly enough to prevent a swirl of gritty dust from entering along with him.
The hallway smelt of boiled cabbage and old rag mats.
At one end of it a coloured poster, too large for indoor display, had been tacked to the wall.
It depicted simply an enormous face, more than a metre wide: the face of a man of about forty-five, with a heavy black moustache and ruggedly handsome features.
Winston made for the stairs.
It was no use trying the lift.
Even at the best of times it was seldom working, and at present the electric current was cut off during daylight hours.
@jasoncartwright
jasoncartwright / gip.sh
Last active August 13, 2018 17:47
Number of IP addresses Google says they own
total=0
for slash in $(dig TXT +short _netblocks{,2,3}.google.com | tr ' ' '\n' | grep '^ip4:' | cut -d '/' -f 2); do
total=$((total+$(echo "2^(32-$slash)" | bc -l)))
done
echo $total
@jasoncartwright
jasoncartwright / SV & SF Zip Codes
Last active August 29, 2015 14:10
SV & SF Zip Codes
Silicon Valley
==============
95008
95110
95111
95112
95014
95113
95116
This has moved to... https://github.com/jasoncartwright/recruiterdomains
@jasoncartwright
jasoncartwright / gist:3608074
Created September 3, 2012 09:22
Retina image swap-out for Google-hosted images
if (window.devicePixelRatio > 1) {
img_re = new RegExp(/=(s|w)(\d*)(\-c)?$/)
$("img").each(function(id, el){
img_src = $(el).attr("src")
if (img_re.test(img_src)) {
img_size = parseInt(img_src.match(img_re)[2])
dimension = img_src.match(img_re)[1]
new_img_size = img_size*2
new_src = img_src.replace(img_re,"=" + dimension + new_img_size)
$(el).attr("src",new_src)