Report inadequate content

Scripts in Harecoded

24/01/2012

Convert a CSV to JSON with PHP

Imagine a data list dumped in a plain text file (e.g: CSV) and you need to convert it to JSON format. You could use this simple php script to do such task.

It's the simplest version but from here you can customize it to fit your requeriments.

Usage:

php script_name.php file_to_convert.csv > result.json

The script:

$csv = file_get_contents( $argv[1] ); $csv =...

27/08/2011

Comando `tree` para Mac

Existe una utilidad llamada "tree" en Windows y Linux que sirve para ver un listado de directorio en un formato ASCII un poco más agradable a la vista. Si no quieres bajarte los MacPorts para esta pequeña utilidad lo más fácil es crear un script de una línea y enlazarlo en /bin para poder llamarlo directamente.

El comando en cuestión es este:

find . -print | sed -e...

8/09/2007

Overburning script for Mac OS X, Record large films in Mac

If you use the Finder burning tool to create your CDs, or an application that doesn't support overburning (surpass a little bit the CD or DVD maximum size) I am sure that some time you got anrgy.

Sometimes are films, sometimes it's just one more song in the CD library you are creating... The thing is that you have 703MB and you cannot burn a 700MB CD. It won't happen again!

Because I did a...

12/06/2007

Basic and simple iptables configurations for home users

OpenBSD has been always my prefered distribution when I have to install a firewall based on a *NIX machine. The PF rules are what I am used to see. But last year I had to write several configurations for a debian machine using iptables which I am not really used to. Since I tend to forget these things, I paste here a basic configuration, if you want to use it, paste this in your desired...

16/12/2006

Como conectarse a internet con un móvil symbian y Ubuntu

En un artículo anterior hablábamos sobre cómo conectarse a internet con un móbil nokia 3G y macintosh. Esta vez, nos conectaremos desde un linux (Ubuntu 6.10).

Primero de todo el móbil tiene que estar bien configurado para hacer de módem. Estos pasos son los mismos que ya hemos explicado anteriormente, en cuanto a Linux, para no andar instalando más software del que viene por defecto...

14/09/2005

Script for compressing files with gzip within the terminal with date

This is a simple bash script to compress in tar.gz (gzip) format a file or folder appending date to file name.

Save this file as gzip.sh and give it execution permissions. From terminal i could be: chmod 755 gzip.sh This script does the following:

Checks if you passed exactly 2 arguments Compresses your source Adds the date on the resulting filename Optionally changes permissions of...