the permanent TODO

November 30, 2009

python socket

Filed under: tech — {Francisco,François} Varas @ 9:00 am

another quick howto, shoot-then-ask type.

i needed to send automagic answers using a telnet connection to my VoD server in order to achieve a little less shocking home Vod experience for news users, beta testers, friends.

The code can by optimized, and needs handling error exceptions.

By some obscure reason, indentation is not working. I;m sorry for this.


import sys
from telnetlib import Telnet
from time import sleep

############################
## INSTALL this in your PC #
############################

#set up your own data, see the setupify.sh script
#for additional info
serverHost = '192.168.0.13'
serverPort = 4212 #you shouldn't need the change this
serverPassword = 'videolan' + '\r\n'
serverDown = 'shutdown' + '\r\n'
serverLoad = 'load /home/<your_user>/vod-setup' + '\r\n'
data = True #don't you dare...

vlc = Telnet( serverHost, serverPort )
sleep(3) #some sleeps are made only for waisting your time
print vlc.read_very_eager()
sleep(1) #some sleeps are made to wait for the server (fine tuning)
print vlc.read_very_eager()
vlc.write(serverPassword)
sleep(1)
print vlc.read_very_eager()
print "type x to exit, l to load setup file"
while data != "x":
    data=raw_input('send to vlc: ')
    if data == 'x':
        try:
            vlc.write(serverDown)
            sleep(2)
            print vlc.read_very_eager()
            exit()
        except EOFError:
            print "connection to VoD server closed by user\nBye!"
    elif data == 'l':
        vlc.write(serverLoad)
    else:
        instruction= data + "\r\n"
        vlc.write(instruction)
        sleep(1)
        print vlc.read_very_eager()

November 26, 2009

#!/bin/bash

Filed under: tech — Tags: , — {Francisco,François} Varas @ 9:00 am

I love the quick and dirty concept when you apply it over solid foundations.
This brings me to the magic world of bash scripts.

Just to warm up things, to break the ice and offer you a coffee,
here’s one of my favorite one:


for i in $( ls *.{mp3,avi,mov,flv,ogg})
do echo "media file: $i"
done

This will show al the mp3, avi, mov, flv, ogg files in the current directory

November 23, 2009

images in a report

Filed under: LaTeX — {Francisco,François} Varas @ 2:23 pm

Today I found (for the second time in my life) a LaTeX package that allows to handle images in common formats as jpg or png. I’m talking about graphicx.

The prepare a delicious salad, do the following:

  • Start using you favorite TeX editor (Texmaker, Kile, vi)
  • Choose you favorite packages
  • Add \usepackage[pdftex]{graphicx}

Then once all is mixed thoroughly :

  • \includegraphics[scale=0.5]{image.png}

Of course, it is up to you to set the image name and scale. This package has lots of option which you will find if you google.

Here’s the code, you need an image named LaTeX_logo.png or adapt the code.

\documentclass[12pt]{report}
\usepackage[pdftex]{graphicx}
\title{\LaTeX}
\date{}

\begin{document}

\maketitle{}

\LaTeX can be easily used to insert images and to manage size, rotation, effects.

\begin{itemize}

\item image \includegraphics[scale=0.3]{LaTeX_logo.png}
\item small image \includegraphics[scale=0.1]{LaTeX_logo.png}
\item rotated image \includegraphics[angle=45, scale=0.1]{LaTeX_logo.png}
\item effect \reflectbox{\includegraphics[scale=1, scale=0.1]{LaTeX_logo.png}}

\end{itemize}
\end{document}

Here you can donwload the pdf generated basic.pdf

November 19, 2009

apache2 password protected directories

Filed under: tech — {Francisco,François} Varas @ 3:25 pm

.htaccess example file:

AuthType Basic
AuthName "password required"
AuthUserFile /home/tatico/magicword
Require user files

AuthType Basic
AuthName "password required"
AuthUserFile /home/user/magic_word
Require user files

then, a little leap back in time and you will create the magic_word file

htpasswd -c /home/user/magic_word files
where the arguments are the path and the user “files”

have a nice day :D

November 17, 2009

arduino

Filed under: tech — {Francisco,François} Varas @ 5:52 pm

I consider myself a fan of the arduino board. I’ve been playing around for about a year and I have found only satisfaction from this very serious toy.

Now I’m working with PWM, to goal is to control the acceleration of a RC car, to avoid rear wheel spinning when accelerating.

I will post the PWM code soon (which is -obviously- copy/pasted from the excellent arduino docs) and the electronics needed.

November 15, 2009

home brew VoD server using free software

Filed under: tech — {Francisco,François} Varas @ 9:15 pm

This is a short, quick-and-dirty howto that aims to show through example how to have a Video On Demand server at home.

I will, as far as I can, avoid all technical boring stuff. If you are really curious, GOOGLE it.

This allows to centralize all your mp3 and avi amongst others, to have one single storage/streaming unit, avoiding redundant mp3 copies or depending on YOUR laptop to see movies. Now mom will be able to see HouseMD using her PC. (more…)

Hello world!

Filed under: Uncategorized — {Francisco,François} Varas @ 7:44 pm

Welcome to WordPress. This is your first post. Edit or delete it, then start blogging!

I though that it would be funnier to edit rather than erase it!

Powered by WordPress