This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env nix-shell | |
#! nix-shell -p clipnotify -p xclip -p mpv -p streamlink -i python3 | |
""" | |
Takes multiple URIs (including URLs, local files should work as well), | |
resolves them through streamlink to get the stream link when applicable, | |
then plays them all in a nicely packed tiled layout. | |
If no URI is provided as argument, starts an interactive selection where | |
Xorg-clipboard copied URLs get accumulated until the program is ^C. | |
Layouts: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const trs = [...document.querySelectorAll('#container>table>tbody>tr')] | |
const beg = trs.splice(0, 2) | |
trs.filter((x,i) => i%2==0).forEach(tr => { | |
tr.querySelectorAll(':scope > td').forEach(td => beg[0].insertAdjacentElement('beforeend', td)) | |
}) | |
document.querySelectorAll('#container>table>tbody>tr>td').forEach(e => e.style.width=100/16) | |
document.querySelector('body').style.fontFamily = 'monospace' | |
document.querySelector('#body').style.maxWidth = null | |
document.querySelector('#body').style.width = '100%' | |
document.querySelector('#game').style.width = '100%' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// https://github.com/sui77/rc-switch | |
#include <RCSwitch.h> | |
#define CONFIG_BUFSIZE ((8 + 16 + 8) / 8) | |
typedef union { | |
struct { | |
uint8_t transmitPin; | |
uint16_t pulseLength; | |
uint8_t repeatTx; | |
} c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
### Keybase proof | |
I hereby claim: | |
* I am zopieux on github. | |
* I am zopieux (https://keybase.io/zopieux) on keybase. | |
* I have a public key ASCq3dB3j_rLJ_JoF2t2F5Km_8nVHoa-v_nNsWh0aDEBUgo | |
To claim this, I am signing this object: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def tree(root): | |
""" | |
Node(label = "string", children = [list of Node]) | |
""" | |
ret = [root.label] | |
ln = len(root.children) | |
for i, child in enumerate(root.children): | |
for j, s in enumerate(tree(child)): | |
char = '│ ' | |
if i == ln - 1: # last child |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
""" | |
Example usage: | |
$ pip install reportlab pillow | |
$ ./overlay.py these-lemaire.tiff 'ocr/{p}.json' these-lemaire.pdf | |
""" | |
import argparse | |
import json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import docutils.nodes | |
import sphinx.roles | |
class CiteRole(sphinx.roles.XRefRole): | |
def result_nodes(self, document, env, node, is_ref): | |
keys = node['reftarget'].split(',') | |
refnodes = [ | |
docutils.nodes.reference(classes=['citation'], refuri=key) | |
for key in keys] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /etc/systemd/system/docker.service.d/override.conf | |
# TODO: use systemd-automount? | |
# defeats the purpose of the /net discovering service, though | |
[Service] | |
# trigger mount (share is /docker) | |
ExecStartPre=/usr/bin/stat /net/SERVER/docker | |
# umount | |
ExecStopPost=/usr/bin/umount /net/SERVER/docker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from curio import run, spawn, open_connection, sleep | |
import argparse | |
import collections | |
import re | |
TOKEN = re.compile(r'([\S]{3,})', re.I) | |
async def client(opts): | |
q = collections.deque(maxlen=opts.window) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def kth_perm(n, k): | |
res = list(range(n)) | |
for i in range(n): | |
f = math.factorial(n - i - 1) | |
s, m = divmod(k, f) | |
if m == 0 and s == 0: | |
break | |
if s > 0: | |
for j in range(i - 1 + s, i - 1, -1): | |
res[j-1], res[j] = res[j], res[j-1] |