Skip to content

Instantly share code, notes, and snippets.

@nandff
nandff / gist:595198b314e1ed7d407ff54fc2f45481
Created October 19, 2017 08:06
macos: zsh script template: prevent idle sleep
#!/bin/zsh
{
! (( W_CAFFEINATE )) && [[ -x =caffeinate ]] && W_CAFFEINATE=1 exec caffeinate -u -d $0 $*
# main code here
exit $?
}
@nandff
nandff / gist:1686830
Created January 27, 2012 03:34
EyeFiServer TCPCheckSum speedup patch
*** tachang-EyeFiServer-4c473e7/Release 2.0/EyeFiCrypto.py Sun Feb 28 12:47:58 2010
--- ../EyeFiServer/Release 2.0/EyeFiCrypto.py Mon Jan 9 18:27:25 2012
***************
*** 2,7 ****
--- 2,8 ----
import struct
import array
import hashlib
+ import sys
@nandff
nandff / gist:1016925
Created June 9, 2011 15:10
one liner: get kml from "View in Google Earth" of Google maps My Maps
python -c 'import sys,urllib2,lxml.etree;sys.stdout.write(urllib2.urlopen(lxml.etree.parse(open(sys.argv[1])).xpath('"'"'//*[local-name() = "href"]'"'"')[0].text).read())'
-- iTunes: wait completion of refreshing a podcast
set podcast_name to "the name of a podcast"
tell application "iTunes"
repeat 600 times
set tl to (tracks of playlist "Podcasts" whose kind is "" and album is podcast_name)
if tl is {} then
exit repeat
end if
@nandff
nandff / update_podcast.scpt
Created February 25, 2010 00:29
AppleScript: iTunes: refresh podcasts whose name is "the_name_of_a_podcast"
-- iTunes: refresh podcasts whose name is "the_name_of_a_podcast"
-- podcast "the_name_of_a_porcast" cannot be empty
set album_name to "the_name_of_a_podcast"
tell application "iTunes"
updatePodcast (first track of playlist "Podcasts" whose album is album_name)
end tell