Skip to content

Instantly share code, notes, and snippets.

@bjoerge
Created August 28, 2011 15:03
Show Gist options
  • Save bjoerge/1176770 to your computer and use it in GitHub Desktop.
Save bjoerge/1176770 to your computer and use it in GitHub Desktop.
Rolfstangen webcam set as bg
#!/usr/bin/ruby
require 'net/http'
file_name = '/tmp/rolfstangen-webcam.jpg'
Net::HTTP.start("www.rolfstangen.no") do |http|
resp = http.get("/webcam/cam_1.jpg")
open(file_name, 'wb') do |file|
file.write(resp.body)
end
`gconftool-2 --type string --set /desktop/gnome/background/picture_filename #{file_name}`
end
from appscript import app, mactypes
import urllib2
file_name = '/tmp/rolfstangen-webcam.jpg'
u = urllib2.urlopen('http://www.rolfstangen.no/webcam/cam_1.jpg')
localFile = open(file_name, 'wb')
localFile.write(u.read())
localFile.close()
app('Finder').desktop_picture.set(mactypes.File(file_name))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment