Skip to content

Instantly share code, notes, and snippets.

a-rodin /
Created June 23, 2015 20:21
Historical currency conversion rates for Python using Yahoo Converter API
from urllib2 import urlopen
import json
import datetime
# Returns price of specified currency at specified date in USD
def get_rate(symbol, date = None):
if symbol == 'USD': return 1.0
if not date:
a-rodin /
Last active November 9, 2015 09:10
Unsharp mask params relations in pupular softare

Unsharp mask params relations in pupular softare

There is correspondence between Unsharp Mask parameters names and scales in widely used graphics software.

Parameter Adobe Photoshop ImageMagick GIMP
Radius 1x 1x 2.5x
Amount 100x 1x 1x
Threshold 1x 1x 1x
# Author: Alexander Rodin <>
# License: MIT
while getopts "hp:s:r:b:o:c:n" opt; do
case $opt in
echo "Usage: $0 [options]"
a-rodin /
Last active March 21, 2016 07:32
TensorFlow Deep Regressor with sklearn-complatible interface
import numpy as np
import tensorflow as tf
class DeepRegressor:
def __init__(self, batch_size = None, max_iter = 2001, random_state=0, verbose=False, opt_step = 0.05, C = 0.0):
batch_size = batch_size,
max_iter = max_iter,
random_state = random_state,
verbose = verbose,
View ubuntu-mbp-hardware.yml
# Ansible role for setting up hardware drivers for Macbook Pro 13" (Early 2015) in Ubuntu 16.04 LTS
# License: GPLv3
# Usage:
# - clone this gist with git
# - go to the gist directory
# - run command `sudo apt-get install ansible && ansible-playbook ubuntu-mbp-hardware.yml`
- name: Setup Macbook hardware
hosts: localhost
become_user: root
# Colorize and format curl output using pygments and json
# The idea is taken from
# Dependencies: `npm i -g json && pip install pygments` and w3m text browser from your dist repository.
# Usage: run `source`, then use `curly` as plain curl
# It is even possible to even do `alias curl=curly` and use it as a replacement to plain curl.
function curly {
$(which curl) --silent --show-error -i "$@" | (
View notebook-progress-pytorch.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
a-rodin / robinson.ipynb
Last active July 6, 2020 13:39
Example of Recurrent Highway Networks ( with PyTorch
View robinson.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
View A better (she|hash)bang for your shell

A shebang/hashbang is the first line of an executable script that starts with #!.

Example for an executable shell script:


And here is what I propose to use instead:

View A hack for showing LaTeX formulas in GitHub


A lot of GitHub projects need to have pretty math formulas in READMEs, wikis or other markdown pages. The desired approach would be to just write inline LaTeX-style formulas like this:

$e^{i \pi} = -1$

Unfortunately, GitHub does not support inline formulas. The issue is tracked here.