domingo, 17 de abril de 2011

Switching between python versions in OSX

I just needed to test something with python 2.7 in my osx.
I used Mac ports in the following way:

Install python 2.7:
sudo port install python27


Install python_select:
sudo port install python_select


Check the available versions doing:
sudo python_select -l


In my case the output was:

$ sudo python_select -l
Available versions:
current none python26 python26-apple python27


Changed my python version doing:
sudo python_select python27



That's it!
$ python --version
Python 2.7.1

domingo, 6 de febrero de 2011

Create img from VIDEO_TS folder in macOS

Simplest way to create a DVD image to burn.

hdiutil makehybrid -udf -udf-volume-name DVD_NAME -o MY_DVD.iso /path/to/the/folder/with/VIDEO_TS/

viernes, 12 de febrero de 2010

Restaurar una db mysql

Si por alguna casualidad la cagan y no puede crear usuarios, o metieron mano donde no debían, hay un comando para poder restaurar la db.

Estando como root:

# mysql_install_db

Y lesto el pollo.

Aclaración: ojo que borra todas las db's que haya.

lunes, 6 de julio de 2009

Archivos de un directorio de uppercase a lowercase

Script para pasar de uppercase a lowercase:


for i in `ls`; do old=$i; new=`echo $i | tr [:upper:] [:lower:]`; mv $old $new; done;

viernes, 26 de junio de 2009

Obtener el ClassPath (Java)


import java.net.URL;
import java.net.URLClassLoader;

public class PrintClasspath {
public static void main(String[] args) {

//Get the System Classloader
ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();

//Get the URLs
URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();

for(int i=0; i< urls.length; i++)
{
System.out.println(urls[i].getFile());
}

}
}


Fuente: http://www.java-tips.org/java-se-tips/java.lang/how-to-print-classpath.html

jueves, 25 de junio de 2009

Listar base de datos en mysql

/* lists databases */
SELECT * FROM INFORMATION_SCHEMA.SCHEMATA;

/* lists tables */
SELECT * FROM INFORMATION_SCHEMA.TABLES;
/* also */
use database x;
show tables;

/* lists columns */
SELECT * FROM INFORMATION_SCHEMA.COLUMNS;

sábado, 4 de abril de 2009

python setup.py uninstall

Como muchos sabrán la mayoría de los programas, libs, etc hechos en python se instalan con el comando python setup.py install. Hoy instalé una lib y después de probarla quise borrarla. Viendo el help de setup.py no encontré forma de eliminar lo instalado, pero encontré un workaround :)

:$ python setup.py install --record files.txt
:$
cat files.txt | xargs rm -rf

Listo!, lib borrada.

viernes, 6 de marzo de 2009

describe tableName en sqlite

Llamativamente no hay describe table o show table en sqlite.
La solución es la siguiente consulta:

SELECT * FROM sqlite_master;


Bastante feo :(

martes, 24 de febrero de 2009

Packeando un rar en linux

Quería lograr packear en linux un rar con estas características:
  • Compresion Level: Store
  • Volúmenes de 15.000.000
  • Old style volume naming
Para ello me bajé el rar de RARLAB y usé la siguiente línea:

./rar a -m0 -v15000 -vn nombre.rar archivoAComprimir

Link interesante: ReScene

jueves, 12 de febrero de 2009

Cambiando la url del repositorio de svn

Primero tenemos que saber cuál es la URL actual haciendo
$ svn info
Dentro de los campos hay un:
URL: https://url-vieja

Queda ejecutar el siguiente comando:

svn switch --relocate https://url-vieja https://url-nueva