Skip to content

Instantly share code, notes, and snippets.


Vladimir Parfinenko cypok

View GitHub Profile
cypok /
Created Apr 21, 2018
Am I too old for all these dynamic stuff?..s
import gettext
lang = gettext.translation("wtf")
_ = lang.gettext
print(_("Program started")) # prints translated message
def work_hard():
print(_("Working hard")) # raises UnboundLocalError: local variable '_' referenced before assignment
cypok /
Created Nov 10, 2016
IDEA inspection is not correct
import java.util.Iterator;
import java.util.NoSuchElementException;
final class Tree<T> {
private final T elem;
private final Tree<T> parent;
private Tree(T elem, Tree<T> parent) {
this.elem = elem;
cypok / bst.c
Created Oct 31, 2016
Simple BST with no copy & paste
View bst.c
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <stdbool.h>
typedef enum eChildKind {
} ChildKind;
cypok /
Created Dec 9, 2015
Simple script to place two PDF pages on single page with separator
if [[ -z "$1" ]]; then
echo No input file
middle=`mktemp -t pdf_2on1`.pdf
if [[ -z "$2" ]]; then
cypok / watch.bat
Last active Aug 29, 2015
Analog of watch (GNU command-line tool) for Windows
View watch.bat
@echo OFF
REM watch is a GNU command-line tool that runs the specified command repeatedly
REM and displays the output on stdout so you can watch it change over time.
REM By default, the command is run every two seconds, although this is adjustable with the -n secs argument.
if x%1==x (call :usage %0 %* && exit /b 1)
if x%1==x-n (
if x%2==x (call :usage %0 %* && exit /b 1)
cypok /
Last active Nov 14, 2016
OS X Automator service that toggles extension showing
for f in "$@"
if [ "`GetFileInfo -ae "$f"`" == "0" ]
SetFile -a E "$f"
SetFile -a e "$f"
cypok / gist:bb6979fa535f3ab10874
Last active Aug 29, 2015 Calc macro ConcatenateIf: mix of CountIf and Concatenate
View gist:bb6979fa535f3ab10874
REM Usage example:
REM | A | B |
REM --+-----+-----+
REM 1 | 111 | aaa |
REM 2 | 222 | bbb |
REM 3 | 222 | ccc |
REM 4 | 333 | ddd |
REM 5 | 333 | eee |
View rotating_squares.c
// Solution for
// Results at
#include <stdlib.h>
#include <stdio.h>
#include <stdbool.h>
typedef unsigned long long int bigint;
cypok /
Last active Jan 3, 2016
Speaker Deck: lack of support for cyrillic fonts

The problem was fixed in less than a day after publication of this page.

The problem

Speaker Deck uses nice OpenSans font. However some characters are rendered using other fonts, e.g. cyrillic characters.

So if you mix in description both latin and cyrillic characters it looks bad. Latin characters are rendered using [lite 300 OpenSans