Showing posts from 2011

xrange with float steps - Python

The great thing about this code, is that the definition its a generator. (You can easily identify the keyword yield)

def drange(start, stop, step): r = start while r < stop: yield r r += step >>>i0=drange(0.0, 1.0, 0.1) >>>["%g" % x for x in i0] ['0', '0.1', '0.2', '0.3', '0.4', '0.5', '0.6', '0.7', '0.8', '0.9', '1'] >>> source

Region Of Interest Ascii - IDL

An IDL little snippet to read Regions of Interest from an ascii file function load_roi, file_name ; Open file in read-only mode. openr, fd, file_name, /GET_LUN ; Read total pixel from 1 ROI. size = 0 readf, fd, size ; Read the indices of the pixels in the ROI result = intarr(size) readf, fd, result ; Close the file. close, fd return, result end Coded by Sil!

How to create symbolic link in Mac Os Lion

ln -s <absolute_path> <name_of_link>

Timeit function

Here i present a little function (with an example below) to time some bunch of code using timeit.
# -*- coding: utf-8 *-* import timeit class Chronoit(): """ A little class to handle timeit output. The output is in seconds. """ def __init__(self, main_statement, setup_statement, total_iterations): self.main_stmt = main_statement self.setup_stmt = setup_statement self.total_iter = total_iterations t = timeit.Timer(self.main_stmt, self.setup_stmt) self.show_results(t.timeit(number=self.total_iter)) def show_results(self, time_elapsed): time_per_pass = time_elapsed / self.total_iter if time_per_pass > 60.0: minutes_per_pass = time_per_pass / 60.0 secs_per_pass = time_per_pass % 60.0 print "#" * 50 print "Timing" print "setup stmt: \"" + self.setup_stmt.split("\n")[1] + &…

Modem Zyxel p-660R-T1 v3s Arnet

User: adminPassword: alvlgeddl

Tethering in Iphone 4 - Movistar Argentina

General → Network → Cellular Data NetworkUnder "Internet Tethering" we write:
Username: internet
Password: internet
Turn on and offGeneral → Network → Personal Hotspot and swipe to onSelect a password and you're done!

New Ninja-IDE scheme color - focojoaco version 2

{ "keyword": "#228b22", "operator": "#242424", "brace": "#228b22", "definition": "#6495ed", "string": "#ff8c00", "string2": "#838b83", "comment": "#8b8878", "properObject": "#8b0a50", "numbers": "#ff4500", "spaces": "#000000", "extras": "#A37A00", "editor-background": "#eeeee0", "editor-selection-color": "#ebc79e", "editor-selection-background": "#8b8878", "editor-text": "#242424", "current-line": "#6ca6Cf", "selected-word": "#a2cd5a", "fold-area": "white", "fold-arrow": "darkGray" } Ninja IDE Website

Change Iphone 4 voicemail number

Dial:*5005*86* "voicemail number"# This will record the number for the voicemail

Removing white spaces in Python

Using split()
in = " something with multiple white spaces " parsed = in.split() output = ' '.join(in) Using regular expresions
import re in = " something with multiple white spaces " output = re.sub("\s+" , " ", in)

How to enable pdb autocomplete?

In a pdb session, just type:
import rlcompleter pdb.Pdb.complete=rlcompleter.Completer(locals()).complete But if you use, ipdb, you dont need to import rlcompleter. Thanks to scooby that pointed this out

New wallpaper!


Counting a project line of codes with Console

find . -name "*.py" -print0 | xargs -0 wc -l
For the actual repo ninja-ide (pull date: 21/11/11), its17121 LoC
Ninja-IDE (pull date: 27/10/11), 16562 LoC

Show hidden files in Mac Os Lion

Open Terminal and run:
$ defaults write AppleShowAllFiles YES
Relaunch Finder (hold alt key and right click on Finder, then Relaunch)To hide this files again run in Terminal:
$ defaults write AppleShowAllFiles NO
and also relaunch Finder as above. source

Tips to register and protect your nickname on IRC By miltonpaiva

Connect to the IRC server and type the following:
To register:
/msg nickserv register
(you will receive a /msg-something confirmation)To avoid other users to use your nickname:
/msg NickServ set enforce onTo identify your nickname:
/msg nickserv identify

Great songs i've never known their names

The Traveling Wilburys - Not Alone Any MoreKiss - Creatures of the NightTom Petty & The Heartbreakers - Runnin' Down a DreamThe Shocker - Steel PantherThe Rolling Stones - Mixed EmotionsFranz Ferdinand - Walk AwayDavid Guetta Feat. Jennifer Hudson - Night Of Your LifeEric Clapton - Forever ManFat Boy Slim - Praise YouGreat White - Since I've Been Loving YouBruce Dickinson - Tears of the DragonAC/DC - Go DownThe Dandy Warlhols - The Last HighRush - Manhattan ProjectGlenn Fey - The Heat Is OnDeep Purple - Perfect StrangersDeep Purple - Knocking At Your Back DoorDeep Purple - Black NightRise Against - Re-Educaction (Through Labor)Air Supply - Lost In LoveStarship - We Built This City on RockNRoll

How to uninstall XCode4 from Mac OS X Lion

So i had an old version of XCode on my computer, and i tried upgrading it with the new mac app store, and it didn’t work. I wanted to uninstall it and then reinstall it using the app store, but they of course don’t have an option to UNINSTALL apps using the app store
Google tells me to just delete the app and then you can click ‘install’ again on the purchases tab in the app store, but since this is xcode, you can’t just drag an application to the trash. You have to run a command using Terminal. So, open terminal and type:

sudo /Developer/Library/uninstall-devtools –mode=all

The directory MIGHT be different, but for me it installed it to /Developer. Anyway, it should list all the packages and then say it deleted them. I restarted my mac just to be safe.
THEN, if it STILL says that xcode is installed, you need to delete the installer from /Applications (different from the Applications folder in your home folder). Go Macintosh HD/Applications and there should be a file called “Install Xcode…

Cómo escuchar la siempreRock 97.5 por internet usando Vlc

Click en "File", luego en "Open Network"Pega la url en el campo de texto, ""

Set (or change ) the hostname - Mac Os Lion

Open "System Preferences"Click on "Sharing" iconEdit the field "Computer Name" with your new hostnameActually this is very useful, because now you can see your device listed in the DHCP list at the router configuration.

My own scheme color for ninja ide! :)

{     "keyword": "#228b22",     "operator": "#242424",     "brace": "#228b22",     "definition": "#6495ed",     "string": "#ff8c00",     "string2": "#838b83",     "comment": "#8b8878",     "properObject": "#8b0a50",     "numbers": "#ff4500",     "spaces": "#000000",     "extras": "#ffff00",     "editor-background": "#eeeee0",     "editor-selection-color": "#ebc79e",     "editor-selection-background": "#8b8878",     "editor-text": "#242424",     "current-line": "#6ca6Cf",     "selected-word": "#a2cd5a",     "fold-area": "white",     "fold-arrow": "darkGray" }
Ninja-Ide Homepage!

Delete all the "Thumbs.db" files - Mac Os Lion

First, find out how many of them you have, by running this command:
find . -iname "Thumbs.db"And just run the following command in the base folder from where to erase them:
find . -iname "Thumbs.db" -delete source

Extract audio (in mp3 format) from a .flv file - Ubuntu 11.04

Open a console and run:
sudo apt-get install ffmpeg libavcodec-extra-52ffmpeg -i file.flv -ar 44100 -ab 160 -ac 2 audio.mp3

Show Desktop with Hot Corner (hover) - Ubuntu 11.04

This effect can be done using compiz!

First, install Compiz Settings Manager from the repositories
Go to "General" and click "General Options"
Look for "Key Bindings" tab, and under it select "Show Desktop" (the one with a monitor icon)
Finally select "Bottom Left" (for example)

Exposé Mac Os X like in Ubuntu 11.04

This effect can be done using compiz!
First, install Compiz Settings Manager from the repositoriesUnder "Filter", filter by the keyword "scale"Finally, select "Scale" and in the "Binding" tab, assing a method to "Iniciate Windows Picker" (with the monitor icon).
For example: "BottomRight"

New Wallpaper!


How to download Iphone's photos - Mac Os X Snow Leopard

We can use Preview Import function,
File -> Import Image

Sysmonitor Indicator Ubuntu 11.04 Natty Narwhal

sudo add-apt-repository ppa:alexeftimie/ppasudo apt-get updatesudo apt-get install indicator-sysmonitor source

Weather Indicator Applet Ubuntu 11.04 Natty Narwhal

sudo apt-get install indicator-weather

Fix file permissions in Mac OS X

A few days ago I copied a bunch of files/folders from an external NTFS formatted hard drive to my MacBook. The files where copied ok, but the permissions where messed up.

How did I fix them? With this simple command:
$ chmod -Rv u=rwx,g=rx,o=r username path_to_base_folderIt recursively goes through all files and folders and fix their permissions. Source!

Atlético de Rafaela ascendió a Primera División


Haskell in TextMate (Snow Leopard)

How to install the bundle:
mkdir -p /Library/Application\ Support/TextMate/Bundlescd /Library/Application\ Support/TextMate/Bundlesgit clone's it!

Excelent Source!

Sync iPhone apps with iTunes without deleting them

Warning: This is only for  apps! Music and other things will not be saved!
Question I have a few apps on my iPhone, and would like to sync them with iTunes without erasing them from my phone. Is this possible without downloading them all again?
Answer secondary click the iPod/iPhone on the left  click "transfer purchases" Afterwards, you can sync, and "everything" will be erased and rewritten to the Device. source

Read and Write NTFS partition under Snow Leopard

This is experimental, and known to be unstable, use at your own risk.
You need to modify /etc/fstab file to mount NTFS partitions for read and write.
First, uninstall NTFS-3G/Paragon if installed.Open Terminal
run diskutil info /Volumes/volume_name and copy the Volume UUID.
Backup /etc/fstab if you have it (shouldn't be there in a default install). Run sudo vim /etc/fstab and write:
UUID=paste_the_uuid_here none ntfs rw
LABEL=volume_name none ntfs rw
(if you don't have UUID for the disk).
Repeat for other NTFS partitions.Restart your system.Thats all!
source (great web)

Resize images with Preview (Snow Leopard)

Alternative 1 A Quick way to resize images in batches could be find that Preview has that functionality. Open the whole batch of images in Preview; the images will all open in the same window with thumbnails visible in the sidebar.
Select all of the thumbnails in the sidebar (with Command-A, or click the first and then click the last while holding Shift). Next, from the Tools menu, choose Adjust Size. You’ll be presented with a dialog containing options to resize to all the common 4:3 and 16:9 screen sizes, as well as the option to define custom dimensions. Images are scaled proportionately and resampled by default. snow leopard preview image resize
Save the resized images, and you’re done! Preview will prompt you to save any changes if you attempt to close the window. Alternative 2 You can also use sips on the command line: sips -Z 1024 *.jpg will resample to a max of 1024 px for the long edge. Note that sips rewrites images in place, so you should do this on a copy if you care.

Playing DVDs Ubuntu 10.04

Playing DVDs
In order to play DVDs you must install some additional software. Unfortunately, DVD support cannot be provided by default in Ubuntu due to legal restrictions in some countries.

Read about restricted formats before following the instructions below. There are some legal issues that you should be aware of.
Install the libdvdnav4, libdvdread4, gstreamer0.10-plugins-bad and gstreamer0.10-plugins-ugly packages.
If you would like to play encrypted DVDs, press Applications → Accessories → Terminal and type the following into the screen which appears, followed by the Enter key:
sudo /usr/share/doc/libdvdread4/
Enter your password if prompted. The libdvdcss2 package will be downloaded and installed from a website.
Insert a DVD into your drive. It should open automatically in the Movie Player.

Como configurar el control de directv para que funcione con el Tv

Primer paso:
Si nuestro control ya fue utilizado en el y decodificador a la vez, tenemos que
borrar el código ya guardado.
Para hacerlo tenemos que presionar los siguiente:
Movemos el interruptor a MODO TVPresionamos "MUTE" y "SELECT" juntos durante unos segundos hasta titile (parpadee) la luz verde del control remoto.De inmediato presionamos 9 8 1 La luz titilará 3 veces seguidas. ¡Perfecto! Ahora se habrá borrado la configuración del control remoto.
Segundo paso:
Dejamos el Interruptor en modo TV así tal cual estaba.Presionamos "MUTE" y "SELECT" juntos durante unos segundos hasta titile la luz verde del control remoto.De inmediato presionamos 9 9 1, titilará 2 veces.De inmediato presionamos 1 y vuelve a titilar.Apretamos ON y luego presionamos "CHANNEL +" (explico apretamos el de cambiar canales como si estuviésemos subiendo de canal), lo hacemos relativamente lento para que encuentre el código exacto.Cuando se apague presiona…

Could not activate celullar data network - Iphone - Movistar

If you get this error message, try editing the APN data under Settings->General->Network->Cellular Network (in spanish: Ajustes->General->Red->Red de datos móviles)
Alternative 1: APN: Username: internet Password: internet
Alternative 2: APN: Username: wap Password: wap
Alternative 1: APN: Username: clarogprs Password: clarogprs999
Alternative 2 (old but still works): APN: Username: ctigprs Password: ctigprs
Alternative 3: APN: Username: ctigprs Contraseña: ctigprs999

from source 1 and source 2

Ipod home screen...

downloaded from Ifans

Dictionary of Methods/Functions (Python)

Construct a dictionary with String (or other) keys and unbound methods or functions as values. During execution, use the string keys to select which method or function to execute. Can be used for simple parsing of tokens from a file thru a kind of object-oriented case statement.

import string def function1(): print "called function 1" def function2(): print "called function 2" def function3(): print "called function 3" tokenDict = {"cat":function1, "dog":function2, "bear":function3} # simulate, say, lines read from a file lines = ["cat","bear","cat","dog"] for line in lines: # lookup the function to call for each line functionToCall = tokenDict[line] # and call it functionToCall()
It's embarrasingly simple really, but I use it a whole lot. Instead of functions, methods might also be used (self.method1), remember to follow the binding rules if you use methods dir…

How to Install NVIDIA drivers manually on Lucid Lynx Ubuntu 10.04

Download Newest Nvidia drivers from their websiteOpen module blacklist as admin Code: sudo gedit /etc/modprobe.d/blacklist.conf Add these lines and save:Code: blacklist vga16fb blacklist nouveau blacklist rivafb blacklist nvidiafb blacklist rivatv Uninstall any previously installed Nvidia drivers:Code: sudo apt-get --purge remove nvidia-* Reboot your computerWhen an error message pops up saying that Ubuntu cannot load Nvidia drivers, choose Exit to terminal (Exit to console)Login and cd to the directory where you saved your file Install drivers Code: sudo sh Start GDM Code: sudo service gdm start Enjoy Enjoy :)

Whats my Ipod Touch mac address?

Settings -> General -> About And then scroll down Wi-Fi Address.

How to disable lock screen in Ubuntu?

System -> Preferences -> Screensaver (for ubuntu 10.04)

SCP (Secure Copy)

Copying file to host: scp SourceFileuser@host:directory/TargetFileCopying file from host: scp user@host:/directory/SourceFileTargetFilescp user@host:/directory/SourceFileTargetFolderNote that if the remote host uses a port other than the default of 22, you can specify it in the command. For example, copying a file from host: scp -P 2222 user@host:directory/SourceFileTargetFile

Mr Nobody

A continuación, pongo el post de Sofia Barlocco (exactamente como lo tiene ella en su blog), primero porque prefiero tener el texto fuente en el blog; segundo porque no me gusta poner links "lean esto de acá" y tercero, porque me gusto mucho su visión sobre la película.
(el texto lo pongo literalmente como está en su blog, si alguien quiere ver el post original entonces clic al título)

Mr. Nobody
Publicado por Sofia Barlocco [Pony]
Es impresionante como en todos lados en internet hay una sinopsis errada de esta película..
O nadie la vio, o nadie la entendió, pero ni wikipedia da el dato correcto.

La película va así: En el año 2092 Nemo Nobody es el último hombre que va a morir de viejo, en una época donde ya todas las personas son inmortales. Nemo tiene 117 años, y se está acercando lentamente a sus últimos momentos de vida. Durante la película se nos van revelando recuerdos (o algo así) de este anciano que bien podría estar completamente confundido, o ver todo mucho más claram…