Skip to content

Instantly share code, notes, and snippets.

@alexshpilkin
alexshpilkin / objects.tcl
Created Jan 15, 2012
Proposed object system for Jim Tcl
View objects.tcl
# ---------------------------------------------------------------------------
# Models - A flexible object system for Jim
# ---------------------------------------------------------------------------
# XXX Observation after writing all the code below: [ref]erences are _not_
# used to store things. They are only used to invoke finalizers.
# ---------------------------------------------------------------------------
# Stubs
# ---------------------------------------------------------------------------
View download.py
#!/usr/bin/env python3
# ---------------------------------------------------------------------------
# download.py - Download Turkish election data
#
# Written by Alexander Shpilkin <ashpilkin@gmail.com>, Feb 2012
#
# To the extent possible under law, the author has dedicated all copyright
# and related and neighboring rights to this software to the public domain
# worldwide. This software is distributed without any warranty.
#
@alexshpilkin
alexshpilkin / .XCompose
Created Feb 11, 2012 — forked from astanin/.XCompose
My Compose key configuration
View .XCompose
include "/usr/share/X11/locale/en_US.UTF-8/Compose"
# Punctuation
# знаки препинания, необходимые в русском, которых нет в en_US.UTF-8/Compose
<Multi_key> <period> <minus> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <period> <space> : "…" U2026 # HORIZONTAL ELLIPSIS, многоточие
<Multi_key> <?> <!> : "⁈" U2048 # QUESTION EXCLAMATION, ?!
<Multi_key> <period> <colon> : "…" # ELLIPSIS
# №: набирается в русской раскладке без ухищрений,
@alexshpilkin
alexshpilkin / kernel.ld
Created Aug 9, 2013
Linking a higher half kernel
View kernel.ld
ENTRY(start)
OUTPUT_FORMAT(elf64-x86-64)
LD_FEATURE("SANE_EXPR")
SECTIONS
{
. = 0x0100000;
_init = .;
.header : {
@alexshpilkin
alexshpilkin / polymorph.c
Last active Mar 15, 2016
Polymorphism in C++ and plain C
View polymorph.c
#include <stdio.h>
#include <stdlib.h>
struct A {
struct Atable *vptr;
};
struct Atable {
int (*answerp)(struct A *this);
};
View keybase.md

Keybase proof

I hereby claim:

  • I am alex-shpilkin on github.
  • I am alexshpilkin (https://keybase.io/alexshpilkin) on keybase.
  • I have a public key ASAbZo8Qp8U-zCBRPlyofF38flV9f0EAAp_LQXFMwtwrgwo

To claim this, I am signing this object:

@alexshpilkin
alexshpilkin / 8086.fth
Last active Jan 2, 2018
Postfix 8086 assembler in Forth
View 8086.fth
oct
( register / memory )
: reg/mem? ( m -- ? ) 70 and 0 = ;
: ?reg/mem ( m -- m )
dup 70 and 0 <> ?abort" reg/mem? " ;
: ?memory ( m -- m )
dup 70 and 0 <> over 300 and 300 = ?abort" memory? " ;
@alexshpilkin
alexshpilkin / mplalign.py
Last active Mar 21, 2018
Align vertical labels in subplots
View mplalign.py
#!/usr/bin/env python
import matplotlib.pyplot as plt
import random
import matplotlib.gridspec as gridspec
random.seed(20)
data1 = [random.random() for i in range(10)]
data2 = [random.random()*1000 for i in range(10)]
@alexshpilkin
alexshpilkin / cikrf.py
Created Feb 28, 2012
Russian elections
View cikrf.py
#!/usr/bin/env python3
import sys
import time
from bs4 import BeautifulSoup
import urllib3
pool = urllib3.PoolManager(10)
# 2008 ROOT_URL = 'http://www.vybory.izbirkom.ru/region/region/izbirkom?action=show&root=1&tvd=100100022249920&vrn=100100022176412&region=0&global=1&sub_region=0&prver=0&pronetvd=null&vibid=100100022249920&type=227'
@alexshpilkin
alexshpilkin / dns
Last active Apr 29, 2018
HTTP API for local DNS records in unbound(8)
View dns
#!/bin/sh -eu
DOMAIN=lointa.in
JOURNAL=/srv/dns/$DOMAIN
fail() { echo "Status: $1"; echo "Content-Type: text/plain"; echo; echo "$REQUEST_METHOD"; exit; }
if [ -z "$PATH_INFO" ]; then
echo "Status: 308 Permanent Redirect"
echo "Content-Length: 0";