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

Android: Xposed + AppOps - reclaim control over installed applications permissions

I’m happy owner of Galaxy Nexus 7 and lately I updated my tablet to Android 4.4 Kitkat. One of features I most expected was ability to block some permissions of some applications. Such setting was available in 4.4 version but was removed in latest 4.4.2 - Google didn’t explain it exactly why. I don’t like when for ex. game need: camera or GPS access - for what I asked? But there is new app so called App Ops that unhides build-in interface allowing edit of application permissions. I strongly suggest to install it. ...

2013-12-17 · 1 min · timor

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

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

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
[Ghost.org](https://ghost.org/docs/logos/)

Reset user password in your own Ghost Blog

I’ve started testing new Ghost blogging platform for a while on a virtual machine before I take decision about switching to it (or maybe won’t)… After few days, I wanted to go forward with more testing and stuck on “e-mail and password” login prompt 😃 I’ve started looking into files and found ghost_dir/content/data/ghost-dev.db SQLite database. It can be opened like that: sqlite3 content/data/ghost-dev.db Then you could see whats your mail (and other info): ...

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

Inodes exhaustion on XFS

It’s quite rare to have problems with XFS and inodes exhaustion. Mostly because XFS doesn’t have inode limit in a manner known from other filesystems - it’s using some percentage of whole filesystem as a limit and in most distributions it’s 25%. So it’s really huge amount of inodes. But some tools and distributions lowered limit ex. 5% or 10% and there you could have problems more often. You could check what is you limit by issuing xfs_info with drive and searching for imaxpct value: ...

2013-11-27 · 1 min · timor

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

My new toy - Iomega StorCenter ix2-200 Cloud Edition

I’ve just bought new toy - Iomega StorCenter ix2-200 Cloud Edition. I have to play with few options before I could start using it. First thing - Firmware upgrade. Firmware upgrade I’ve started searching for latest firmware for ix2-200 Cloud and found that I have to register on Lenovo site to get firmware… I don’t like such sites where they force me to give all private data, but after few clicks on “Recommended articles” on that site I landed here: https://lenovo-eu-en.custhelp.com/app/answers/detail/a_id/26790  external link So it looks that I don’t need to register - point for me. ...

2013-11-19 · 1 min · timor

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