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:

[Service]
ExecStart=
ExecStart=/usr/libexec/bluetooth/bluetoothd --noplugin=sap

References

  • 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
%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.

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"

References

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

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.