All posts by tatico-permanent-todo

python web framework to make life easier

Let me introduce you to “bottle”
Bottle is a python web framework, much simpler than Django (with all the due respect to his majesty Django).
It is available as a debian package.

just a little update:
(I have not thoroughly tested this)
run

python -u basic_server.py

and you will gain a little bit of speed.

Bottle’s website:
http://bottle.paws.de/

python-virtenv + django


tatico@asgard:~$ mkdir virtenv
tatico@asgard:~$ virtualenv --no-site-packages -p /usr/bin/python2.6 ~/virtenv/
Running virtualenv with interpreter /usr/bin/python2.6
New python executable in /home/tatico/virtenv/bin/python2.6
Also creating executable in /home/tatico/virtenv/bin/python
Installing distribute..................................................................................................................................................................................done.
tatico@asgard:~$ cd virtenv/
tatico@asgard:~/virtenv$ ls
bin include lib
tatico@asgard:~/virtenv$ cd bin/
tatico@asgard:~/virtenv/bin$ ls
activate activate_this.py easy_install easy_install-2.6 pip python python2.6
tatico@asgard:~/virtenv/bin$ cd ..
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$
(virtenv)tatico@asgard:~/virtenv$ python --version
Python 2.6.5+
(virtenv)tatico@asgard:~/virtenv$ python
Python 2.6.5+ (release26-maint, Jul 30 2010, 23:04:10)
[GCC 4.4.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
(virtenv)tatico@asgard:~/virtenv$ pip install django
Downloading/unpacking django
Downloading Django-1.2.3.tar.gz (6.3Mb): 6.3Mb downloaded
Running setup.py egg_info for package django
warning: no files found matching 'django/dispatch/LICENSE.txt'
warning: no files found matching '*' under directory 'examples'
Installing collected packages: django
Running setup.py install for django
changing mode of build/scripts-2.6/django-admin.py from 644 to 755
warning: no files found matching 'django/dispatch/LICENSE.txt'
warning: no files found matching '*' under directory 'examples'
changing mode of /home/tatico/virtenv/bin/django-admin.py to 755
Successfully installed django
Cleaning up...
(virtenv)tatico@asgard:~/virtenv$ deactivate
tatico@asgard:~/virtenv$ ls
bin include lib
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$ django-admin.py
Usage: django-admin.py subcommand [options] [args]

Options:
-v VERBOSITY, --verbosity=VERBOSITY
Verbosity level; 0=minimal output, 1=normal output,
2=all output
--settings=SETTINGS The Python path to a settings module, e.g.
"myproject.settings.main". If this isn't provided, the
DJANGO_SETTINGS_MODULE environment variable will be
used.
--pythonpath=PYTHONPATH
A directory to add to the Python path, e.g.
"/home/djangoprojects/myproject".
--traceback Print traceback on exception
--version show program's version number and exit
-h, --help show this help message and exit

Type 'django-admin.py help ' for help on a specific subcommand.

Available subcommands:
cleanup
compilemessages
createcachetable
dbshell
diffsettings
dumpdata
flush
inspectdb
loaddata
makemessages
reset
runfcgi
runserver
shell
sql
sqlall
sqlclear
sqlcustom
sqlflush
sqlindexes
sqlinitialdata
sqlreset
sqlsequencereset
startapp
startproject
syncdb
test
testserver
validate
(virtenv)tatico@asgard:~/virtenv$ deactivate
tatico@asgard:~/virtenv$ django-admin.py
tatico@asgard:~/virtenv$ source bin/activate
(virtenv)tatico@asgard:~/virtenv$ django-admin.py testserver
Error: Settings cannot be imported, because environment variable DJANGO_SETTINGS_MODULE is undefined.
(virtenv)tatico@asgard:~/virtenv$ deactivate

ben nanonote

Here temporary post about ben nanonote.

– got it last week, openWRT works out of the box.
– flashed if with pyneo debian port, worked for a while (24 h)
– LCD became unresponsive.
– irc channel help was great 🙂
– re-flashed with OpenWRT
– LCD still not working

– I will put pictures on how to open the nanonote soon
– i will post my arduino+ servo videos
– i will rename this post to ben Nanonote + arduino

PulseAudio + Gnome in Debian

From the pulseaudio wiki + some googling:

$ apt-get install pulseaudio libao-common paprefs libpulse-mainloop-glib0 pulseaudio-module-jack pavucontrol alsaplayer-alsa pulseaudio-module-hal pulseaudio-module-x11 libgstreamer-plugins-base0.10-0 pulseaudio-module-lirc pulseaudio-utils pulseaudio-module-zeroconf libasound2-plugins padevchooser paman pulseaudio-module-gconf libgconfmm-2.6-1c2 libpulse-browse0 pavumeter libglademm-2.4-1c2a pulseaudio-esound-compat libpulse0 libpulse-dev

$ ln -sf /usr/local/bin/esdcompat /usr/bin/esd

Then, you launch gnome and everything works!

links:
http://forums.debian.net/viewtopic.php?t=12497
http://pulseaudio.org/wiki/PerfectSetup#GNOME

vlmc VideoLan Movie Creator on debian

I have taken this information from other blogs/websites + my experiencie with debian.
how to compile vlmc on debian:
install those libraries:

libavcodec-dev
libpostproc-dev
libmpeg2-4-dev
libxcb-composite0-dev

# cd /usr/local/src
# apt-get install automake1.11
be sure that you install at least version 1.11 or you will have lots of errors and you will not be able to build.
be sure to uninstall you current vlc version
#apt-get remove vlc
install the dependencies for vlc:
#apt-get build-dep vlc
#apt-get install libtool build-essential git-core libqt4-dev qt4-qmake liblua5.1-dev libswscale-dev cmake

  • Download VLC source from GIT: git clone git://git.videolan.org/vlc.git
  • Download VLMC from GIT: git clone git://github.com/VLMC/vlmc.git

first build VLC:
#cd vlc
#./bootstrap
create a build directory to avoid messing the source code
#mkdir build
# cd build/
#../configure (I will not suggest any options here, but you should take a look)
# configure: error: Your libebml is too old: you may get a more recent one from http://dl.matroska.org/downloads/libebml/. Alternatively you can use –disable-mkv to disable the matroska plugin.
– Then download the lib, build it, and continue.
same for:
http://dl.matroska.org/downloads/libmatroska/

#make && make install && make clean
#ldconfig
#cd /usr/local/src/vlmc/
#echo "LIBS = -L/usr/local/lib -lvlc" >> vlmc.pro
#cmake .
#make

references:
http://www.frenssen.be/content/install-vlmc-video-editor-ubuntu
http://wiki.videolan.org/UnixCompile
http://wiki.videolan.org/Building_VLMC

Installing a VPN

Here I will explain how i’ve manageed to have a functional VPN with running Debian as server.
I have Linux and Mac OS X clients(Tunnelblick).
What you will need

  • A public IP
  • debian
  • an editor (vi or vim)
  • this howto
  • frustration proof patienece


- to launch the server:
openvpn --config /etc/openvpn/server.conf --script-security 2 --daemon

- to launch a Linux client:
openvpn --config /etc/openvpn/client.conf --script-security 2 --daemon (Debian, Ubuntu)

– to launch a Mac OS X:
Download and install Tunnelblick

– How to generate client certificates:
one installed, to generate a VPN

#cd /etc/openvpn/easy-rsa/2.0/
#./build-key <client_name>
#cd /etc/openvpn/easy-rsa/2.0/keys/
you will find 3 files named:
- <client_name>.crt
- <client_name>.csr
- <client_name>.key (chmod 500 if not )

make a tarball with those files + ca.crt

This post is not complete. By now, you can follow the open VPN howto.

twisted web file server for ignorant cowboys

To serve files over http, you can install Twisted

apt-get install python-twisted-core python-twisted-web

To launch the web server:

twistd web --path /var/www/ --port 80

To stop the web server:
kill `cat twistd.pid` (on the same directory you launched it)

You will find complete doc at:
http://twistedmatrix.com/documents/current/web/howto/using-twistedweb.html

squirrelmail with postfix – debian

apt-get install courier-imap
http://www.debian-administration.org/articles/243

Thing 1:

http://www.squirrelmail.org/docs/admin/admin-3.html

Thing 2:
/usr/share/squirrelmail/config/conf.pl

posfix with debian

apt-get install postfix
http://wiki.debian.org/Postfix
http://www.debian-administration.org/articles/243

With an edited sample of my /etc/aliases
# /etc/aliases
root: user1@dragon-tortuga.net #all mail sento to root@dragon-tortuga.net will end in my mailbox
mailer-daemon: postmaster #all mail sent to mail-daemon will go to postmaster, wich is root which is user1 (me)
postmaster: root
hostmaster: root
webmaster: root
www: root
ftp: root
abuse: root
user1: user1@dragon-tortuga.net
my.name: user1 #an alias to have more a more formal mail address
user2: user2@sutercnologico.net
user2.realname: user2
user3: user3@dragon-tortuga.net
—————
once you have finished editting this file, run
newaliases
invoke-rc.d postfix reload

This is a very basic set up that uses system accounts with all pros and cons.

let's make things clear

I publish this blog just for fun, and most of the information you will find comes from my google research and some of the books I have at home. I’m not intending to explain things, only make available the results of things i’ve done and tested for my own personal use.

If this method offends a certain “over qualified” audience, the only effort to assume is to avoid reading this blog.
I’ve not studied anything related to informatics, I’m a self taught Linux user. In my beginnings I had to face unix systems with little or no idea of what I was doing and my only intention with this blog it to make it easier (event a the cost of misleading imprecisions) for people that is discovering this particular and remarkably amazing world of OSes.

Have a nice day.