Skip to content

Tag: cmd

flatten directory structure

Move files in current subdirectories to the current directory.

find . -mindepth 2 -type f -exec mv -t . -i '{}' +

Delete local folders that are empty.

 find . -empty -type d -delete

PNG to PDF and PNG to PDF

You can use ImageMagick to convert multiple PNGs into a PDF and convert a multiple pages PDF into multiple PNGs.

PDF to PNG

$ convert document.pdf document.png

For a document with 10 pages, this will generate document-0.png, document-1.png, … document-9.png.

PNG to PDF

$ convert document*.png document.pdf

This convert the PNG pages into pages in the document.pdf document.

Getting an Android app source

Getting the Android’s AlarmClock application source from official repositories:

git clone git://android.git.kernel.org/platform/packages/apps/AlarmClock.git

To get the head version for an old platform like the 1.4 (codename donut), choose the correspondent branch using -o or –origin:

git clone git://android.git.kernel.org/platform/packages/apps/AlarmClock.git --origin donut

Congelando e Ressuscitando Processos

batman mr freeze

Nem só de morte vive o kill.

Suponha que você tem um processo chamado program e quer congelar seu funcionamento. Para congela-lo sem mata-lo você pode mandar um sinal SIGSTOP com:

kill -s stop `pidof program`

Para ressuscitar o mesmo processo:

kill -s cont `pidof program`