Skip to content

Instantly share code, notes, and snippets.

View s-zeid's full-sized avatar

S. Zeid s-zeid

View GitHub Profile
@s-zeid
s-zeid / reset_tty.py
Last active October 7, 2024 00:29
Reset the terminal without clearing it.
#!/usr/bin/env python3
# vim: set fdm=marker:
# Copyright (c) 2024 S. Zeid.
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- input.conf usage: <key> show-text "${user-data/bitrates}"
-- <key> show-text "${user-data/bitrate/<subkey>}"
-- <key> script-message bitrate-osd-toggle [subkey (default: all)]
-- subkeys: all, va, v, a, s
-- example: k show-text "${user-data/bitrates}"
-- K script-message bitrate-osd-toggle va
local function update()
local function reformat_size(s)
return s:gsub(" (.)bps$", "%1") .. ""
@s-zeid
s-zeid / frk-status
Last active August 15, 2024 01:57
Gets information from Franklin Wireless cellular hotspots. Also allows rebooting the hotspot.
#!/usr/bin/env python3
r"""Gets information from Franklin Wireless cellular hotspots.
Also allows rebooting the hotspot (`-r`/`--reboot`).
Example script to store login information (`frk-status.local.py` in the same
directory as this script; `.py` may be omitted):
```python
@s-zeid
s-zeid / firewall.nat6
Last active April 12, 2022 10:35
OpenWRT NAT6 firewall script, patched to restart the IPv6 WAN interface(s) on first run after boot. (See <https://openwrt.org/docs/guide-user/network/ipv6/ipv6.nat6>.) GPLv3 per the GitHub repo in the original script.
#!/bin/sh
# NAT6 + masquerading firewall script
# https://github.com/akatrevorjay/openwrt-masq6
# trevorj <github@trevor.joynson.io>
#
# You can configure in /etc/config/firewall per zone:
# * IPv4 masquerading
# option masq 1
# * IPv6 masquerading
#!/usr/bin/env python3
# vim: set fdm=marker:
import atexit
import os
import sys
from typing import *
@s-zeid
s-zeid / facebook-messnger.make-stickers-larger.user.css
Created August 17, 2021 22:09
Facebook Messenger - Make stickers larger
/* ==UserStyle==
@name Facebook Messenger - Make stickers larger
@namespace github.com/openstyles/stylus
@version 1.0.0
@license 0BSD
@var text u-size "Size" 160px
==/UserStyle== */
@-moz-document domain("www.messenger.com") {
@s-zeid
s-zeid / if-up.d_addresses
Last active May 24, 2021 11:17
/etc/network/if-up.d/ script to set extra IP addresses
#!/bin/sh
ADDRESSES='
eth0=2001:db8::2 eth0=2001:db8:2::1
eth0=192.0.2.2 eth0=198.51.100.2 eth0=203.0.113.2 eth0=233.252.0.2
'
################################################################################
set -e
@s-zeid
s-zeid / emoji-favicon.js
Last active February 22, 2021 12:26
Set a favicon from an emoji defined in an HTML attribute. Uses the Canvas API. — https://on.bnay.me/emoji-favicon/
"use strict";
//export default
class EmojiFavicon {
static DEFAULT_ATTRIBUTE_NAME() { return "data-emoji-favicon"; }
static set(emoji, shadowColor, size) {
shadowColor = (typeof shadowColor === "string") ? shadowColor : null;
# <https://gist.github.com/b6f7106e553b8c31723dc50c5aa1f1c2>
include "%L"
# Uncategorized {{{1
<Multi_key> <equal> <equal> <equal> : "≡" U2261 # IDENTICAL TO
<Multi_key> <asterisk> <asterisk> : "∗" U2217 # ASTERISK OPERATOR
<Multi_key> <bracketleft> <o> <bar> : "⎄" U2384 # COMPOSITION SYMBOL
<Multi_key> <bracketleft> <O> <bar> : "⎄" U2384 # COMPOSITION SYMBOL
<Multi_key> <c> <m> <p> : "⎄" U2384 # COMPOSITION SYMBOL