Skip to content

Instantly share code, notes, and snippets.

@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;
@geekman
geekman / uboot-image.bt
Created Dec 8, 2018
010 editor template for U-Boot images that i hacked up
View uboot-image.bt
//
// quick 010 Editor template for u-boot images
// darell tan 2018.12.08
//
enum <uchar> IH_TYPES {
TYPE_INVALID,
TYPE_STANDALONE,
TYPE_KERNEL,
TYPE_RAMDISK,
@geekman
geekman / ren_dated_file.py
Created Sep 16, 2018
renames a dated file into another date format
View ren_dated_file.py
#!/usr/bin/env python
#
# renames files with date JAN_18 to "<prefix> 2018-01"
# darell tan 2018.09.14
#
from __future__ import print_function
import sys
import os
import re
@geekman
geekman / boot.cmd
Created Jul 21, 2018
boot-time device tree overlays with U-Boot
View boot.cmd
part uuid ${devtype} ${devnum}:${bootpart} uuid
setenv bootargs console=${console} root=PARTUUID=${uuid} rw rootwait
if load ${devtype} ${devnum}:${bootpart} ${kernel_addr_r} /boot/zImage; then
if load ${devtype} ${devnum}:${bootpart} ${fdt_addr_r} /boot/dtbs/${fdtfile}; then
fdt addr ${fdt_addr_r}
fdt resize
setexpr fdtovaddr ${fdt_addr_r} + F000
@geekman
geekman / fixer.js
Created May 12, 2018
JS to "fixup" ASCII art on old Apple docs, e.g https://support.apple.com/kb/TA40730
View fixer.js
document.querySelector('.SUMMARY').childNodes.forEach(function(e) {
if (e.nodeType == Node.TEXT_NODE && (e.textContent.match(/[+|-]/g) || []).length > 2) {
var n = document.createElement('code');
n.textContent = e.textContent.replace(/^[\r\n]*(.*)[\r\n]*$/, '$1');
n.style = 'white-space:pre-wrap';
e.parentNode.replaceChild(n, e);
}
});
@geekman
geekman / script.ps1
Created Mar 29, 2018
making sure your USB network adapter doesn't take over your default gateway & Internet connection
View script.ps1
# to verify, use `route print` and check the order in which the interfaces are listed
Get-NetAdapter | Where-Object {$_.InterfaceDescription -like '*USB*'} | Set-NetIPInterface -InterfaceMetric 9999
You can’t perform that action at this time.