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

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
%sudo   ALL = ALL, NOPASSWD: APT

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.

Mercurial useful commands

Remove files added by mistake

$ hg forget "set:added()"

Autofirma con firefox y DNIe

— [ edit | raw ]
sudo apt install pcscd pcsc-tools opensc-pkcs11

el paquete de AutoFirma para linux (http://firmaelectronica.gob.es/Home/Descargas.html)

y añadir el pkcs11 como dispositivo en tu firefox

Preferencias > Avanzado > Certificados > Dispositivos de seguridad >
Cargar: /usr/lib/x86_64-linux-gnu/pkcs11/opensc-pkcs11.so

Construir paquetes debian con ian

Esto es una receta rápida para configurar y empezar a usar ian, una pequeña aplicación que simplifica algunos de los problemas habituales con los que se enfrenta cualquier mantenedor de paquetes Debian.

Essential git branching

— [ edit | raw ]

List (all) branches

$ git branch -a
* master
 origin/foo
 origin/bar

Change to a existing remote branch

Make the branch locally available:

$ git branch --track foo origin/foo
Branch foo set up to track remote branch foo from origin.

Move to local branch ‘foo’:

$ git checkout foo
Switched to branch 'foo'
Your branch is up-to-date with 'origin/foo.

Ultra simple tmux recipe

This is a new try to start using tmux. I am absolutly convenced about advantages of tmux, but for some strange reason, I am not able to learn its key combos…

I hope this recipe should be a way to have the very basic functions always at a glance.

Panes
horizontal split C-b %
vertical split C-b "
move cursor C-b {arrow}
close C-b x
maximize/minimize C-b z
Windows
create C-b c
change C-b {n}
Sessions
detach C-b d
attach tmux a
list tmux ls
kill tmux kill-session -t {n}

Config file

In your ~/.tmux.conf

set -g mouse on
setw -g monitor-activity on
set -g visual-activity on

eduroam en Android con certificado usando un QR code

El certificado raíz que utiliza la UCLM a día de hoy (13-12-2016) es DigiCert Assured ID Root CA .

La UCLM tiene instrucciones para conectar a eduroam con Android y también explica cómo utilizar un certificado, pero indica que hay que copiar el fichero a la memoria SD.

En lugar de eso, pongo aquí un código QR para descargarlo automáticamente:

qrcode