Skip to content

Instantly share code, notes, and snippets.

View vodik's full-sized avatar

Simon Gomizelj vodik

  • Movable Ink
  • Toronto, Ontario
View GitHub Profile
@vodik
vodik / observable.py
Last active July 30, 2018 18:48
New observable
import asyncio
import collections
from collections.abc import AsyncGenerator
class Subject(AsyncGenerator):
def __init__(self, *, loop=None):
if loop is None:
self._loop = asyncio.get_event_loop()
else:
@vodik
vodik / importer.org
Last active June 2, 2018 18:42
Hy Importer

Hy Loader

This is incomplete; please consider contributing to the documentation effort.

@vodik
vodik / init.el
Last active June 14, 2018 00:30
Emacs config (WIP backup before I move it to a repo)
;; -*- lexical-binding:t -*-
(setq gc-cons-threshold 64000000
gc-cons-percentage 0.6)
(add-hook 'after-init-hook
'(lambda () (setq gc-cons-threshold 800000
gc-cons-percentage 0.1)))
(defalias 'yes-or-no-p 'y-or-n-p)
(add-to-list 'default-frame-alist '(font . "Fira Code 10"))
def wrapper(iterable):
print("start")
results = yield from iterable
print("stop")
results[:] = [1, 1, 1]
return results
def multicall(*callables):
all_results = []
@vodik
vodik / chain.py
Last active October 11, 2017 18:31
chaining asyncio
import asyncio
async def poopyface(value):
if value == 3:
raise RuntimeError('Bail')
print(value)
def runall(*awaitables, loop=None):

Keybase proof

I hereby claim:

  • I am vodik on github.
  • I am vodik (https://keybase.io/vodik) on keybase.
  • I have a public key ASBBbGRp-Z_d3DVdU6SbSMX0oY0CYCKD7i_zdKlJpGGz9go

To claim this, I am signing this object:

@vodik
vodik / stuff.md
Last active August 29, 2015 14:20
opinionated repo [draft]

Opinionated approach to managing foreign packages

This is my opinionated approach to managing foreign packages in Arch Linux. In my humble opinion,

  1. Manually review PKGBUILDs from the internet to vet for correctness.
  2. Build in a clean chroot to ensure dependancies are correct.
  3. Make it easy to build stuff when dependancies are also foriegn.
  4. Easily share packages across multiple machines
  5. Cross compile to support i686 as well.
@vodik
vodik / process.bash
Last active August 29, 2015 14:04
radiosoulwax->m4a
#!/bin/bash
videos=(http://vimeo.com/93039571
http://vimeo.com/26149143
http://vimeo.com/26149014
http://vimeo.com/25861552
http://vimeo.com/26148917
http://vimeo.com/26113014
http://vimeo.com/26048972
http://vimeo.com/26112742)
@vodik
vodik / Makefile
Last active August 29, 2015 14:02
pcap data dump
CFLAGS := -std=c11 \
-Wall -Wextra -pedantic \
-Wshadow -Wpointer-arith -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes \
-D_GNU_SOURCE \
$(CFLAGS)
LDLIBS = -lpcap -ljansson
all: esl_pcap_trace
@vodik
vodik / next_free_port.py
Created May 30, 2014 17:56
next_free_port
def next_free_port(host, family, proto):
for res in socket.getaddrinfo(host, '0', family, proto):
(family, socktype, proto, _, sockaddr) = res
with socket.socket(family, socktype) as sock:
sock.bind((sockaddr[0], 0))
return sock.getsockname()[:2]
print(next_free_port('vodik', socket.AF_INET, socket.SOCK_STREAM))
print(next_free_port('vodik', socket.AF_INET, socket.SOCK_DGRAM))