Category Archives: Linux

sendmail: send file contents

sendmail someone@somewhere.com < somefile

Also posted in Linux shell, Uncategorized | Leave a comment

counting failed login attempts group by ip address

cat /var/log/auth.log|grep fail|awk ‘{ print $14}’|sort|uniq –count|sort -nr

Also posted in Linux shell | Leave a comment

Resize images massively

Resize all images in current directory to 600px height: for i in *; do mogrify -verbose -resize x600 “$i” ; done Resize all images (*.jpeg, *.jpg, *.JPG) in current directory and subdirectories to 800px height: find -type f -iregex ‘\(.*\.jpeg\)\|\(.*\.jpg\)\|\(.*\.JPG\)’|xargs mogrify -verbose -resize x800

Also posted in Linux shell | Leave a comment

Moving SVN repos

# move full repo svndump /path/to/old-repository > full.dump svnadmin create /path/to/new-repository svnadmin load /path/to/new-repository < full.dump # move only subproject from repo svndump /path/to/old-repository > full.dump cat full.dump | svndumpfilter –drop-empty-revs include subproject > subproject.dump svnadmin create /path/to/new-repository svnadmin load /path/to/new-repository < subproject.dump Optional to remove ‘subproject’ top-level directory from subproject.dump sed -i ‘s/Node-path: subproject\//Node-path: [...]

Also posted in SVN, Subversion | Leave a comment

ThinkPad: Enable / disable bluetooth

Enable: echo “1″ > /sys/devices/platform/thinkpad_acpi/bluetooth_enable Disable: echo “0″ > /sys/devices/platform/thinkpad_acpi/bluetooth_enable

Posted in Linux | Tagged | Leave a comment

rsync tips

Backup DIR1 -> DIR2 rsync -aHvx –stats –delete DIR1/ DIR2/ Backup DIR1 -> DIR2/DIR1 rsync -aHvx –stats –delete DIR1 DIR2/ Uwaga: istotny jest slash na końcu katalogu źródłowego (DIR1), nieistotny na końcu katalogu docelowego (DIR2) A trailing slash on the source changes this behavior to avoid creating an additional directory level at the destination. You [...]

Posted in Linux | Tagged | Leave a comment

Linux: Jak zmienić rozszerzenie wielu plików ?

Zmiana rozszerzenia w bieżącym katalogu i podkatalogach – przykłady poniżej. # .jpg -> .png find . -name “*.jpg” -exec rename .jpg .png {} \; # .JPG -> .jpg find . -name “*.JPG” -exec rename .JPG .jpg {} \;

Also posted in Linux shell | Tagged , , | Leave a comment

Problem z fontami w JasperReports

Problem z fontami w jasperReports ? net.sf.jasperreports.engine.util.JRFontNotFoundException: Font ‘Arial’ is not available to the JVM. See the Javadoc for more details. Rozwiązaniem jest instalacja brakujących fontów: apt-get install msttcorefonts

Also posted in Java | Tagged | Leave a comment

SSL, keytool – różności

Export certyfikatu z keystora keystore.jks o aliasie ‘mycert’ do pliku cert.crt: keytool -exportcert -alias mycert -keystore keystore.jks -file cert.crt Wyświetlenie certyfikatu w przyswajalnej dla człowieka formie: keytool -printcert -file cert.crt Więcej na ten temat tutaj.

Also posted in Java | Tagged , , | Leave a comment

Linux: Screenshot z pliku video

Wykorzystane narzędzie ffmpeg. Przykład zrobienia screenshota z 10 sekundy pliku wejściowego in.avi. Wyjściowy screenshot znajdzie się w pliku screenshot.png. Argument vframes ustawiony na 1 oznacza zrzut jednego obrazka. ffmpeg -ss 00:00:10 -i in.avi -an -vframes 1 screenshot.png Ogólna składnia dla ffmpeg wygląda tak: ffmpeg [input options] -i [input file] [output options] [output file]

Also posted in Video | Tagged , | Leave a comment