Since I haven’t see much script like this around the web here is a quick script to suck bunch of albums from facebooks (your own) nothing fancy just something to get you started with pyfacebook.
#!/usr/bin/python
import os
import urllib
from facebook import Facebook
# see http://developers.facebook.com/get_started.php
# Your API key
API_KEY="YOUR_API_KEY"
# Application secret key
SECRET_KEY="YOUR_SECRET_KEY"
cnx = Facebook(API_KEY, SECRET_KEY)
cnx.auth.createToken()
cnx.login()
cnx.auth.getSession()
def choose_albums(cnx):
cnt = 1
ret={}
bigthing=cnx.photos.getAlbums(cnx.uid)
for row in bigthing:
ret[cnt] = row['name'], row['aid'], row['link']
print "%d) %s - %s" % (cnt, row['name'], row['link'])
cnt += 1
ans = raw_input("Choose albums (separated by ,): ")
return [ret[int(row)] for row in ans.split(', ') ]
chosen_albums = choose_albums(cnx)
for album in chosen_albums:
name, aid, _ = album
print "Album: ", (name)
ddir = "fbgallery/%s" % name
if not os.path.exists(ddir):
os.makedirs(ddir)
for photo in cnx.photos.get(aid=aid):
url = photo['src_big']
dest="%s/%s.jpg" % (ddir, photo['pid'])
if not os.path.exists(dest):
print "Getting: ", url
urllib.urlretrieve(url, dest) |
I don’t check very often my twitter to know when someone replies and I find it hard to figure out what’s going on when i check a couple of days after even using a client showing only the reply (my client of choice lately is the Emacs twittering mode client)
I have made a script who’s checking your direct reply and email it to you. This is to setup via a cron on a server who has a mail server configured locally. You can get it from here :
http://github.com/chmouel/twitter-reply-notification

It’s probably interesting only for the hardcore Emacs users but the last CVS version of emacs (2009-12-17) get a nifty new improvement if you need to customize a face property.
If you point on the text where you want to customize it will detect it automatically which face point you are on and ask you if this is what you want to customize (after launching the command M-x customize-face). No guessing around with list-face-displays anymore.
I am just mentioning that because it does not seems to me mentioned in the CHANGES file.

Sometime ago I made a shell script to upload directly to Rackspace CF using the script capability of nautilus. While working well it did not offer the progress bar and was hard to update. I have made now as a proper python nautilus plugin which offer these features.
The code is available here :
http://github.com/chmouel/nautilus-cloud-files-plugin
The old version is here, which is still a good example for uploading to Rackspace CF via the shell :
http://github.com/chmouel/nautilus-shell-script-rackspace-cloud-files
To make it easier for people to install all the tools I have made for Rackspace Cloud Files I have made available a PPA repository for ubuntu karmic which should work in debian unstable :
https://launchpad.net/~chmouel/+archive/rackspace-cloud-files
it contains as well the API packaged until they are going to be uploaded to the official debian/ubuntu repositories.
Like a lot of people I have my irssi on a server in a screen. This has
been working great so far but my only concerns are the notifications
on the desktop when something happening.
Over the time I have found some different solution with mitigated
results for me :
- Use fanotify script with the libnotify-bin and SSH like mentioned here.
- Setup your irssi (or other) as irc proxy bouncer and connect with
your desktop client (like xchat) to get notification.
The fanotify is kind of very hacky on a laptop with intermittent
connection and having a cron doing a ssh every minutes or so is not
ideal, not talking about no passphrase ssh key or having to snoop the
SSH_AGENT variable to connect without password.
The via proxy method is not my thing and I don’t feel like having
xchat open all the time just for it and I anyway usually forget to
launch it.
My solution is to have a plugin for irssi notify me via XMPP if there
is a direct message addressed to me. I usually get my pidgin or gmail
alway open and if i don’t since it goes to a gmail account I got gmail
sending me an email about it.
You can find all the information about the install and configuration
here :
http://github.com/chmouel/irssi-xmpp-notify
Posted in Linux, Misc, Python
|
So you have a shiny new linux-2.6.32 kernel installed but your VMPlayer does not work anymore since the vmnet module does not compile by throwing this error :
CC [M] /tmp/vmware-root/modules/vmnet-only/vnetEvent.o
CC [M] /tmp/vmware-root/modules/vmnet-only/vnetUserListener.o
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerEventHandler’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: (Each undeclared identifier is reported only once
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:240: error: for each function it appears in.)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c: In function ‘VNetUserListenerRead’:
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: ‘TASK_INTERRUPTIBLE’ undeclared (first use in this function)
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘signal_pending’
/tmp/vmware-root/modules/vmnet-only/vnetUserListener.c:282: error: implicit declaration of function ‘schedule’
make[2]: *** [/tmp/vmware-root/modules/vmnet-only/vnetUserListener.o] Error 1
make[1]: *** [_module_/tmp/vmware-root/modules/vmnet-only] Error 2
make[1]: Leaving directory `/opt/temp/linux-2.6.32′
make: *** [vmnet.ko] Error 2
Just do the following to fix it :
make sure first you have installed the latest vmplayer (VMware-Player-3.0.0-203739.i386.bundle) at this time for me.
- tar xf /usr/lib/vmware/modules/source/vmnet.tar
- go to line 37 (after the last include)
- add this line #include “compat_sched.h”
- sudo tar cf /usr/lib/vmware/modules/source/vmnet.tar vmnet-only
When recompiling the kernel module it should get it built properly and working it seems…..
I have this nice Toshiba TV which is connected to a small Linux box which act as a media player. I have been some issue lately the things works fine under the 1920×1800 resolution most of the time. But once in a while I get a blank screen and the nvidia driver telling me this :
(II) Dec 03 17:00:19 NVIDIA(0): “nvidia-auto-select”
(II) Dec 03 17:00:19 NVIDIA(0): Virtual screen size determined to be 640 x 480
(WW) Dec 03 17:00:19 NVIDIA(0): Unable to get display device CRT-0′s EDID; cannot compute DPI
(WW) Dec 03 17:00:19 NVIDIA(0): from CRT-0′s EDID.
(==) Dec 03 17:00:19 NVIDIA(0): DPI set to (75, 75); computed from built-in default
(==) Dec 03 17:00:19 NVIDIA(0): Enabling 32-bit ARGB GLX visuals.
(–) Depth 24 pixmap format is 32 bpp
Spend a long time trying to debug the thing by the software but it seems that the TV has some kind of trouble and if I switch it to another HDMI connection it does detect fine which I do at about every week… not a biggie but still annoying.
Spent a bit of time to configure my Nokia mobile to teethering wih my Linux and T-Mobile. Here is some steps that may help the others :
- If you don’t have that blue bluetooth led switched on on your Dell Latitude D630 Laptop you have to enable it. I haven’t find any way to do that via the Linux Kernel module but with Windows under Vmware Player (3.0) enabling Bluetooth and installing the driver (manually not via the setup.exe) enabled bluetooth.
- Switched on bluetooth on the Phone and attached to the laptop via gnome bluetooth applet thingy.
- Get my phone device number from hcitool scan.
- And did this (as root) :
cat </etc/bluetooth/rfcomm.conf
#
# RFCOMM configuration file.
#
rfcomm0 {
# Automatically bind the device at startup
bind yes;
# Bluetooth address of the device
device YOUR:PHONE:DEVICE:NUMBER;
# RFCOMM channel for the connection
channel 4;
# Description of the connection
comment “Nokia N95″;
}
EOF
/etc/init.d/bluetooth restart
cat </etc/ppp/chat-tmobile
ABORT BUSY
ABORT ‘NO CARRIER’
ABORT ‘NO ANSWER’
ABORT ERROR
REPORT CONNECT
SAY ‘Calling t-mobile…\n’
“” ‘ATZ’
OK ‘ATE0V1&D2&C1S0=0+IFC=2,2′
SAY ‘Modem reset.\n’
SAY ‘Setting APN…’
OK ‘AT+cgdcont=1,”IP”,”general.t-mobile.uk”‘
SAY ‘APN set\n’
SAY ‘Dialling…\n’
OK ‘ATDT*99#’
TIMEOUT 30
CONNECT “”
EOF
cat </etc/ppp/peers/t-mobile
/dev/rfcomm0
460800
idle 7200
modem
noauth
lock
crtscts
defaultroute
user “user”
password “pass”
noipdefault
usepeerdns
updetach
noccp
nobsdcomp
#novj
ipcp-restart 10
ipcp-accept-local
ipcp-accept-remote
lcp-echo-interval 65535
lcp-echo-failure 10
lcp-max-configure 10
connect “/usr/sbin/chat -v -f /etc/ppp/chat-tmobile”
EOF
Under Debian distros you can enable the connection with the command ‘pon t-mobile’ or you for the others can do via the manual way with the command ‘pppd call t-mobile’.
Posted in Debian, Linux
|
I have just committed an experiment of a FTP Server answering to Cloud Files. It act completely transparently to be able to use any FTP Client to connect to cloud-files.
There is probably a couple of bugs there but the basis of it seems to be working, please let me know if you find any problems with it.
Usage
By default it will bind to port 2021 and localhost to be able to be launched by user which can be changed via the command line option -p. The username password are your API Username and key.
Manual Install
FTP-Cloudfs require the pyftpdlib which can be installed from here :
http://code.google.com/p/pyftpdlib/
and python-cloudfiles :
http://github.com/rackspace/python-cloudfiles
you can then checkout FTP-Cloudfs from here :
http://github.com/chmouel/ftp-cloudfs
The way to install python package is pretty simple, simply do a python
setup.py install after uncompressing the tarball downloaded.
Automatic Install:
You can generate a debian package directly from the source if you have
dpkg-buildpackage installed on your system. It will give you a nice
initscripts as well to start automatically the ftp cloudfs process.
Support
Albeit I am working for Rackspace Cloud this is not supported by
Rackspace but please feel free to send a comment here if you have any
problems.
Last week I have posted an article explaining how to connect to Rackspace Cloud Files via Rackspace ServiceNET but I actually got it wrong as pointed by my great colleague exlt so I had to take it down until figured out how to fix it.
I have add that feature properly to the PHP and Python API in version 1.5.0 to add a ‘servicenet’ argument to the connection and updated the blog post here :
http://blog.chmouel.com/2009/10/14/how-to-connect-to-rackspace-cloud-files-via-servicenet/
It should give you all the information for the howto use that feature.
I have released as well a minor update in 1.5.1 to allow you to define the environment variable RACKSPACE_SERVICENET to force the use of the Rackspace ServiceNET this allow you to don’t have to modify the tools and have a clean code between prod and testing.