Skip to content

Instantly share code, notes, and snippets.

polonskiy / transmission-remote-magnet.bash
Created Mar 24, 2018 — forked from sbisbee/transmission-remote-magnet.bash
Quick and easy way of making Chrome send bittorrent magnet links to a remote Transmission instance using its API on Ubuntu with xdg.
View transmission-remote-magnet.bash

Quick and easy way of making Chrome send bittorrent magnet links to a remote Transmission instance using its API on Ubuntu with xdg. This method does not require modifying any system files or xdg's scripts, whereas most of the examples I found on the Internet did require such hacks.

Chrome does not handle default applications, instead relying on the OS to manage that. The default handler in Ubuntu is xdg, which maps the MIME type to the default application. Extra tooling is required because xdg requires a registered desktop file, so you can't simply give it a command to run.


  1. Install the shell script transmission-remote-magnet ideally in /usr/local/bin: ln -s ~/src/transmission-remote-magnet.bash transmission-remote-magnet

  2. Install the desktop file, which is required for xdg to work and will likely require sudo: desktop-file-install ./transmission-remote-magnet.desktop

polonskiy /
Created Feb 7, 2018
Transparent Git Encryption

Transparent Git Encryption

This document has been modified from its [original format][m1], which was written by Ning Shang ( It has been updated and reformatted into a [Markdown][m2] document by [Woody Gilk][m3] and [republished][m4].


When working with a remote git repository which is hosted on a third-party storage server, data confidentiality sometimes becomes

polonskiy / segfault-finder.php
Created Aug 23, 2016 — forked from lyrixx/segfault-finder.php
How to find a segfault in PHP
View segfault-finder.php
register_tick_function(function() {
$bt = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 1);
$last = reset($bt);
echo sprintf("%s +%d\n", $last['file'], $last['line']);
polonskiy / array_of_example.php
Last active Jan 21, 2016 — forked from bernik/array_of_example.php
array_of realization in php
View array_of_example.php
class User {
public function __construct($name, $lastName) {
$this->name = $name;
$this->lastName = $lastName;
polonskiy /
Created Sep 22, 2015
remove file from git
git filter-branch --prune-empty --index-filter "git rm --cached -f --ignore-unmatch $1" --tag-name-filter cat -- --all
polonskiy /
Last active Feb 24, 2016
remove old kernels
dpkg -l | awk '/linux-image-[0-9]/ {print $2}' | grep -vF "$(uname -r)" | xargs -r apt-get -y purge
polonskiy /
Last active Jul 28, 2017
xkcd password generator
LC_ALL=C grep '^[a-z]\+$' /usr/share/dict/words | shuf --random-source=/dev/urandom -n 4 | paste -s -d-
grep '^[abcdefghijklmnopqrstuvwxyz]\{3,7\}$' /usr/share/dict/words | shuf -n 6 | xargs | sed 's/ /-/g'
View csv-decode.php
function csv_decode($csv, $columns = [], $delimiter = ',', $enclosure = '"', $escape = '\\') {
$tmp = fopen('php://temp', 'rb+');
fwrite($tmp, $csv);
$result = [];
$assoc = (bool) $columns;
polonskiy / float-comma.php
Last active Aug 29, 2015
comma deciaml separator
View float-comma.php
setlocale(LC_ALL, 'uk_UA.UTF-8');
$float = 1.2345;
echo "$float\n";
polonskiy /
Created Feb 12, 2015
forward signals
#enable job control
set -m
#propagate INT/TERM signals
trap 'kill -TERM $(jobs -p); wait' TERM
trap 'kill -INT $(jobs -p); wait' INT