Zepman's corner
dimanche 28 mai 2017
lundi 18 avril 2016
[Python] - les méthodes spéciales
__init__ : constructeur, est appelé lors de la création de l'objet
__del__ : pour détruire un objet ( del mon_objet )
__repr__: définir la façon d'afficher l'objet quand on l'appel tel quel (remplace le <__main__.XXX object at 0x00B46A70>)
__str__ : définit ce que affiche en faisant un print de l'objet (print mon_objet)
__getattr__: définit ce qu'il se passe si on appet un attribut qui n'existe pas
il faut mettre un paramètre : def __getattre__(self, nom):
si on appel mon_objet.attribut_existe_pas
ça lance cette méthode
__setattr__ : définit ce qu'il se passe quand on attribue quelque chose à un objet
__delattr__ : pour supprimer un attribut (del mon_objet.attibut)
__getitem__: mon_objet[index]
__setitem__: mon_objet[index] = valeur
__delitem__ : del mon_objet[index]
__len__: len(objet)
__add__: mon_objet + 5
__sub__ : mon_objet - 5
__mul__ : mon_objet * 5
__truediv__ : mon_objet / 5
__floordiv__ : mon_objet // 5
__mod__ : mon_objet % 5
__pow__ : mon_objet ** 5
https://openclassrooms.com/courses/apprenez-a-programmer-en-python/les-methodes-speciales-1
__del__ : pour détruire un objet ( del mon_objet )
__repr__: définir la façon d'afficher l'objet quand on l'appel tel quel (remplace le <__main__.XXX object at 0x00B46A70>)
__str__ : définit ce que affiche en faisant un print de l'objet (print mon_objet)
__getattr__: définit ce qu'il se passe si on appet un attribut qui n'existe pas
il faut mettre un paramètre : def __getattre__(self, nom):
si on appel mon_objet.attribut_existe_pas
ça lance cette méthode
__setattr__ : définit ce qu'il se passe quand on attribue quelque chose à un objet
__delattr__ : pour supprimer un attribut (del mon_objet.attibut)
__getitem__: mon_objet[index]
__setitem__: mon_objet[index] = valeur
__delitem__ : del mon_objet[index]
__len__: len(objet)
__add__: mon_objet + 5
__sub__ : mon_objet - 5
__mul__ : mon_objet * 5
__truediv__ : mon_objet / 5
__floordiv__ : mon_objet // 5
__mod__ : mon_objet % 5
__pow__ : mon_objet ** 5
https://openclassrooms.com/courses/apprenez-a-programmer-en-python/les-methodes-speciales-1
samedi 19 mars 2016
[Arduino] - Envoyer du code vers l'arduino en ligne de commande
il faut avoir installé le logiciel arduino
les dossiers lib et src sont créés
lib sert a mettre les librairies qui peuvent etre utiles
dans src il faut mettre le code sous forme de fichier .ino (ici le fichier blink.ino s'est créé automatiquement)
Pour compiler, il faut etre dans le dossier test-blink
sudo apt-get install arduinoPour envoyer du code sans passer par le logiciel arduino (https://github.com/pobot/ino)
sudo pip install inoil faut créer un dossier et lancer une commande pour créer l'arborescence type
mkdir test-blink-t blink: utilise le template blink
cd test-blink
ino init -t blink
les dossiers lib et src sont créés
lib sert a mettre les librairies qui peuvent etre utiles
dans src il faut mettre le code sous forme de fichier .ino (ici le fichier blink.ino s'est créé automatiquement)
Pour compiler, il faut etre dans le dossier test-blink
ino buildune fois le code compiler, pour uploader vers l'arduino voici la commande
ino uploadpour pouvoir lirele port série directement dans la console il faut installer picocom
sudo apt-get install picocompour afficher les données du port serie, pour sortir il faut faire Ctrl+A puis Ctrl+X
ino serialsource : http://inotool.org/quickstart
dimanche 13 mars 2016
[LINUX] - lancer un script au démarrage
lancer un script au démarrage
ajouter la ligne de commande dans /etc/rc.local
ne pas oublier de donner les droits d'exucution au script
ajouter la ligne de commande dans /etc/rc.local
ne pas oublier de donner les droits d'exucution au script
sudo chmod +x script.py
[RASPI] - SDL sur raspberry pi
Pour lancer directement un truc avec pygame il faut installer SDL apparemment
voici comment faire:
(source : https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/)
Let’s start by updating our Raspbian installation, feel free to skip this step if your system was recently updated:
Assuming, you’ve had no error in the configure phase, you can actually build and install the library:
voici comment faire:
(source : https://solarianprogrammer.com/2015/01/22/raspberry-pi-raspbian-getting-started-sdl-2/)
Let’s start by updating our Raspbian installation, feel free to skip this step if your system was recently updated:
sudo apt-get updateNext, we will need to install some libraries that will be used when we build SDL 2:
sudo apt-get upgrade
sudo apt-get install build-essential libfreeimage-dev libopenal-dev libpango1.0-dev libsndfile-dev libudev-dev libasound2-dev libjpeg8-dev libtiff5-dev libwebp-dev automakeSDL 2 can be downloaded from https://www.libsdl.org/download-2.0.php, be sure to select the source code archive, SDL2-2.0.3.tar.gz, or a newer version if available. You can download and extract the archive directly on your Raspberry Pi:
cd ~Now, it is time to configure SDL 2:
wget https://www.libsdl.org/release/SDL2-2.0.3.tar.gz
tar zxvf SDL2-2.0.3.tar.gz
cd SDL2-2.0.3 && mkdir build && cd build
../configure --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-openglor, if you have a Raspberry Pi 2 or 3:
../configure --host=armv7l-raspberry-linux-gnueabihf --disable-pulseaudio --disable-esd --disable-video-mir --disable-video-wayland --disable-video-x11 --disable-video-openglThe above options will make sure, SDL 2 is built with the OpenGL ES backend and that any SDLapplication will run as a full screen application, the windowed mode under X tends to be more buggy onRaspberry Pi. On the plus side, you will be able to launch your application, or game, directly from the text interface without the overhead of running the X server. If you wish you can start your application fromLXDE (the default window manager for Raspbian) and the application will run full screen.
Assuming, you’ve had no error in the configure phase, you can actually build and install the library:
make -j 4
sudo make install
mardi 5 mai 2015
[Python] - liste de librairies pour Python
List of Python API Wrappers
Hi. Below you will find a list of web services along with links to their docs and Python wrappers/libraries.
Alexa Web - Web traffic data
Amazon - Online Shopping
AWS - Cloud computing platform
Archive.org - Internet Archive
Balanced - Payments for Marketplaces
BigML - Machine Learning Made Easy
Bing - Microsoft search engine
Bitcoin - Open source P2P money
Bitly - URL shortener
Bitstamp - Buy and sell bitcoins
Blogger - Blog-publishing service
Box - Online file sharing
Braintree - Accept Payments Online
Carriots - M2M Application Platform
Chargify - Recurring billing application
Close.io - Sales communication platform
Coinbase - Bitcoin Wallet
Delicious - Social bookmarking service
Discogs - Marketplace for Music on Vinyl, CD..
Disqus - Blog comment hosting service
Dropbox - File hosting service
Ebay - Online auction and shopping
Embedly - Front-end developer tools
ESPN - Television Channel
Evernote - Notetaking software
Facebook - Social networking service
FedEx - Global courier delivery services
Flickr - Image and Video hosting
Forecast - Weather forecasting
Foursquare - Location based networking
Geopy - Geocoding for Python
GitHub - Online project hosting
Google Maps - Web mapping service
Google Music - Google Music
Google spreadsheet - Online Spreadsheets
Hadoop YARN - Apache Hadoop NextGen MapReduce (YARN)
Heroku - Cloud Application Platform
Highrise - Contact management tool (CRM)
HipChat - Hosted group chat and IM
iFixit - The free repair manual
iHackernews - Hacker News Mobile
Imgur - Simple Image Sharer
Indeed - Search engine for jobs
Instagram - Online photo sharing
Jira - Issue tracking product
Last.fm - Online music
Linkedin - Professional Social Network
Loggly - Cloud-based logging
Meetup - Offline group meetings
Mega - Free cloud storage
Metwit - Social and crowdsourced weather
Netflix - On-demand streaming media
PagerDuty - IT alert monitoring
Pinterest - Pinboard-style sharing
Phaxio - Faxing for Developers
Photobucket - Image hosting and video
Plot.ly - Easily analyze data together
Rackspace - Open cloud company
Reddit - Search engine for blogs
RottenTomatoes - Film review aggregator
Salesforce - Cloud computing company (CRM)
Scrapinghub - Scraping services
Slideshare - Slide hosting service
Socrata Open Data API - Data discovery for government data
Soundcloud - Share your sounds
Spotify - Music streaming service
Spreedly - Cloud based credit card vault
Stack Exchange - Community-Powered Q&A
Stripe - Payments for developers
SunlightFoundation - Sunlight Foundation
Technorati - Searching blogs
Temp Mail - Anonymous emails
The Echo Nest - Music services
The Pirate Bay - Peer-to-peer file sharing
The Movie Database - Movie and TV Database
Official Site
Wrappers
easytmdb 0.2.0 : Python Package Index
to | click |
---|---|
Source Code | https://github.com/benregn/easytmdb |
PyPI Page | https://pypi.python.org/pypi/easytmdb/0.2.0 |
Py Support | |
Last Update | |
Info Date | 2014/09/07 |
Observations and notes:
- 2014/09/07:
- based on tmdbsimple, with implementation changes (meanwhile already present in tmdbsimple)
themoviedb themoviedb.org wrapper for api v3
to | click |
---|---|
Source Code | https://github.com/doganaydin/themoviedb |
PyPI Page | |
Py Support | |
Last Update | |
Info Date | 2014/10/17 |
Observations and notes:
- 2014/10/17:
- supports API v3
- only movie search api is implemented.
themoviedb Python wrapper to themoviedb.org API
to | click |
---|---|
Source Code | https://github.com/doganaydin/themoviedb_oldapi |
PyPI Page | |
Py Support | |
Last Update | |
Info Date | 2014/10/17 |
Observations and notes:
- 2014/10/17:
- deprecated
themoviedb Python wrapper to themoviedb.org API
to | click |
---|---|
Source Code | https://github.com/dbr/themoviedb |
PyPI Page | |
Py Support | v. 2.6, v. 2.7, v. 3.3 |
Last Update | 2013/05/31 |
Info Date | 2014/09/07 |
TheMovieDB.bundle
to | click |
---|---|
Source Code | https://github.com/plexinc-agents/TheMovieDB.bundle |
PyPI Page | |
Py Support | |
Last Update | 2014/07/27 |
Info Date | 2014/09/07 |
[themoviedb-json] Unofficial themoviedb.org python api wrapper
to | click |
---|---|
Source Code | https://github.com/doganaydin/themoviedb-json |
PyPI Page | |
Last Update | |
Info Date | 2014/09/07 |
[tmdb] Python Package Index
to | click |
---|---|
Source Code | |
PyPI Page | https://pypi.python.org/pypi/tmdb/1.0b |
Py Support | v.2.7, v.3 |
Last Update | version 1.0b |
Info Date | 2014/09/07 |
Observations and notes:
- (2014/09/07)
- deprecated
TMDB Small application using TMDB APIs
to | click |
---|---|
Source Code | https://github.com/codershoder/TMDB |
PyPI Page | |
Py Support | |
Last Update | |
Info Date | 2014/09/07 |
tmdbsimple - A Python wrapper for The Movie Database API v3
to | click |
---|---|
Source Code | https://github.com/celiao/tmdbsimple |
PyPI Page | https://pypi.python.org/pypi/tmdbsimple |
Py Support | |
Last Update | version 1.0.0 (2014/09/22) |
Info Date | 2014/09/07 |
Observations and notes:
- 2014/09/07:
- simply maps API endpoints to Python functions
- supports v.3 of the API and the new Search/Multi endpoint
[tmdb3] 0.7.0 : Python Package Index
to | click |
---|---|
Source Code | |
PyPI Page | https://pypi.python.org/pypi/tmdb3 |
Py Support | |
Last Update | version 0.7.0 (?/?/?) |
Info Date | 2014/09/07 |
Tuenti - Social networking service
Tumblr - Microblogging platform
TheTVDB.com - Community driven database of television shows
Official Site
Wrappers
gnarlytvdb: A python interface to thetvdb.com xml api
to | click |
---|---|
Source Code | https://github.com/steinitzu/gnarly-tvdb |
PyPI Page | https://pypi.python.org/pypi/gnarlytvdb/0.6 |
Py Support | |
Last Update | version 0.6 (2013/01/29) |
Info Date | 2014/12/20 |
Observations and notes:
- 2014/12/20:
- Does not implement actors and banners API
pytvdb: A python library for interacting with TheTVDB.com API
to | click |
---|---|
Source Code | https://bitbucket.org/arshsingh/pytvdb |
PyPI Page | |
Py Support | |
Last Update | (2014/08/19) |
Info Date | 2014/12/20 |
PyTVDB: a Python module for the thetvdb.com API
to | click |
---|---|
Source Code | https://github.com/elderhsouza/PyTVDB |
PyPI Page | |
Py Support | |
Last Update | (2014/03/13) |
Info Date | 2014/12/20 |
pytvdbapi: A clean, resource friendly and easy to use API for thetvdb.com
to | click |
---|---|
Source Code | https://github.com/fuzzycode/pytvdbapi |
PyPI Page | https://pypi.python.org/pypi/pytvdbapi/0.5.0 |
Py Support | v.2.6, v.2.7, v.3.3 and v.3.4 |
Last Update | version 0.5.0 (2014/10/28) |
Info Date | 2014/12/20 |
thetvdb_api: A Python API for theTVDB.
to | click |
---|---|
Source Code | https://bitbucket.org/Julien-D/thetvdb_api |
PyPI Page | https://pypi.python.org/pypi/thetvdb_api/0.3.1 |
Py Support | v.2.7, v.3.2 |
Last Update | version 0.3.1 (2014/02/10) |
Info Date | 2014/12/20 |
tvdb: Module for accessing the Web API at TheTVDB.com
to | click |
---|---|
Source Code | |
PyPI Page | https://pypi.python.org/pypi/tvdb/0.22 |
Py Support | |
Last Update | version 0.22 (2009/02/20) |
Info Date | 2014/12/20 |
TVDB Caching API
to | click |
---|---|
Source Code | |
PyPI Page | https://bitbucket.org/robdennis/tvdb-caching-api |
Py Support | |
Last Update | (2012/06/26) |
Info Date | 2014/12/21 |
dbr/tvdb_api: Interface to thetvdb.com
to | click |
---|---|
Source Code | http://github.com/dbr/tvdb_api/tree/master |
PyPI Page | https://pypi.python.org/pypi/tvdb_api/1.10 |
Py Support | v.2.6, v.2.7, v.3.3 and v.3.4 |
Last Update | version 1.10 (2014/11/08) |
Info Date | 2014/12/20 |
fuzeman/tvdb_api
to | click |
---|---|
Source Code | https://github.com/fuzeman/tvdb_api |
PyPI Page | |
Py Support | |
Last Update | (2012/11/07) |
Info Date | 2014/12/21 |
Observations and notes:
- 2014/12/21:
- This is a fork of version 1.8.1 of dbr/tvdb_api (https://github.com/dbr/tvdb_api/tree/master) recomended for use with TVDB Cache Server (https://github.com/fuzeman/tvdb-cache-server)
tvdbpy: Yet another TvDB API Python wrapper. Work in progress.
to | click |
---|---|
Source Code | https://github.com/matiasb/tvdbpy |
PyPI Page | |
Py Support | |
Last Update | (2014/02/16) |
Info Date | 2014/12/20 |
Twilio - SMS and Voice through the cloud
Twitter - Online microblogging service
Udacity - Online University
Unirest - Set of lightweight HTTP libraries
UPS - Package Delivery
UrbanDictionary - Web-based dictionary
Vimeo - Video-sharing website
World Bank - Collection of development indicators
World Weather - Weather Service
Wikipedia - Wikipedia
Windows Azure - Microsoft's Cloud Platform
Wordnik - Online dictionary
Yahoo - Web portal, search engine
Yelp - Local search website
YouTube - Video-sharing website
Original Sources:
Inscription à :
Articles (Atom)