Source Code for Me (s-c.me)

Allows you to paste souce code to blogs! Adapted for Twitter! Here is Search Form in case you missed your code.
  • Code's Tags

    - Python


  • Your Codes

    None


  • Reffers

    None


  • Linked Codes

    None


Code:
Selected Language:
Show Linenumbers:
Short link for Twitter:
HTML:

HTML view:

Copy Source | Copy HTML
  1. #!/usr/bin/env python
  2. # -*- coding: UTF-8 -*-
  3.  
  4. import os
  5. import re
  6. import urllib
  7. import random
  8.  
  9. #***************************************CONFIG****************************************************************
  10. tmp_path = '/var/tmp/wallpaper/'
  11. #*************************************************************************************************************
  12.  
  13. raw_data = urllib.urlopen("http://www.socwall.com/browse/index.php?wpCategory=Everything&wpSubcategory=All&wpLimit=90&wpSortby=0&wpFilter=1&wpQueryType=0&wpMarker="+str(random.randint(10,850))).read()
  14.  
  15. list_url = re.findall('(http:\/\/.*?\/wpDL\.php\?wp_id=\d*)', raw_data)
  16. randitem = list_url[random.randint( 0, len(list_url))]
  17. raw_data = urllib.urlopen(randitem).read()
  18. url = re.search('(http:\/\/.*?\.jpg)', raw_data).group()
  19. if os.path.exists(tmp_path+'test.jpg'):
  20.     os.remove(tmp_path+'test.jpg')
  21. os.system('wget '+url+' -O '+tmp_path+'test.jpg')
  22. os.system('gconftool-2 --set  --type    string /desktop/gnome/background/picture_filename '+tmp_path+'test.jpg')
  23.  




Based on Manoli.Net's CodeFormatter. Made by Topbot (c) 2008-2012