Skip to content

Instantly share code, notes, and snippets.

View piggynl's full-sized avatar
🐱

Piggy piggynl

🐱
View GitHub Profile
@piggynl
piggynl / $imapfilter.lua
Last active June 14, 2024 11:50
Periodically move unseen junk emails to inbox. This is to against Outlook's overly aggressive spam detection.
-- Ignore this file.
-- https://stackoverflow.com/questions/19896900/how-to-change-the-name-of-a-gist-in-github/19904644#19904644
-- https://stackoverflow.com/questions/17665267/how-do-you-control-the-order-in-which-files-appear-in-a-github-gist/17668995#17668995
@piggynl
piggynl / fonts.conf
Created June 8, 2024 14:52
~/.config/fontconfig/fonts.conf
<?xml version='1.0'?>
<!DOCTYPE fontconfig SYSTEM 'fonts.dtd'>
<fontconfig>
<alias binding="strong">
<family>serif</family>
<prefer>
<family>Noto Serif</family>
<family>Noto Serif CJK SC</family>
</prefer>
</alias>
@piggynl
piggynl / config.fish
Last active June 4, 2024 14:01
~/.config/fish/config.fish
function last_history_item
echo $history[1]
end
abbr -a !! --position anywhere --function last_history_item
function ip
command ip --color=auto $argv
end
set -x CC clang
@piggynl
piggynl / tg-json-export-to-text.py
Last active May 30, 2024 23:14
Transform Telegram chat export in JSON to a easy-to-read line-by-line text file.
#!/usr/bin/env python3
import json
import sys
if len(sys.argv) == 1:
print(f'Usage: {sys.argv[0]} result.json > result.txt')
sys.exit(1)
with open(sys.argv[1], 'r') as f:
data = json.load(f)
@piggynl
piggynl / dn42-peer.sh
Created November 22, 2022 13:22
My script to add a peer in DN42.
#!/bin/sh
if [ "$(id -u -n)" != "root" ]; then
echo "You need to run this script as root"
exit 1
fi
WG_PRIVKEY=
WG_PUBKEY=
@piggynl
piggynl / iitc-polygon-to-polyline.js
Last active September 26, 2022 06:20
Convert polygons to polylines in exported drawn Items from Draw Tools in IITC.
var drawnItems = [{"type":"polygon","latLngs":[{"lat":0,"lng":0},{"lat":0,"lng":60},{"lat":30,"lng":30}],"color":"#a24ac3"}];
drawnItems = drawnItems.map(o => o.type !== "polygon" ? o : { ...o, type: "polyline", latLngs: [...o.latLngs, o.latLngs[0]] });
copy(JSON.stringify(drawnItems));