Skip to content

Instantly share code, notes, and snippets.

@richkuz
richkuz / github-projectv2-projectnext-notes.md
Created August 7, 2022 13:56
Notes about using the new GitHub ProjectV2 API

Notes on GitHub ProjectV2 API

GitHub Projects Beta aka GitHub Projects Next aka GitHub ProjectNext is now known as GitHub ProjectV2 in the API.

It's not immediately obvious how to use the new API, especially if you're coming from the old beta API.

You no longer need to set the HTTP header: GraphQL-Features: projects_next_graphql.

You still need to add your GitHub personal access token to the Authorization header, e.g. Authorization: Basic ghp_...

@plembo
plembo / pandocdocx2md.md
Last active September 13, 2025 17:10
Convert docx to markdown with pandoc

Convert Word documents to markdown with pandoc

I use pandoc to convert masses of Word documents to markdown. Still working on a generic script, but for now here's the "gist" of what I type into the terminal:

$ myfilename="example"
$ pandoc \
-t markdown_strict \
--extract-media='./attachments/$myfilename' \
$myfilename.docx \
@liquidev
liquidev / class.md
Last active February 8, 2025 21:44
My attempt at explaining how to implement classes in Lua

NOTE (2025-02-08)

I've since moved the tutorial over to my website. Clarified some of the wording, added exercises at the end, added links to useful resources.

For historical reasons, I'm keeping the original text here. But if you've just stumbled upon this tutorial for the first time, you may want to check out the revised version!

https://riki.house/programming/lua/classes


@sangelone
sangelone / cleanup.sql
Last active November 2, 2022 04:42
Cleaning a Synapse Server's Postgres DB
DROP FUNCTION IF EXISTS synapse_clean_redacted_messages();
CREATE FUNCTION synapse_clean_redacted_messages()
RETURNS void AS $$
DECLARE
BEGIN
UPDATE events SET content = '{}' FROM redactions AS rdc
WHERE events.event_id = rdc.redacts
AND (events.type = 'm.room.encrypted' OR events.type = 'm.room.message');
END;
$$ LANGUAGE 'plpgsql';
@pgaskin
pgaskin / restic-systemd.md
Last active March 4, 2025 19:14
Secure restic backups with systemd.

restic systemd configuration

  1. sudo install -Dm644 restic@.service /etc/systemd/system/.
  2. For each target:
    • Place the options (exclude, etc) and paths in the variable BACKUP_OPTIONS="..." in /etc/restic/TARGET/config. Newlines can be escaped with backslashes.
    • Place the repository path in /etc/restic/TARGET/repository.
    • Place the repository password in /etc/restic/TARGET/password.
  3. To run the backups on a schedule, create a .timer file in /etc/systemd/system/ based on restic.timer.example, set the schedule and target unit, then systemctl enable --now whatever.timer.
  4. To run the backups manually, just systemctl start it.
@willwm
willwm / flash_all.sh
Created March 29, 2021 00:35
fastboot: Flash All Partitions (OnePlus 8T)
fastboot flash product product.img
fastboot flash abl abl.img
fastboot flash aop aop.img
fastboot flash bluetooth bluetooth.img
fastboot flash boot boot.img
fastboot flash cmnlib cmnlib.img
fastboot flash cmnlib64 cmnlib64.img
fastboot flash devcfg devcfg.img
fastboot flash dsp dsp.img
fastboot flash dtbo dtbo.img
@cetinajero
cetinajero / ddrescue.md
Last active September 23, 2025 21:32
Guide for using Ddrescue to recover data

Guide for using Ddrescue to recover data

Start command:

ddrescue -d /dev/sda output.img output.mapfile

NOTE: If direct disc access is not available in your system, try raw devices.

@jackkinsella
jackkinsella / .vimrc
Created February 5, 2020 11:17
.vimrc
" Location for installing plugins
call plug#begin('~/.vim/plugged')
" Other plugins are specified with user/repo on Github or x.vim on vimscripts
" Git integration (status bar and commands like Gblame)
Plug 'tpope/vim-fugitive'
" Add info to sidebar about git
Plug 'airblade/vim-gitgutter'
" Add file-management commands like :Delete, :Move, and :Rename
Plug 'tpope/vim-eunuch'
@pabloab
pabloab / pomodoro
Last active August 5, 2025 07:08
Simple pomodoro bash script that switch between sound outputs
#!/usr/bin/env bash
# Little script to play a music/sound on pomodoros through headphones and call to come back to work through HDMI speakers.
# set -euo pipefail # Unofficial bash strict mode
# Prerequsitres: gtts (`pip install --user --upgrade gtts`, mpv (`flatpak install io.mpv.Mpv`), vlc, libsox-fmt-mp3 and retry.
# Also use yt-dlp instead of yt-dl https://hund.tty1.se/2021/10/12/how-to-use-yt-dlp-instead-of-yt-dl-with-mpv.html
# TODO/Known bugs:
# - Fix issue with PipeWire: pacmd stat No PulseAudio daemon running, or not running as session daemon. https://gitlab.freedesktop.org/pipewire/pipewire/-/issues/357
@PofMagicfingers
PofMagicfingers / 00-usb-keyboard.rules
Last active May 26, 2024 03:59
Keyboard layout auto change with udev
ATTRS{idVendor}=="060b", ATTRS{idProduct}=="5252", OWNER="pof"
ACTION=="add", RUN+="/usr/local/bin/usb-keyboard-udev in"
ACTION=="remove", RUN+="/usr/local/bin/usb-keyboard-udev out"