Ir al contenido principal

Ralsina.Me — El sitio web de Roberto Alsina

Publicaciones sobre python (publicaciones antiguas, página 15)

Flickr Banners

If you are one of the three per­sons who ac­tu­al­ly see this blog on its site in­stead of read­ing it through some sort of ag­gre­ga­tor, you may have no­ticed I have a ban­ner.

This is what it looks like:

//ralsina.me/lateral/lateral.jpg//ralsina.me/lateral/opinion.jpg

Nice, ah?

It's not very orig­i­nal (look for "spell with flick­r" to see where I stole the idea), but I wrote a script to do it. So here it is, feel free to steal it too, it's your turn.

You will need this, Im­ageMag­ick, and a Flickr API key.

To use it sim­ply call it like this:

python banner.py something

And you will have a some­thing.jpg with some­thing in it.

#!/usr/bin/env python

import flickr,sys,random
from urllib import urlopen
import os

g=flickr.Group(id="27034531@N00")

urls = []
for l in sys.argv[1]:
  if l=="a":
    l="aa"
  if l=="i":
    l="ii"
  photos = g.getPhotos(tags=[l], per_page=50)
  urls.append(photos[random.randrange(50)].getURL(
              size='Square', urlType='source'))


for i in range(0,len(urls)):
  f=open(str(i)+'.jpg','w')
  data=urlopen(urls[i]).read()
  f.write(data)
  f.close()

os.system ("montage -tile %dx1 -geometry +0+0 %s %s"%(
            len(urls),' '.join([ '%d.jpg'%x for x in range(0,
            len(urls)) ]), sys.argv[1]+'.jpg'))

Using runit is even simpler

I have post­ed in the past about runit.

One of the prob­lems peo­ple mi­grat­ing to runit have is that all your ser­vices are SysV script­s.

The runit au­thor has a col­lec­tion of scripts you can use, but usu­al­ly they re­quire some ad­just­ment to work on a spe­cif­ic ver­sion of Lin­ux.

So, I wrote a lame python script that takes the SysV scripts you are cur­rent­ly us­ing and turns them in­to runit ser­vices, in­clud­ing de­pen­den­cies.

Sup­pose you usu­al­ly start on run­lev­el 3. Then you save this script and run it like this:

mkdir services
python importinit.py 3

And you should end with a bunch of runit ser­vices in­side ser­vices/

Those ser­vices will start in rough­ly the same or­der as if you were us­ing SysV init. That's prob­a­bly way too much de­pen­den­cies.

The main dif­fer­ence is that kdm will start ear­li­er and the ttys will start way ear­li­er than you are used to.

I have found that my note­book boots faster us­ing this, but I can't pro­vide a bootchart be­cause it sim­ply does­n't seem to work in my com­put­er.

If any­one is will­ing and able to run the tests and quan­ti­fy the dif­fer­ence, I am all ears.

For some rea­son kudzu, ipt­a­bles and arpt­a­bles_jf don't work with this ap­proach, so just stick them at the bot­tom of /etc/runit/1

Al­so, please un­der­stand that these are not cor­rect runit ser­vices. They are not man­aged, so if your ser­vice crash­es it stays crashed.

So, you should still even­tu­al­ly mi­grate to cor­rect script­s. This is just a way to make that sim­pler.

CherryTV

A sim­ple (yeah, sure!) so­lu­tion so you can watch TV on all the com­put­ers in your home. Cher­ryTV!

It's smal­l, it's cher­ry­Pow­ered, and it does work.

If you see a russian, it's my doing

In this rus­sian site, you can see how they got my post about the San­ta Fe python even­t. And ap­par­ent­ly what im­pressed them is the thing about the fish and the beer.

См. вас там!

I Jornada Python en Santa Fe, Argentina

Bilin­gual en­try here:

Yo nací en San­ta Fe. Me gus­ta Python. Hay un even­to de Python en San­ta Fe.

Pien­so asi­s­tir so­la­mente co­mo es­pec­ta­dor, quedarme calla­do y es­cuchar cosas in­tere­santes que di­gan los de­mas.

Sin em­bar­go, si quieren ex­per­i­men­tar un lu­gar donde se pueden com­er 30 platos de pesca­do por 20 pe­sos (y te podes com­er los 30, aunque yo conoz­co so­la­mente una per­sona con la su­fi­ciente for­t­aleza es­tom­acal), mas to­da la cerveza que puedas tomar... bueno, nos ve­mos en San­ta Fe el 3 de ju­nio.

Mas in­for­ma­cion aca


I come from San­ta Fe. I like Python. There is a Python event on San­ta Fe.

I in­tend to at­tend in a strict­ly spec­ta­tor fash­ion. I will lis­ten to oth­er guys telling in­ter­est­ing stuff, and keep qui­et.

How­ev­er, if you want to ex­pe­ri­ence a place where you can eat 30 dif­fer­ent fish dish­es for about 7 dol­lars (and I mean you can eat all 30, al­though I know on­ly one per­son of such su­per­hu­man for­ti­tude), plus all the beer you can drink... well, I will be in San­ta Fe on June 3rd.

More in­for­ma­tion here


Contents © 2000-2023 Roberto Alsina