Skip to content

Instantly share code, notes, and snippets.

View sm-Fifteen's full-sized avatar

sm-Fifteen

  • Montréal, Canada
  • 10:18 (UTC -04:00)
View GitHub Profile
@sm-Fifteen
sm-Fifteen / cec-configure-autostart.rules
Last active April 30, 2023 20:37
Pulse Eight CEC adapter auto-configure inputattach and cec-ctl
# The CEC adapter only monitors pin 13, and physical address allocation occurs over DDC/EDID (pin 16)
# Besides, the CEC adapter can't tell if its HDMI source even is the same device as its USB host.
# So physical address needs to be decoded from the EDID, and which output that corresponds to has to be specificed manually.
SUBSYSTEM=="cec" ACTION=="add" ENV{__DEFAULT_CEC_OUTPUT}!="" TAG+="systemd" ENV{SYSTEMD_WANTS}="cec-configure@%E{__DEFAULT_CEC_OUTPUT}.service"
@sm-Fifteen
sm-Fifteen / whats_a_yubikey.md
Last active April 16, 2024 21:31
"What the heck is a Yubikey and why did I buy one?": A user guide

"What the heck is a Yubikey and why did I buy one?": A user guide

(EDIT: Besides Reddit, I've also put this up on Github Gist)

So while looking for information on security keys before getting one myself, I got very confused reading about all the different modes and advertised features of Yubikeys and other similar dongles. The official documentation tends to be surprisingly convoluted at times, weirdly organized and oddly shy about a few of the limitations of these keys (which I'm making a point of putting front and center). Now that I have one, I decided to write down everything I figured out in order to help myself (and hopefully some other people reading this) make sense of all this.

Since I'm partly writing these notes for myself, there might be some back and forth between "exp

@sm-Fifteen
sm-Fifteen / app.py
Created October 13, 2019 00:05
FastAPI lifetime tests
from fastapi import FastAPI
from lock import FileLock
app = FastAPI()
lock = FileLock("fastapi")
@app.get("/")
async def root():
return {"message": "Hello World"}
@sm-Fifteen
sm-Fifteen / herod.xsd
Created November 8, 2018 01:24
Test XML schema
<?xml version = "1.0"?>
<xs:schema xmlns:xs = "http://www.w3.org/2001/XMLSchema">
<xs:element name = 'blazon'>
<xs:complexType>
<xs:sequence>
<xs:element name = 'ecu' type = 'EcuType' minOccurs = '0' maxOccurs = '1' />
</xs:sequence>
</xs:complexType>
</xs:element>
@sm-Fifteen
sm-Fifteen / maro-kun.sql
Last active September 1, 2018 19:47
Attempt at turning Maro-Kun into a single SQL query
/*
-- As DB superuser
DROP TABLE IF EXISTS chain CASCADE;
CREATE TABLE chain (
link1 text NOT NULL,
link2 text NOT NULL, -- Space is used as an end-of-sentence sentinel
n integer NOT NULL,
PRIMARY KEY (link1, link2), -- Primary Key requires not null anyway
@sm-Fifteen
sm-Fifteen / snippets.sh
Last active January 13, 2020 00:54
Bash snippets
# Encode all FLAC files in a directory in Opus
# Picked 128 kbps because of this :
# https://wiki.xiph.org/Opus_Recommended_Settings#Recommended_Bitrates
for file in *.flac; do opusenc --bitrate 128 "${file}" "${file%%.flac}.opus"; done
# Alternatively
parallel opusenc --bitrate 128 {} "{.}.opus" ::: ./*.flac
[Unit]
Description=Factorio Server (using save %i.zip)
ConditionFileNotEmpty=/home/factorio/factorio-15-33/saves/%i.zip
[Service]
User=factorio
Group=factorio
WorkingDirectory=/home/factorio/factorio-15-33
Restart=on-abnormal
ExecStart=/home/factorio/factorio-15-33/bin/x64/factorio --start-server ./saves/%i.zip --server-settings ./data/server-settings.json
@sm-Fifteen
sm-Fifteen / ess_ets_decrappify.js
Last active October 2, 2017 02:10
A bunch of JS functions to get something useful out of ÉTS' internship browser
var records = $("#grid1").data('igGrid').dataSource.settings.dataSource.Records;
records = records.slice(0,4);
extendAllRecords(records).then(console.log);
function extendAllRecords(recordList) {
// Caution : Might make the servers catch fire if run
var fakeDoc = initShadowDOM();