Tutorial básico de dig

Algunos comandos básicos con dig para hacer consultas DNS.

Mini referencia de SQL con Postgres

Esto es sólo una pequeña referencia rápida de operaciones habituales con Postgres.

Edición de vídeo desde consola con ffmpeg

Edición básica de vídeo desde consola

Volcar (y recuperar) una base de datos PostgreSQL

Esta receta explica una forma sencilla de hacer una copia de seguridad de una base de datos PostgreSQL completa para poderla restaurar en caso de catástrofe o mudanza.

Systemd service config overwride

You may tune systemd service files without touch provided package files just with something like:

$ sudo systemctl edit bluetooth.service

Then, write your modifications:

ExecStart=/usr/libexec/bluetooth/bluetoothd --noplugin=sap


  • https://raspberrypi.stackexchange.com/questions/40839/sap-error-on-bluetooth-service-status/99920#99920

My git cheat-sheet

— [ edit | raw ]

Delete all remote branches

$ git fetch -p; git branch -r | grep -v master | sed "s/origin\///" | xargs git push origin --delete

Sync remote and local branches

$ git fetch --prune

Option ‘prune’ removes local branches absent in remote.

My docker cheat-sheet

Open a shell in container

Or exec any program inside a running container:

$ docker exec -it <container-id-or-name> sh

Remove ALL containers

$ docker rm -f $(docker ps -aq)

Remove ALL images

$ docker rmi $(docker images -aq)

Fixing raw shell tty

— [ edit | raw ]

[This is a clone of this post just for avoid it may be lost. All attribution is to its author (Mike)]

I’ve seen the python pty trick in a few places, first when taking OSCP labs. However, if you’ve noticed there’s still some problems. 2 years ago at HackFest @r00k did a presentation where he improved the quality of the shell dramatically. Last year at HackFest, @jeffmcjunkin posted further improvements. All credit goes to them, and the excerpt below comes directly from Jeff McJunkin’s SEC560 notes.

Fine grain sudo

sudo may be configured to stop requesting passwords for specific commands to specific users or groups. This is very convenient for personal computers where there is only a user (and therefore she’s the administrator).

With next file /etc/sudoers, the sudo group members will be allowed to run apt, apt-get and dpkg commands absolutelly with no password.

For other users, the sudo behaviour do not change.

Defaults        env_reset, insults
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
Defaults        timestamp_timeout=15

Cmnd_Alias APT = /usr/bin/apt, /usr/bin/apt-get, /usr/bin/dpkg

Option ‘timestamp_timeout’ sets the time (in minutes) that the password will remain in cache, so it will not ask for it during that period. The value 0 disables the cache.

How to shrink VirtualBox image

Start VM and fill free space with zeros:

$ sudo dd if=/dev/zero of /zeros bs=1M

Stop VM and from host, locate VM disk image:

$ VBoxManage showvminfo VM_NAME | grep vdi

And finally:

$ VBoxManage modifyhd --compact "PATH-TO-FILE.vdi"


  • http://www.netreliant.com/news/8/17/Compacting-VirtualBox-Disk-Images-Linux-Guests.html