Hi there, 👋!

Welcome to my personal space in Internet!

I occasionally post my thoughts and how-to’s here and on Medium.

Among the fresh materials (which will be coming hopefully more often), you can also find my superold and by now mostly irrelevant posts from the past - those are fun to read 😂, I seem to have had a personal style back then!

Git push to remote without creating local branch

Little extremely handy trick for Git. If you need to modify something quickly in some(-body’s) branch, e.g. in in open PR on GitHub, you don’t need to usually create your local branch mirroring the remote one, right? Instead, you just checkout into remote branch: git checkout origin/branch-name , do you fixes/changes, commit them and now, the tricky thing, how do you push? As simple as: git push origin HEAD:refs/heads/branch-name You don’t have traces in your local branches, and you pushed your modifications. ...

April 5, 2017 · 1 min · rodush

How to specify custom ssh key while git clone from github

If you need to provide some custom ssh key while cloning your repository from github (or pulling, whatsoever), run this command: ssh-agent $(eval `ssh-agent -s`; ssh-add ~/.ssh/{your-custom-keyfile}; git clone git@github.com:{username}/{repo-name}.git .) Please note, you should replace {strings} with plain string values!

February 8, 2017 · 1 min · rodush

Functional approach in PHP

The code snippet below will only work in PHP-5.3+!. Isn’t it the famous functional programming with functions as first class citizens, closures and other functional bla-bla? <?php> function one($a = 0) { return function(callable $b) use ($a) { return call_user_func($b, $a); }; } print_r(call_user_func(one(1), function ($x) { return $x + 4; } )); This was created just for fun. As you may see, in place of callable you can put any valid PHP callable, e.g.in a form ['Class', 'method'] ...

October 19, 2016 · 1 min · rodush

Install proprietary Oracle JDK in Debian 7.0 Wheezy

This is a YAP (yet another post) about how one can manually install Oracle’s proprietary JDK/JRE version (in Debian 7.0 Wheezy as an example). First of all, download fresh version of JDK/JRE from the Oracle website. Copy archive to desired location, in the following example we will use /usr/lib/jvm as an installation source directory. Unpack the archive and run next commands: sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk/bin/java 1071 sudo update-alternatives --install /usr/bin/javac javac /media/mydisk/jdk/javac 1071 sudo update-alternatives --install /usr/bin/jcontrol jcontrol /media/mydisk/jdk/bin/jcontrol 1071 You may need read man pages for update-alternatives to check out the parameters and what they mean. ...

August 27, 2014 · 1 min · rodush

How to add role to the PostgreSQL

If you need have superuser access to PostgreSQL via command line psql utility, create needed username first: sudo -u postgres createuser NEEDED_USERNAME You will be asked whether role should be a superuser: Shall the new role be a superuser? (y/n) answer “Y” (yes) if so and hit Enter. Now you allowed the NEEDED_USERNAME to access databases as a superuser via psql.

May 16, 2014 · 1 min · rodush

Postgres and earthdistance extension

First of all, let me describe how one can install extensions for your Postgresql. It depends whether you have version 8.4+ or 9.1+ installed. In following sections I will describe procedure related to Debian based OSes. First of all, you have to install contrib packages for corresponding version: root@debian:/home/web# apt-cache search postgres | grep contrib postgresql-contrib - additional facilities for PostgreSQL (supported version) postgresql-contrib-8.4 - additional facilities for PostgreSQL postgresql-contrib-9.1 - additional facilities for PostgreSQL with command: ...

September 24, 2013 · 2 min · rodush

Fn клавиши перестали работать на Lenovo Thinkpad Edge с Debian

Однажды на моем рабочем ноуте Lenovo Thinkpad Edge 15 внезапно 🙂 перестали работать ВСЕ функциональные клавиши (регулировка яркости, громкости, управление камерой и микрофоном, wi-fi). Я не гуру в низкоуровневом Linux и всяких там acpi events… Периодически и долго пытался найти решение проблемы в интернете, но особо не зная куда копать, искал по acpi, fakekeys, Debian (установленная ОСь на ноуте)… К сожаление, не нарыл ничего. Пока однажды волей случая не набрел на замечательный форум, где было предложено неожиданное решение проблемы… ...

August 11, 2012 · 1 min · rodush

Как марсоход приземляется на поверхности планеты

Очень интересная страничка на сайте NASA со схематическим пояснением того, как марсоход приземляется на поверхность планеты —

August 8, 2012 · 1 min · rodush

Как скачать аудио из ВКонтакте

Небольшой скриптец, который поможет вам создать список URL адресов mp3 файлов, который можно затем «скормить» какому-нибудь Download Master. Сей скриптец нужно запускать в консоли FireBug (расширение к броузеру FireFox, ориентированное на программистов), находясь при этом на странице «Мои аудиозаписи». В результате выполнения в консоль будет выведен список адресов аудифайлов вашего плейлиста. Копируете список в текстовый файл, который потом импортируете в Download Master через пункт меню File -> Import. Вуаля! Файлы качаются! Единственная проблемка — названия. Это уникальные идентификаторы файлов, а не понятные человеку слова. Хотите — переименуйте вручную, а хотите — потом можно написать скриптец, скажем на PHP, который прочитает ID3-тэги файлов и переименует файлы с использованием нормальных названий. ...

August 6, 2012 · 1 min · rodush

Form builder — entity field: «Class BundleAliasName:EntityClassName does not exist «

После обновления symfony-2.1 до версии из транка (symfony-2.1.0-beta4) отвалилась форма, в которой я использовал поле типа entity, где в качестве класса сущности указал не полный путь к классу, а через bundle alias: $builder->add('field_name, 'entity', array( 'class' => 'BundleAliasName:EntityClassName', 'multiple' => true ) ) // ..... Код выбрасывал исключение с сообщением «Class BundleAliasName:EntityClassName does not exist» Если прописать полный путь через пространство имен: array( 'class' => 'Full\Bundle\Path\Entity\EntityClassName', ) то все работало хорошо. ...

July 26, 2012 · 1 min · rodush