[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Apache - precompressing static files with gzip

Some time ago I’ve show how to precompress js and css file with gzip to be available for Nginx’s mod_gzip. In default configuration Apache don’t have such module but similar functionality could be achieved with few custom rewirtes. Basically we will start with these rewrites to serve gzipped CSS/JS files if they exist and the client accepts gzip compression: RewriteEngine on RewriteCond %{HTTP:Accept-encoding} gzip RewriteCond %{REQUEST_FILENAME}\.gz -s RewriteRule ^(.*)\.(js|css)$ $1\.$2\.gz [QSA] Then we need to setup proper content types for such compressed files - I know how to do this in two ways: ...

2013-12-27 · 2 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Generate ECDSA key with OpenSSL

After the last NSA scandal I’ve found some time to read some texts about PFS and ECDSA keys lately. I always used RSA keys but wanted to give a try to ECDSA so I wanted to give it a try (test performance, etc). Here is how I’ve done it. Firstly find your favorite curve. A short tip about bit length and complexity could be found here. From it you will now that using 256 bit ECDSA key should be enough for next 10-20 years. ...

2013-12-17 · 5 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Delete audio track from mkv file

Lately I tried to remove some streams from MKV file - I wanted: video, audio in my language and no subtitles. I achieved it with mkvtoolnix utils. Firstly I have to identify streams in file: $ mkvmerge -i input_file.mkv File 'test.mkv': container: Matroska Track ID 0: video (V_MPEG4/ISO/AVC) Track ID 1: audio (A_DTS) Track ID 2: audio (A_AC3) Track ID 3: audio (A_DTS) Track ID 4: audio (A_AC3) Track ID 5: subtitles (S_TEXT/UTF8) Track ID 6: subtitles (S_TEXT/UTF8) Chapters: 16 entries You could use more verbose tool mkvinfo for that purpose too. ...

2013-12-16 · 1 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Preparing video files for streaming on website in MP4 and WEBM format

Some time ago I prepared a PC that was responsible for batch encoding of movies to formats suitable for web players (such as. Video.js  external link , JW Player  external link , Flowplayer  external link , etc.) ...

2013-12-16 · 2 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Re-adding failed drive in mdadm

Yesterday I have problem with fglrx witch cause ugly system reset. After that, one of my drives was marked as failed in RAID5 array. Hotspare was automatically used to rebuild array. But this hotspare is the oldest and slowest drive I’ve got… After rebuild I’ve tested failed drive and it was fine - no bad block, no any other issue - so I wanted it running back in array. What I do: ...

2013-12-12 · 2 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Ansible - Dynamicaly update /etc/hosts files on target servers

I was configuring GlusterFS on few servers using Ansible  external link and have a need to update /etc/hosts with hostnames for easier configuration. I found this one working: - name: Update /etc/hosts lineinfile: dest=/etc/hosts regexp='.*{{item}}$' line='{{hostvars.{{item}}.ansible_default_ipv4.address}} {{item}}' state=present with_items: '{{groups.somegroup}}' Source: http://xmeblog.blogspot.com/2013/06/ansible-dynamicaly-update-etchosts.html  external link

2013-12-11 · 1 min · timor
Disk usage visualisation

Inodes exhaustion on XFS

Learn about inodes exhaustion on XFS, how to check inode limits, and how to adjust the inode percentage to prevent issues on your Linux filesystem.

2013-11-27 · 1 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Kill with SIGSTOP and SIGCONT

I’ve bought a NAS and customized it a little. But there was one thing which make my nights sleepless. NAS was seeking disks every 5~10 seconds - these was really irritating - especially when it was silent in room. I found that part of firmware was indexing or logging something so I wanted it dead! kill -9 was unsuccessful - process restarted after a while…. wrrr… I googled a little and found another signal I could use SIGSTOP, which will freeze process until I send SIGCONT to it - that was exactly what I need (because I normally use NFS/Samba and don’t need nothing more running on this device). ...

2013-11-21 · 1 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

GearmanManager: wygodne zarządzanie workerami

Niedawno zainteresowałem się usługą Gearman i jedynej rzeczy której mi brakowało to jakiegoś łatwego mechanizmu zarządzającego workerami. Ale jak zwykle okazało się że inni mieli już ten problem i odpowiednie narzędzie istnieje - mowa o GearmanManagerze. Instalacja GearmanManagera Aby zainstalować GeramanManagera na serwerze gdzie już mamy Gearmana trzeba wykonać kilka kroków (wcześniej powinniśmy też zainstalować moduł gearmana do php’a): apt-get install git -y git clone https://github.com/brianlmoon/GearmanManager.git cd GearmanManager/install chmod +x install.sh ./install.sh Detecting linux distro as redhat- or debian-compatible Where is your php executable? (usually /usr/bin) /usr/bin Which PHP library to use, pecl/gearman or PEAR::Net_Gearman? 1) pecl 2) pear #? 1 Installing to /usr/local/share/gearman-manager Installing executable to /usr/local/bin/gearman-manager Installing configs to /etc/gearman-manager Installing init script to /etc/init.d/gearman-manager Install ok! Run /etc/init.d/gearman-manager to start and stop Worker scripts can be installed in /etc/gearman-manager/workers, configuration can be edited in /etc/gearman-manager/config.ini Mamy działającego GearmanManagera. Zalecam przyglądnięcie się plikowi config-advanced.ini bo jest tam kilka opcji, które warto dodatkowo ustawić. ...

2013-11-13 · 1 min · timor
[Photo by Tima Miroshnichenko](https://www.pexels.com/photo/close-up-view-of-system-hacking-in-a-monitor-5380664/)

Debian - zablokowanie aktualizacji pakietu

W teorii nie powinno się blokować aktualizacji pakietów bo łatają dziury itd…. Ale! Zdarzyły mi się ostatnio dwie sytuacje, które do tego mnie zmusiły: aktualizacja hudsona kończyła się błędem przy starcie usługi, aktualizacja domU Xen skończyła się problemem z kompatybilnością mechanizmu udev w systemie i jądrze (hypervisor miał starsze jądro niż spodziewało się DomU). W takich sytuacjach bardzo przydaje się możliwość zablokowania aktualizacji jednej “psującej” paczki na pewien okres czasu by nie opóźniać innych aktualizacji a sobie dać czas na rozpracowanie problemu. ...

2013-11-05 · 1 min · timor