-rw-r--r-- 667B Jan 28, 2015 · CE984C3 · ~1 min

Select like a Boss for Safari

safari javascript расширения select like a boss

Select like a Boss for Safari

The problem of selecting text inside a link in Webkit/Blink engines has existed for a long time. At least for me. Somehow I missed that it could be solved with a browser extension. I found such an extension, called Select like a Boss. But it was only for Firefox, Opera (Blink), and Chrome. Since the source code for the Chrome extension was available on GitHub, I simply took the js code and packaged it as a Safari extension. Now I'm happy and can properly select text inside links :)

Source code + download link: GitHub.

[↵] open page select-like-a-boss-dlya-safari.md
-rw-r--r-- 3.3K Jan 27, 2015 · 08FCA4E · ~3 min

Geohash - What It Is and Where It Can Be Useful

geohash

Geohash

I had wanted to write a post about Geohash for a long time. I've had screenshots for it lying around for several years, but never got around to it.

I'm not going to go into too much detail here; this will be more of a note-style post.

[↵] open page geohash-chto-eto-i-gde-on-mozhet-prigodit-sya-.md
-rw-r--r-- 608B Jan 27, 2015 · 7E85F32 · ~1 min

Vivaldi - a New Browser Inspired by Opera

vivaldi opera браузеры

Vivaldi Browser

I'll just leave a joyful post here. Hooray, the prayers/requests/cries of those who love the old Opera browser have finally been heard. One of the creators of the old Opera built a new browser. It is modern, based on Chromium, but a lot of what the old Opera had in terms of interface and usability has already been done. I went over it in more detail here on Habr. It is still rough in places, but even now joy and happiness have filled the world :) I'll be following it and using it. Hooray!

[↵] open page vivaldi-novyj-brauzer-po-motivam-opera.md
-rw-r--r-- 2.2K Jan 27, 2015 · 52445E8 · ~2 min

A Note on PHP Sessions and the Garbage Collector

php debian администрирование

I ran into an unpleasant issue on one of the work servers here.

Historically, when the site's PHP engine starts up, this value gets set:

session_save_path( PATH_TMP );
ini_set( 'session.gc_maxlifetime', 1800 );

In other words, we have a custom directory for storing sessions, and its lifetime is set to half an hour for the garbage collector.

The server uses php-fpm. I noticed problems in the logs - as if the disk had run out of space. Even though there was still plenty of it. My first thought was that somewhere a huge number of tiny files had been created. As it turned out, session files in our custom directory were not being deleted. I started digging and found the session.gc_probability parameter on php.net, which in php.ini is supposed to be set to 1 - this is the probability that the garbage collector will also run when a script executes.

In the user notes there is a note that Debian sets this parameter to 0. Googling says this is related to the permissions on the default folder /var/lib/php5, which do not allow PHP's garbage collection to clean up old files there. So Debian disables PHP's garbage collector and apparently runs some cron job of its own as root for cleanup. It seems to look for files in the standard directory, and since that does not match our PATH_TMP directory, the sessions were not being removed.

That's how it goes. The options are either to set up your own cron job for cleanup, for example:

0,30 * * * * find /path/to/tmp -mmin +30 -exec rm {} \;

Or specify the default folder in php.ini. But, for example, if a site has 2 projects that use different temporary folders for storing sessions, then you will have to configure something for both of them.

Or add this line when the script starts: ini_set('session.gc_probability', 1);

Personally, I like having my own cron job more. Although maybe adding one more line to the script is better, since it could save you from this problem in the future. Still, cron somehow feels more reliable. Now I just have to figure out how to delete the files that have piled up over 6 months. Midnight Commander spent about 2 hours scanning the folder. When the counter went past 49 million, I gave up on the scan, started deletion, and went to sleep.

That's that.

[↵] open page zametka-pro-sessii-v-php-i-garbage-collector.md
-rw-r--r-- 5.1K Dec 31, 2014 · B43E3AF · ~5 min

2014 recap

новый год итоги жизнь концерты итоги года

The recap will be brief.

[↵] open page itogi-2014.md
-rw-r--r-- 528B Nov 14, 2014 · FF393D0 · ~1 min

TELE2 launched 3G in Saint Petersburg

tele2 3g

TELE2 launched 3G in Saint Petersburg

Hooray, it finally happened. TELE2 launched 3G in Saint Petersburg today. They will enable it for everyone gradually over 3 weeks, but if you can’t wait, you can call 611 and ask the operator to turn it on right now. I’ll leave this screenshot here so that in a couple of months I can measure the speed again and compare whether it got better or worse :) They say they want to launch LTE in summer 2015. Progress finally reached TELE2.

[↵] open page tele2-zapustil-3g-v-pitere.md
makoni@arm1:~/blog$ cd ../page-17/ // ← previous cd ./page-19/ // more posts →