Skip to content

Instantly share code, notes, and snippets.


S. Zeid scottywz

View GitHub Profile
scottywz / selfoss.user.css
Last active Oct 9, 2020
Custom CSS for Selfoss
View selfoss.user.css
@variables {
--main-background: #ffffff;
--nav-background: #f6f6f6;
--nav-background-active: #64279219;
--nav-color: #222222;
--nav-faint: #6a6a6a;
--nav-hr: #aaaaaa;
--accent-background: #64279219;
--accent-normal: #642792;
--accent-light: #642792;
scottywz /
Last active Aug 16, 2020
Rust macros for reading types from binary streams
// Imports {{{1
use std::io;
extern crate byteorder; // 1
use byteorder::{/*ReadBytesExt,*/ LittleEndian};
extern crate num_traits; // 0.2
use num_traits::ToPrimitive;
View toggle-xterm
uid=$(id -u)
if pgrep -u $uid -x 'xterm' >/dev/null 2>&1; then
pkill -u $uid -x 'xterm'
xrandr_size=$(xrandr --current --prop | head -n 1 \
| grep -o 'current [0-9]\+ x [0-9]\+' \
| sed -e 's/current //g; s/ x /\n/g')
scottywz / show-script-opt.lua
Last active Jul 30, 2020
custom command (script message) for mpv to show a script option on the OSD
View show-script-opt.lua
-- input.conf usage: <key> script-message show-script-opt <opt-name> <default>
-- Example: t script-message show-script-opt osc-title "${media-title}"
mp.register_script_message("show-script-opt", function(name, default)
local value = mp.get_opt(name)
if not (value == nil or value == "") then
value = mp.command_native({"expand-text", value})
value = default or "(unavailable)"
View cros83-procfs-workaround
# Workaround for <>
# Adapted from /u/ken_duda's comment:
# * <>
# * <>
for name in cpuinfo diskstats meminfo stat uptime; do
sudo umount "/proc/$name"
scottywz / opkg-pkgs-from-image
Created Jul 16, 2020
Get installed packages from an OpenWrt image (requires p7zip-full)
View opkg-pkgs-from-image
if [ $# -ne 1 ]; then
echo "Usage: $(basename -- "$0") <image-file>" >&2
exit 2
7z -so e "$1" usr/lib/opkg/status \
| grep '^Package:' | cut -d' ' -f 2 | sort
scottywz / LICENSE.txt
Last active Jul 16, 2020
License for my Gists (unless otherwise specified or not eligible for copyright)
View LICENSE.txt
Copyright (c) S. Zeid. <>
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
scottywz / ec2
Created Jun 9, 2020
Convenience script for EC2 instances
View ec2
# Requires AWS CLI version 1 (`pip3 install awscli`)
if ! [ -f "$1" ]; then
printf %s "
This script should be used as the shebang line in another script that looks like
the following (assuming this script is on \$PATH):
scottywz / media
Last active Jun 5, 2020
raspberry pi media tmux window
View media
pane_cmd() { echo "echo '\$' $@; $@; PS1='\$ ' exec bash --posix"; }
setup_tmux() {
You can’t perform that action at this time.