Skip to content

Instantly share code, notes, and snippets.

geekman

Block or report user

Report or block geekman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@geekman
geekman / fix-single-dialog.lua
Created Jun 13, 2019
Aegisub plugin to remove lone dash from single dialog
View fix-single-dialog.lua
--
-- usually a dash is used to indicate multiple parties talking in one sub
-- but oddly, sometimes a single dash is present, even if only a single person
-- is talking. this script fixes that.
--
script_name = "Fix single dialog"
script_description = "Remove dash for single party dialog"
script_author = "darell tan"
script_version = "1"
@geekman
geekman / subst-exec.sh
Created May 30, 2019
replaces patterns like "<? cmd ?>" by executing cmd
View subst-exec.sh
#
# awk one-liner to replace patterns like "<? cmd ?>" by executing cmd
# handy for use in config files "templates"
#
cat <<EOF | awk '{ if (match($0, /<\?(.*)?>/)) { cmd = substr($0, RSTART+2, RLENGTH-2-2); system(cmd) } else print }'
my directory has these files:
<? ls / ?>
EOF
@geekman
geekman / ffmpeg-snippets.md
Created May 22, 2019
some ffmpeg commands
View ffmpeg-snippets.md

create a list of filename,title list

for %f in (*.mp4) do @ffprobe -v error -of csv -show_entries format=filename:format_tags=title %f >> list.txt
@geekman
geekman / strip-query-snippet.js
Created May 22, 2019
strips query string from selected URLs on page
View strip-query-snippet.js
// strip query string (or search params) from "/xyz/..". URLs
for (let a of document.querySelectorAll('a[href^="/xyz/"]')) {
let u = new URL(a.href.toString());
u.search = '';
a.href = u;
}
@geekman
geekman / faststart
Created Apr 26, 2019
make MP4 files stream better by moving their "moov" atom to the front
View faststart
#!/bin/sh
# script to make mp4 videos start fast
# (i.e. shifting their moov atoms to the front)
FNAME=$1
[ -f "$FNAME" ] || exit 1
TMPFNAME=`mktemp -u ${FNAME}.XXXXXX`
head -c128 "$FNAME" | grep -F moov -q
@geekman
geekman / webcrypto-hdkf.html
Last active Apr 11, 2019
Web Crypto using HKDF
View webcrypto-hdkf.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<style>
* { font-family: sans-serif; font-size: 16px; }
input { font-family: monospace; }
input[readonly] { border: 1px solid #eee; }
div.row { padding: .8em 0; }
@geekman
geekman / remove-cruft.sh
Last active Apr 9, 2019
script to remove cruft from Ubuntu post-install
View remove-cruft.sh
#!/bin/sh
# run as root
apt remove cloud-init unattended-upgrades popularity-contest landscape-common update-manager-core
apt autoremove
# disable upgrade units & timers
systemctl disable --now apt-daily{,-upgrade}.{timer,service}
@geekman
geekman / clock.html
Created Apr 2, 2019
clock display HTML snippet. encode onto a QR for quick & dirty time display
View clock.html
data:text/html,<script>setInterval("d = new Date(); document.body.innerHTML = `<h1>${d.getHours()}:${d.getMinutes()}:${d.getSeconds()}`", 500);</script><body>
@geekman
geekman / strip-style-tags.lua
Created Mar 2, 2019
Aegisub plugin to remove font, size & color styling
View strip-style-tags.lua
-- modified from strip-tags.lua by Thomas Goyne <plorkyeran@aegisub.org>
--
-- Permission to use, copy, modify, and distribute this software for any
-- purpose with or without fee is hereby granted, provided that the above
-- copyright notice and this permission notice appear in all copies.
--
-- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
-- WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
-- MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
-- ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
@geekman
geekman / pin-entry-anim.html
Last active Mar 13, 2019
PIN entry animation
View pin-entry-anim.html
<!-- PIN entry animation -->
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1">
</head>
<body>
<style>
.h {
position: relative;
You can’t perform that action at this time.