Apache - Force caching dynamic PHP content with mod_headers

Normally you want dynamic content to be fresh and not cacheable. But sometimes it may be useful to cache it, like when you have website behind reverse proxy1. To do this try something like this: Add new Apache conf file <filesmatch "\.(php|cgi|pl)$"> Header unset Pragma Header unset Expires Header set Cache-Control "max-age=3600, public" </filesmatch> http://www.askapache.com/htaccess/speed-up-your-site-with-caching-and-cache-control.html  external link  ↩︎ ...

2015-12-29 · 1 min · timor

MySQL - reset root password

It will happen from time to time, that you’re on alien machine and have to brutally update things in db without knowing credentials. Example is for root (quite secure candidate to change because it shouldn’t be used in app 😃 ) but will work for any user. shutdown db service mysql stop create text file with command like this (update user accordingly) ex. in /tmp/pwchange.txt SET PASSWORD FOR "root"@"localhost" = PASSWORD("HereYourNewPassword"); start mysqld with --init-file param mysqld_safe --init-file=/tmp/pwchange.txt sometimes you may require to point configuration file ex. --defaults-file=/etc/mysql/my.cnf ...

2015-12-28 · 1 min · timor

Rotate movies

I hate movies recorded on phone in vertical position. This just short tip how I dealt with with it last time: for m in *.mp4 do avconv -i $m -vf "transpose=1" -codec:a copy -codec:v libx264 -preset slow -crf 23 rotated-$m done Other examples: http://stackoverflow.com/questions/3937387/rotating-videos-with-ffmpeg  external link http://superuser.com/questions/578321/how-to-flip-a-video-180  external link °-vertical-upside-down-with-ffmpeg

2015-12-28 · 1 min · timor

Extract password saved in Remmina

I had some passwords saved in remmina but like it always happen, I wasn’t been able to remember them when needed. Trying to restore them I found that they’re encrypted in .remmina directory. Then I used this script to decrypt them 1: Extract script import base64 from Crypto.Cipher import DES3 secret = base64.decodestring("<STRING FROM remmina.prefs>") password = base64.decodestring("<STRING FROM XXXXXXX.remmina>") print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password) http://askubuntu.com/questions/290824/how-to-extract-saved-password-from-remmina  external link  ↩︎ ...

2015-12-25 · 1 min · timor

I’m back

After long break I’m thinking about writing more on my blog. I was reviewing my favorites/bookmarks and half of them was broken, so I can’t rely on them in case of knowledge management. I think I will write shorter, less descriptive articles just to be pointers to useful solutions from past.

2015-12-25 · 1 min · timor

Apache AuthBasic but excluding IP

Allow from IP without password prompt, and also allow from any address with password prompt Order deny,allow Deny from all AuthName "htaccess password prompt" AuthUserFile /web/askapache.com/.htpasswd AuthType Basic Require valid-user Allow from 172.17.10.1 Satisfy Any Sources http://www.askapache.com/htaccess/apache-authentication-in-htaccess.html  external link

2015-12-23 · 1 min · timor
Cover of The Girl Who Kicked the Hornets' Nest book

The Girl Who Kicked the Hornets' Nest

The Girl Who Kicked the Hornets' NestMillenium Author: Stieg Larsson By the time I got to The Girl Who Kicked the Hornet’s Nest, I remember feeling like I’d been through a full storm of conspiracies and violence. It’s more political and slower in pace — less crime thriller, more about consequences and justice. I remember the satisfaction of closure, even if the story got a bit dense toward the end. Not an easy read, but it tied things together nicely.

2015-12-12 · 1 min · timor
Cover of Splątana sieć book

Splątana sieć

Splątana siećPrzewodnik po bezpieczeństwie nowoczesnych aplikacji WWW Author: Michał Zalewski

2015-12-10 · 1 min · timor
Cover of The Girl Who Played With Fire book

The Girl Who Played with Fire

The Girl Who Played with FireMillenium Author: Stieg Larsson I remember The Girl Who Played with Fire as the most “thriller-like” of the trilogy. It dives deep into Lisbeth’s past and gives her even more of the spotlight, which I liked. The plot moved quickly - maybe even too quickly at times - and the whole hacking/outcast vibe was still strong. I can’t say I remember every detail, but I remember enjoying the momentum. It felt more cinematic than the first one.

2015-11-12 · 1 min · timor
Cover of The Girl with the Dragon Tattoo book

The Girl with the Dragon Tattoo

The Girl with the Dragon TattooMillennium Author: Stieg Larsson I read The Girl with the Dragon Tattoo quite a while ago, back when everyone seemed to be talking about it. The hype was real - and I could see why. It’s a solid crime story with a dark edge, and I especially enjoyed the touches of hacking and cyber intrigue. Sure, the tech parts weren’t always realistic, but they still hit a certain vibe that I appreciated. ...

2015-10-12 · 1 min · timor