Skip to content

Instantly share code, notes, and snippets.

Avatar

Alexandre Macabies zopieux

View GitHub Profile
@zopieux
zopieux / mpv_streamlink_mosaic.py
Last active May 8, 2022
Xorg clipboard + streamlink + mpv in a mosaic / tile layout
View mpv_streamlink_mosaic.py
View hexadecordle.js
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%'
@zopieux
zopieux / RSL366R.c
Last active Jan 10, 2021
Remote RSL366R (433.95MHz) Arduino program
View RSL366R.c
// 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;
View gist:5c5f1bd5067613f36fa4409a6890b605
### 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:
@zopieux
zopieux / README.md
Last active Aug 6, 2022
QNAP TS-453 Pro: LCD, LEDs, fan & buttons
View README.md

QNAP TS-453 Pro: LCD, LEDs, fan & buttons

QNAP NAS model TS-453 Pro has limited documentation on how to control its various peripherals, namely:

  • the front LCD display, a 2 row, 16 column blue & white LCD display, and its two menu buttons ("ENTER", "SELECT")
  • the front LEDs "STATUS" (red & green) & "USB" (blue)
  • the 4 "disk error" LEDs (red)
  • the front "USB COPY" button
  • the main rear fan
@zopieux
zopieux / ocr-pdf.py
Last active Apr 7, 2018
Google OCR to PDF invisible overlay
View ocr-pdf.py
#!/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
@zopieux
zopieux / citename.py
Created Mar 28, 2018
Sphinx citation title
View citename.py
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]
@zopieux
zopieux / override.conf
Created Feb 26, 2018
Docker on NFS with automount
View override.conf
# /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
@zopieux
zopieux / github-clone-fork
Last active Dec 22, 2017
Clone GitHub forked repo and add upstream remote
View github-clone-fork
#!/bin/bash
set -e
fatal() {
echo $@
exit 1
}
repo=$1
View twitch.py
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)