SlideShare uma empresa Scribd logo
1 de 40
Baixar para ler offline
full circle
p.21
               full circle                        Ubuntu             p.30




p.10                                              Ubuntu             p.32



                         p.18      MOTU   p.27



p.14                                                                 p.05




p.16   Milestone/Droid      p.25           p.28   Top 5 —— Android   p.37
sudo chsh -s /path/to/binary
$USER




chsh -l
export $VARIABLE="value"




                           [lswest@lswest-laptop:~] -
                           [14:24:29]
status                          >>> for x in data.entries[0]
                                version                         ... print x
                                encoding                        ...
                                bozo                            updated
                                headers                         yweather_condition
                                etag                            updated_parsed
                                href                            links
                                namespaces                      title
                                entries                         summary_detail
                                                                geo_lat
                                                                summary
                                                                guidislink
                                                                title_detail
                                                                link
                                                                geo_long
                                                                yweather_forecast
                                                                id



                                >>>type(data)
                                <class 'feedparser.FeedParser
                                Dict'>

>>> import feedparser
>>> url = "http://weather.yah
ooapis.com/forecastrss?p=UKXX
0637&u=c"
>>> data = feedparser.parse(u
rl)
>>> data




                                >>> data.entries[0]
                                {'updated': u'Wed, 1 Apr
>>>for x in data :              2009 12:50 am BST',
... print x ...                 'yweather_condition': u,
feed                            'updated_parsed': ...
from mutagen.mp3 import MP3
                                              import os
                                              from os.path import
                                              join,getsize,exists
                                              import sys
                                              import apsw



 Dev     Graphics Internet M/media System



                                              def MakeDataBase():
                                                   pass
                                              def S2HMS(t):
CD/DVD    HDD   USB Drive Laptop   Wireless
                                                  pass
                                              def WalkThePath(musicpath):
                                                   pass
                                              def error(message):
                                                  pass
                                              def main():
                                                  pass
                                              def usage():
                                                  pass




                                              if __name__ == '__main__':
                                                  main()
def error(message):
                                 print >> sys.stderr,
                             str(message)




def usage():
    message = (
       '==============================================n'
       'mCat - Finds all *.mp3 files in a given folder (and sub-folders),n'
       'tread the id3 tags, and write that information to a SQLite database.nn'
       'Usage:n'
       't{0} <foldername>n'
       't WHERE <foldername> is the path to your MP3 files.nn'
       'Author: Greg Waltersn'
       'For Full Circle Magazinen'
       '==============================================n'
       ).format(sys.argv[0])
    error(message)
    sys.exit(1)
def main():
    global connection
    global cursor
    #----------------------------------------------
    if len(sys.argv) != 2:
        usage()
    else:
        StartFolder = sys.argv[1]
        if not exists(StartFolder): # From os.path
            print('Path {0} does not seem to
exist...Exiting.').format(StartFolder)
            sys.exit(1)
        else:
            print('About to work {0}
folder(s):').format(StartFolder)
        # Create the connection and cursor.
        connection=apsw.Connection("mCat.db3")
        cursor=connection.cursor()
        # Make the database if it doesn't exist...
        MakeDataBase()
        # Do the actual work...
        WalkThePath(StartFolder)
        # Close the cursor and connection...          Print('String that will be
        cursor.close()                                printed with {0} number of
        connection.close()                            statements”).format(replaceme
        # Let us know we are finished...              nt values)
        print("FINISHED!")
Dev     Graphics Internet M/media System




CD/DVD    HDD   USB Drive Laptop   Wireless
Dev     Graphics Internet M/media System




CD/DVD    HDD   USB Drive Laptop   Wireless




                                              wget
                                              http://www.kegel.com/wine/win
                                              etricks
>>> temp = re.split(r'n',tem
                                                          p)
                                                          >>> temp
                                                          [u, u'Current Conditions:',
sh winetricks corefonts                                   u'Haze, 13 C', u'Forecast:',
vcrun6 vcrun2005                                          u'Thu - Rain. High: 14 Low:
                                                          9', u'Fri - Light Rain.
                                                          High: 12 Low: 7', u, u'Full
                                                          Forecast at Yahoo! Weather',
                                                          u'(provided by The Weather
                                                          Channel)'] >>>temp[2]
                                                          u'Haze, 13 C'


                          >>>summary = data.entries[0].
                          summary
                          >>>import re
                          >>>pattern = '<.+?>'
                          >>>temp = re.sub(pattern,,sum
                          mary)
                          >>>temp
                          u'nCurrent                     >>>temp = re.findall(u'[0-
                          Conditions:nHaze, 13           9]+',temp[2])[0]
                          CnForecast:nThu - Rain.       >>>temp
                          High: 14 Low: 9nFri - Light    u'13'
                          Rain. High: 12 Low: 7nn       >>>
                          Full Forecast at Yahoo!         >>> temp = int(temp)
                          Weathern(provided by The       >>> temp
                          Weather Channel)'               13
change_wallpaper('/home/evil
                                                              nick/weather/warm.svg')
                                                              ... else:
                                                              ...
                                                              change_wallpaper('/home/evil
                                                              nick/weather/hot.svg')
                                                              ...




>>> def
change_wallpaper(filename):
... cmd = .join(["gconftool-
2 -s
/desktop/gnome/background/pi
cture_filename -t string
"",filename,"""])
... os.system(cmd)
...
>>>
change_wallpaper('plop.jpg')
                               >>> if (temp <0) :
                               ...
                               change_wallpaper('/home/evil
                               nick/weather/freezing.svg')
                               ... elif (temp<9) :
                               ...
                               change_wallpaper('/home/evil
                               nick/weather/snow.svg')
                               ... elif (temp<16) :
                               ...
                               change_wallpaper('/home/evil
                               nick/weather/mild.svg')
                               ... elif (temp<26):
                               ...
#!/usr/bin/python
# -*- coding: utf-8 -*-
import feedparser,re,os
def change_wallpaper(filename):
cmd = .join(["gconftool-2 -s /desktop/gnome/background/picture_filename
 -t string "",filename,"""])
os.system(cmd)
url = "http://weather.yahooapis.com/forecastrss?p=UKXX0637&u=c"
data = feedparser.parse(url)
# extract the summary from the data
summary = data.entries[0].summary
temp = re.split(r'n',re.sub('<.+?>',,summary))
temp = int(re.findall('[0-9]+',temp[2])[0])
if (temp <0) :
change_wallpaper('/home/evilnick/weather/freezing.svg')
elif (temp<9) :
change_wallpaper('/home/evilnick/weather/snow.svg')
elif (temp<16) :
change_wallpaper('/home/evilnick/weather/mild.svg')
elif (temp<26):
change_wallpaper('/home/evilnick/weather/warm.svg')
else:
change_wallpaper('/home/evilnick/weather/hot.svg')
is presented by members of the
United Kingdom’s Ubuntu Linux community.

We aim is to provide current, topical information about, and
for, Ubuntu Linux users the world over. We cover all aspects
of Ubuntu Linux and Free Software, and appeal to everyone
from the newest user to the oldest coder, from the
command line to the latest GUI.

Because the show is produced by the Ubuntu UK
community, the podcast is covered by the Ubuntu Code of
Conduct and is therefore suitable for all ages.
Weather-driven desktop wallpaper changer in Python

Mais conteúdo relacionado

Mais procurados

Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8PrinceGuru MS
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]Eleanor McHugh
 
Automatic B Day Remainder Program
Automatic B Day Remainder ProgramAutomatic B Day Remainder Program
Automatic B Day Remainder ProgramArulalan T
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testingGaruda Trainings
 
Intro to the Hadoop Stack @ April 2011 JavaMUG
Intro to the Hadoop Stack @ April 2011 JavaMUGIntro to the Hadoop Stack @ April 2011 JavaMUG
Intro to the Hadoop Stack @ April 2011 JavaMUGDavid Engfer
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalabilityWim Godden
 
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Filesystem abstractions and msg queue   sergeev - symfony camp 2018Filesystem abstractions and msg queue   sergeev - symfony camp 2018
Filesystem abstractions and msg queue sergeev - symfony camp 2018Юлия Коваленко
 
Postgresql 12 streaming replication hol
Postgresql 12 streaming replication holPostgresql 12 streaming replication hol
Postgresql 12 streaming replication holVijay Kumar N
 
Moving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASMMoving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASMMonowar Mukul
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbMarco Vigelini
 
Teaching linked lists data structures using MIDI
Teaching linked lists data structures using MIDITeaching linked lists data structures using MIDI
Teaching linked lists data structures using MIDIMark Guzdial
 
List command linux fidora
List command linux fidoraList command linux fidora
List command linux fidoraJinyuan Loh
 
Linux commands
Linux commandsLinux commands
Linux commandsshekhar70
 
The TCP/IP stack in the FreeBSD kernel COSCUP 2014
The TCP/IP stack in the FreeBSD kernel COSCUP 2014The TCP/IP stack in the FreeBSD kernel COSCUP 2014
The TCP/IP stack in the FreeBSD kernel COSCUP 2014Kevin Lo
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningMeghaj Mallick
 

Mais procurados (20)

Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8Corephpcomponentpresentation 1211425966721657-8
Corephpcomponentpresentation 1211425966721657-8
 
Python Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit TestingPython Ireland Nov 2010 Talk: Unit Testing
Python Ireland Nov 2010 Talk: Unit Testing
 
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
The Browser Environment - A Systems Programmer's Perspective [sinatra edition]
 
basic-unix.pdf
basic-unix.pdfbasic-unix.pdf
basic-unix.pdf
 
Automatic B Day Remainder Program
Automatic B Day Remainder ProgramAutomatic B Day Remainder Program
Automatic B Day Remainder Program
 
Unix commands in etl testing
Unix commands in etl testingUnix commands in etl testing
Unix commands in etl testing
 
Intro to the Hadoop Stack @ April 2011 JavaMUG
Intro to the Hadoop Stack @ April 2011 JavaMUGIntro to the Hadoop Stack @ April 2011 JavaMUG
Intro to the Hadoop Stack @ April 2011 JavaMUG
 
Caching and tuning fun for high scalability
Caching and tuning fun for high scalabilityCaching and tuning fun for high scalability
Caching and tuning fun for high scalability
 
Filesystem abstractions and msg queue sergeev - symfony camp 2018
Filesystem abstractions and msg queue   sergeev - symfony camp 2018Filesystem abstractions and msg queue   sergeev - symfony camp 2018
Filesystem abstractions and msg queue sergeev - symfony camp 2018
 
Postgresql 12 streaming replication hol
Postgresql 12 streaming replication holPostgresql 12 streaming replication hol
Postgresql 12 streaming replication hol
 
Linux class 8 tar
Linux class 8   tar  Linux class 8   tar
Linux class 8 tar
 
Moving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASMMoving 12c database from NON-ASM to ASM
Moving 12c database from NON-ASM to ASM
 
20080529dublinpt2
20080529dublinpt220080529dublinpt2
20080529dublinpt2
 
How to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdbHow to create a pluggable database by cloning an existing local pdb
How to create a pluggable database by cloning an existing local pdb
 
Quebec pdo
Quebec pdoQuebec pdo
Quebec pdo
 
Teaching linked lists data structures using MIDI
Teaching linked lists data structures using MIDITeaching linked lists data structures using MIDI
Teaching linked lists data structures using MIDI
 
List command linux fidora
List command linux fidoraList command linux fidora
List command linux fidora
 
Linux commands
Linux commandsLinux commands
Linux commands
 
The TCP/IP stack in the FreeBSD kernel COSCUP 2014
The TCP/IP stack in the FreeBSD kernel COSCUP 2014The TCP/IP stack in the FreeBSD kernel COSCUP 2014
The TCP/IP stack in the FreeBSD kernel COSCUP 2014
 
Text Mining of Twitter in Data Mining
Text Mining of Twitter in Data MiningText Mining of Twitter in Data Mining
Text Mining of Twitter in Data Mining
 

Destaque

Cool Object Building With PHP
Cool Object Building With PHPCool Object Building With PHP
Cool Object Building With PHPwensheng wei
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件wensheng wei
 
Apache配置文件说明
Apache配置文件说明Apache配置文件说明
Apache配置文件说明wensheng wei
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解wensheng wei
 
Windows 系统45个小技巧
Windows 系统45个小技巧Windows 系统45个小技巧
Windows 系统45个小技巧wensheng wei
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶 wensheng wei
 
必备的 Java 参考资源列表
必备的 Java 参考资源列表必备的 Java 参考资源列表
必备的 Java 参考资源列表wensheng wei
 
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...wensheng wei
 
非常时期,如何用
非常时期,如何用非常时期,如何用
非常时期,如何用wensheng wei
 
Subversion快速入门教程
Subversion快速入门教程Subversion快速入门教程
Subversion快速入门教程wensheng wei
 
Top 10 Web Vulnerability Scanners
Top 10 Web Vulnerability ScannersTop 10 Web Vulnerability Scanners
Top 10 Web Vulnerability Scannerswensheng wei
 
Samba Optimization and Speed Tuning f...
Samba Optimization and Speed Tuning f...Samba Optimization and Speed Tuning f...
Samba Optimization and Speed Tuning f...wensheng wei
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zendwensheng wei
 

Destaque (15)

光盘刻录
光盘刻录光盘刻录
光盘刻录
 
Cool Object Building With PHP
Cool Object Building With PHPCool Object Building With PHP
Cool Object Building With PHP
 
揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件揭秘全球最大网站Facebook背后的那些软件
揭秘全球最大网站Facebook背后的那些软件
 
Apache配置文件说明
Apache配置文件说明Apache配置文件说明
Apache配置文件说明
 
Java正则表达式详解
Java正则表达式详解Java正则表达式详解
Java正则表达式详解
 
Windows 系统45个小技巧
Windows 系统45个小技巧Windows 系统45个小技巧
Windows 系统45个小技巧
 
耳朵拉长
耳朵拉长耳朵拉长
耳朵拉长
 
Java JNI 编程进阶
Java JNI 编程进阶     Java JNI 编程进阶
Java JNI 编程进阶
 
必备的 Java 参考资源列表
必备的 Java 参考资源列表必备的 Java 参考资源列表
必备的 Java 参考资源列表
 
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...
VMware如何使用,最好用的虚拟机,VMware有哪些功能?关于虚拟机V...
 
非常时期,如何用
非常时期,如何用非常时期,如何用
非常时期,如何用
 
Subversion快速入门教程
Subversion快速入门教程Subversion快速入门教程
Subversion快速入门教程
 
Top 10 Web Vulnerability Scanners
Top 10 Web Vulnerability ScannersTop 10 Web Vulnerability Scanners
Top 10 Web Vulnerability Scanners
 
Samba Optimization and Speed Tuning f...
Samba Optimization and Speed Tuning f...Samba Optimization and Speed Tuning f...
Samba Optimization and Speed Tuning f...
 
CentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 ZendCentOS5 apache2 mysql5 php5 Zend
CentOS5 apache2 mysql5 php5 Zend
 

Semelhante a Weather-driven desktop wallpaper changer in Python

20 C programs
20 C programs20 C programs
20 C programsnavjoth
 
Building a DSL with GraalVM (VoxxedDays Luxembourg)
Building a DSL with GraalVM (VoxxedDays Luxembourg)Building a DSL with GraalVM (VoxxedDays Luxembourg)
Building a DSL with GraalVM (VoxxedDays Luxembourg)Maarten Mulders
 
Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)Maarten Mulders
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data ObjectsWez Furlong
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Cosimo Streppone
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slidesharetomcopeland
 
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...DevSecCon
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+ConFoo
 
Debugging node in prod
Debugging node in prodDebugging node in prod
Debugging node in prodYunong Xiao
 
Real World Optimization
Real World OptimizationReal World Optimization
Real World OptimizationDavid Golden
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introductionTse-Ching Ho
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionFelipe Prado
 

Semelhante a Weather-driven desktop wallpaper changer in Python (20)

DataMapper
DataMapperDataMapper
DataMapper
 
R-House (LSRC)
R-House (LSRC)R-House (LSRC)
R-House (LSRC)
 
Mongodb workshop
Mongodb workshopMongodb workshop
Mongodb workshop
 
20 C programs
20 C programs20 C programs
20 C programs
 
Building a DSL with GraalVM (VoxxedDays Luxembourg)
Building a DSL with GraalVM (VoxxedDays Luxembourg)Building a DSL with GraalVM (VoxxedDays Luxembourg)
Building a DSL with GraalVM (VoxxedDays Luxembourg)
 
Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)Building a DSL with GraalVM (CodeOne)
Building a DSL with GraalVM (CodeOne)
 
Introduction to R
Introduction to RIntroduction to R
Introduction to R
 
Ex200
Ex200Ex200
Ex200
 
PHP Data Objects
PHP Data ObjectsPHP Data Objects
PHP Data Objects
 
Puppet @ Seat
Puppet @ SeatPuppet @ Seat
Puppet @ Seat
 
EC2
EC2EC2
EC2
 
Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013Puppet at Opera Sofware - PuppetCamp Oslo 2013
Puppet at Opera Sofware - PuppetCamp Oslo 2013
 
Railsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshareRailsconf2011 deployment tips_for_slideshare
Railsconf2011 deployment tips_for_slideshare
 
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
DevSecCon London 2017 - MacOS security, hardening and forensics 101 by Ben Hu...
 
Couchdb
CouchdbCouchdb
Couchdb
 
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+Marrow: A Meta-Framework for Python 2.6+ and 3.1+
Marrow: A Meta-Framework for Python 2.6+ and 3.1+
 
Debugging node in prod
Debugging node in prodDebugging node in prod
Debugging node in prod
 
Real World Optimization
Real World OptimizationReal World Optimization
Real World Optimization
 
mongodb-introduction
mongodb-introductionmongodb-introduction
mongodb-introduction
 
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destructionDEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
DEF CON 27 - PATRICK WARDLE - harnessing weapons of Mac destruction
 

Mais de wensheng wei

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园wensheng wei
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)wensheng wei
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...wensheng wei
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术wensheng wei
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施wensheng wei
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journeywensheng wei
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:wensheng wei
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guidewensheng wei
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法wensheng wei
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10wensheng wei
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧wensheng wei
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数wensheng wei
 
入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程wensheng wei
 
LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Referencewensheng wei
 
上海实习有感
上海实习有感上海实习有感
上海实习有感wensheng wei
 
100 Essential Web Development Tools
100 Essential Web Development Tools100 Essential Web Development Tools
100 Essential Web Development Toolswensheng wei
 

Mais de wensheng wei (20)

你会柔软地想起这个校园
你会柔软地想起这个校园你会柔软地想起这个校园
你会柔软地想起这个校园
 
几米语录(1)
几米语录(1)几米语录(1)
几米语录(1)
 
我的简历
我的简历我的简历
我的简历
 
Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...Installation of Subversion on Ubuntu,...
Installation of Subversion on Ubuntu,...
 
高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术高级PHP应用程序漏洞审核技术
高级PHP应用程序漏洞审核技术
 
存储过程编写经验和优化措施
存储过程编写经验和优化措施存储过程编写经验和优化措施
存储过程编写经验和优化措施
 
Happiness is a Journey
Happiness is a JourneyHappiness is a Journey
Happiness is a Journey
 
Linux Shortcuts and Commands:
Linux Shortcuts and Commands:Linux Shortcuts and Commands:
Linux Shortcuts and Commands:
 
Linux Security Quick Reference Guide
Linux Security Quick Reference GuideLinux Security Quick Reference Guide
Linux Security Quick Reference Guide
 
Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法Android模拟器SD Card映像文件使用方法
Android模拟器SD Card映像文件使用方法
 
Subversion FAQ
Subversion FAQSubversion FAQ
Subversion FAQ
 
如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10如何硬盘安装ubuntu8.10
如何硬盘安装ubuntu8.10
 
ubunturef
ubunturefubunturef
ubunturef
 
数据库设计方法、规范与技巧
数据库设计方法、规范与技巧数据库设计方法、规范与技巧
数据库设计方法、规范与技巧
 
mysql的字符串函数
mysql的字符串函数mysql的字符串函数
mysql的字符串函数
 
入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程入门-Java运行环境变量的图文教程
入门-Java运行环境变量的图文教程
 
Java学习路径
Java学习路径Java学习路径
Java学习路径
 
LINUX Admin Quick Reference
LINUX Admin Quick ReferenceLINUX Admin Quick Reference
LINUX Admin Quick Reference
 
上海实习有感
上海实习有感上海实习有感
上海实习有感
 
100 Essential Web Development Tools
100 Essential Web Development Tools100 Essential Web Development Tools
100 Essential Web Development Tools
 

Último

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonAnna Loughnan Colquhoun
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024The Digital Insurer
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking MenDelhi Call girls
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure servicePooja Nehwal
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...Neo4j
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slidevu2urc
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking MenDelhi Call girls
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEarley Information Science
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxKatpro Technologies
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking MenDelhi Call girls
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Igalia
 

Último (20)

Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024Finology Group – Insurtech Innovation Award 2024
Finology Group – Insurtech Innovation Award 2024
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
08448380779 Call Girls In Diplomatic Enclave Women Seeking Men
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure serviceWhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
WhatsApp 9892124323 ✓Call Girls In Kalyan ( Mumbai ) secure service
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
Histor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slideHistor y of HAM Radio presentation slide
Histor y of HAM Radio presentation slide
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men08448380779 Call Girls In Greater Kailash - I Women Seeking Men
08448380779 Call Girls In Greater Kailash - I Women Seeking Men
 
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptxEIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
EIS-Webinar-Prompt-Knowledge-Eng-2024-04-08.pptx
 
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptxFactors to Consider When Choosing Accounts Payable Services Providers.pptx
Factors to Consider When Choosing Accounts Payable Services Providers.pptx
 
08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men08448380779 Call Girls In Friends Colony Women Seeking Men
08448380779 Call Girls In Friends Colony Women Seeking Men
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
Raspberry Pi 5: Challenges and Solutions in Bringing up an OpenGL/Vulkan Driv...
 

Weather-driven desktop wallpaper changer in Python

  • 2. p.21 full circle Ubuntu p.30 p.10 Ubuntu p.32 p.18 MOTU p.27 p.14 p.05 p.16 Milestone/Droid p.25 p.28 Top 5 —— Android p.37
  • 3.
  • 4.
  • 5. sudo chsh -s /path/to/binary $USER chsh -l
  • 6. export $VARIABLE="value" [lswest@lswest-laptop:~] - [14:24:29]
  • 7.
  • 8.
  • 9. status >>> for x in data.entries[0] version ... print x encoding ... bozo updated headers yweather_condition etag updated_parsed href links namespaces title entries summary_detail geo_lat summary guidislink title_detail link geo_long yweather_forecast id >>>type(data) <class 'feedparser.FeedParser Dict'> >>> import feedparser >>> url = "http://weather.yah ooapis.com/forecastrss?p=UKXX 0637&u=c" >>> data = feedparser.parse(u rl) >>> data >>> data.entries[0] {'updated': u'Wed, 1 Apr >>>for x in data : 2009 12:50 am BST', ... print x ... 'yweather_condition': u, feed 'updated_parsed': ...
  • 10. from mutagen.mp3 import MP3 import os from os.path import join,getsize,exists import sys import apsw Dev Graphics Internet M/media System def MakeDataBase(): pass def S2HMS(t): CD/DVD HDD USB Drive Laptop Wireless pass def WalkThePath(musicpath): pass def error(message): pass def main(): pass def usage(): pass if __name__ == '__main__': main()
  • 11. def error(message): print >> sys.stderr, str(message) def usage(): message = ( '==============================================n' 'mCat - Finds all *.mp3 files in a given folder (and sub-folders),n' 'tread the id3 tags, and write that information to a SQLite database.nn' 'Usage:n' 't{0} <foldername>n' 't WHERE <foldername> is the path to your MP3 files.nn' 'Author: Greg Waltersn' 'For Full Circle Magazinen' '==============================================n' ).format(sys.argv[0]) error(message) sys.exit(1)
  • 12. def main(): global connection global cursor #---------------------------------------------- if len(sys.argv) != 2: usage() else: StartFolder = sys.argv[1] if not exists(StartFolder): # From os.path print('Path {0} does not seem to exist...Exiting.').format(StartFolder) sys.exit(1) else: print('About to work {0} folder(s):').format(StartFolder) # Create the connection and cursor. connection=apsw.Connection("mCat.db3") cursor=connection.cursor() # Make the database if it doesn't exist... MakeDataBase() # Do the actual work... WalkThePath(StartFolder) # Close the cursor and connection... Print('String that will be cursor.close() printed with {0} number of connection.close() statements”).format(replaceme # Let us know we are finished... nt values) print("FINISHED!")
  • 13.
  • 14. Dev Graphics Internet M/media System CD/DVD HDD USB Drive Laptop Wireless
  • 15.
  • 16. Dev Graphics Internet M/media System CD/DVD HDD USB Drive Laptop Wireless wget http://www.kegel.com/wine/win etricks
  • 17. >>> temp = re.split(r'n',tem p) >>> temp [u, u'Current Conditions:', sh winetricks corefonts u'Haze, 13 C', u'Forecast:', vcrun6 vcrun2005 u'Thu - Rain. High: 14 Low: 9', u'Fri - Light Rain. High: 12 Low: 7', u, u'Full Forecast at Yahoo! Weather', u'(provided by The Weather Channel)'] >>>temp[2] u'Haze, 13 C' >>>summary = data.entries[0]. summary >>>import re >>>pattern = '<.+?>' >>>temp = re.sub(pattern,,sum mary) >>>temp u'nCurrent >>>temp = re.findall(u'[0- Conditions:nHaze, 13 9]+',temp[2])[0] CnForecast:nThu - Rain. >>>temp High: 14 Low: 9nFri - Light u'13' Rain. High: 12 Low: 7nn >>> Full Forecast at Yahoo! >>> temp = int(temp) Weathern(provided by The >>> temp Weather Channel)' 13
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23. change_wallpaper('/home/evil nick/weather/warm.svg') ... else: ... change_wallpaper('/home/evil nick/weather/hot.svg') ... >>> def change_wallpaper(filename): ... cmd = .join(["gconftool- 2 -s /desktop/gnome/background/pi cture_filename -t string "",filename,"""]) ... os.system(cmd) ... >>> change_wallpaper('plop.jpg') >>> if (temp <0) : ... change_wallpaper('/home/evil nick/weather/freezing.svg') ... elif (temp<9) : ... change_wallpaper('/home/evil nick/weather/snow.svg') ... elif (temp<16) : ... change_wallpaper('/home/evil nick/weather/mild.svg') ... elif (temp<26): ...
  • 24. #!/usr/bin/python # -*- coding: utf-8 -*- import feedparser,re,os def change_wallpaper(filename): cmd = .join(["gconftool-2 -s /desktop/gnome/background/picture_filename -t string "",filename,"""]) os.system(cmd) url = "http://weather.yahooapis.com/forecastrss?p=UKXX0637&u=c" data = feedparser.parse(url) # extract the summary from the data summary = data.entries[0].summary temp = re.split(r'n',re.sub('<.+?>',,summary)) temp = int(re.findall('[0-9]+',temp[2])[0]) if (temp <0) : change_wallpaper('/home/evilnick/weather/freezing.svg') elif (temp<9) : change_wallpaper('/home/evilnick/weather/snow.svg') elif (temp<16) : change_wallpaper('/home/evilnick/weather/mild.svg') elif (temp<26): change_wallpaper('/home/evilnick/weather/warm.svg') else: change_wallpaper('/home/evilnick/weather/hot.svg')
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39. is presented by members of the United Kingdom’s Ubuntu Linux community. We aim is to provide current, topical information about, and for, Ubuntu Linux users the world over. We cover all aspects of Ubuntu Linux and Free Software, and appeal to everyone from the newest user to the oldest coder, from the command line to the latest GUI. Because the show is produced by the Ubuntu UK community, the podcast is covered by the Ubuntu Code of Conduct and is therefore suitable for all ages.