How to simulate a slow HTTP server with a Dockerized lighttpd

Posted on Tue 30 August 2016 in Hacks • Tagged with lighttpd, Docker, testingLeave a comment

Today I had to work on an issue related to troubled HTTP connections. So in order to reproduce such issue I had to find a way to easily reduce the bandwidth of the HTTP transfer.

After a quick Google search I landed on this Stackoverflow answer which suggested me the ...

Continue reading

Overwriting Latex image positioning in pandoc generated pdf

Posted on Tue 14 April 2015 in Hacks • Tagged with Latex, markdownLeave a comment

Pandoc is a very powerful tool, I'm extensively using it for writing documentation, papers and so on.
You can generate pdf, html, docx and many other formats trough a compilation of markdown source file.

Often I use it to produce nice PDF documents, in this process your Markdown document ...

Continue reading

Little file browser with pdmenu

Posted on Sat 10 March 2012 in Hacks • Tagged with coding, pdmenu, perlLeave a comment

Pdmenu is a menu system for Unix. It is designed to be easy to use, and is suitable for a login shell for inexperienced users, or it can just be run at the command line as a handy menu program.

I just modified showdir.pl script in order to implement ...

Continue reading

bash snippet: dumping function call trace

Posted on Mon 18 July 2011 in Hacks • Tagged with bash, debugging, scriptLeave a comment

Uno snippet di codice bash utile nel debugging di script.

#@.. function:: __cm_exit_error([text],[...])
#@
#@   Stampa la stringa passata in stderr ed esce
#@   Se è impostata la variabile __cm_debug stampa lo stack di chiamata delle funzioni
#@
#@   :param text: la stringa da stampare
#@   :type text: String
#@
__cm_exit_error()

{
        echo "Error in ${FUNCNAME[1]}:${BASH_LINENO ...
Continue reading

cisco IOS contextual config diffs via syslog

Posted on Mon 11 October 2010 in Hacks • Tagged with cisco, cli, syslogLeave a comment

Event amanager applet per salvare il diff tra stratup-config e running-config via syslog.

event manager applet wr-mem-match 
 event cli pattern "wr.* mem.*" sync yes
 action 1.0 cli command "enable"
 action 1.1 cli command "show archive config differences nvram:/startup-config system:/running-config"
 action 1.2 syslog msg "$_cli_result"
 set ...
Continue reading

GNU/Find posix acl support

Posted on Mon 28 September 2009 in Hacks • Tagged with c, find, gnuLeave a comment

Cercare file che corrispondono a delle acl posix all'interno di un filesystem molto intricato è sempre un delirio.

Questa patch aggiunge l'opzione -acl al comando find (GNU/Findutils).

Esempio d'uso:

$ touch 1 2 3 4
$ mkdir 5
$ setfacl -m u:root:rx 1
$ setfacl -m g:bin ...
Continue reading

Verbose bash history

Posted on Thu 02 July 2009 in HacksLeave a comment

Usando questo codice durante l'inizializzasione della shell viene salvata una command history nel file .bash_verbose_history contenete data e ora, tty (oppure l'ip se l'utente è collegato in ssh) eil comando eseguito. Inoltre evita la sovrascrittura del file .bash_verbose_history e .bash_history eseguendone una copia quando il file raggiunge ...

Continue reading

Reading Windows and Office product key

Posted on Wed 17 December 2008 in Hacks • Tagged with product key, python, registry, windowsLeave a comment

I product key di M\$ Windows e Office vengono salvati nel registro in alcune chiavi cifrate
Pygetkey decifra le chiavi e le stampa a video oppure le salva in chiaro in un'altra chiave di registro. Puo' inoltre preleveare i product key da un pc remoto.

Pygetkey è scritto in ...

Continue reading

Worstbit posix acl

Posted on Fri 26 September 2008 in Hacks • Tagged with acl posix, cLeave a comment

Software C che si occupa dell'encode e decode dei filename contenuti nei dump del comando

 getfacl -R

https://github.com/pbertera/junk/tree/master/worstbit

Continue reading

Kecho

Posted on Sun 21 May 2006 in Hacks • Tagged with kernel, networkingLeave a comment

Kernel echo è un esempio di comunicazione tra userspace e kernelspace
kecho

Continue reading