Skip to content

Instantly share code, notes, and snippets.

Avatar

Curtis Doty dotysan

View GitHub Profile
@dotysan
dotysan / hello.sh
Last active Jun 2, 2022
A template for seeding new Bash scripts.
View hello.sh
#! /usr/bin/env bash
#
# A template for seeding new Bash scripts.
#
if [ -z "${BASH_VERSINFO[0]}" ] || [ ${BASH_VERSINFO[0]} -lt 4 ]
then
echo "ERROR: Only tested on Bourne-Again SHell v4/v5."
exit 1
fi >&2
set -e
@dotysan
dotysan / mta-sts.js
Created Apr 29, 2022
CloudFlare Worker for MTA-STS policy
View mta-sts.js
const mode= 'testing';
//const mode= 'enforce';
const max_age= 604800; // 1 week
const mx_list = [
'aspmx.l.google.com'
,'aspmx2.googlemail.com'
,'aspmx3.googlemail.com'
,'aspmx4.googlemail.com'
,'aspmx5.googlemail.com'
,'alt1.aspmx.l.google.com'
@dotysan
dotysan / unbuff.exp
Last active Feb 6, 2022
poor-man's unbuffer
View unbuff.exp
#! /usr/bin/env expect
# tell stty to postprocess output
set stty_init "-opost"
# infinite
set timeout -1
# $argv is the command that we unbuffer
eval [list spawn -noecho] $argv
@dotysan
dotysan / dedupe.sh
Created Feb 6, 2022
Use fdupe to hardlink duplicates
View dedupe.sh
#! /usr/bin/env bash
#
# Use fdupe to hardlink duplicates
#
set -e #x
main() {
echo "BEFORE: $(du -sh .)"
fdupes --recurse --noempty --sameline . |while read -r dupes
do #echo "DUPES: $dupes"
@dotysan
dotysan / node-install.sh
Last active Nov 17, 2021
my notes on installing personal nodejs
View node-install.sh
#! /usr/bin/env bash
#
# my notes on installing personal nodejs
#
set -ex
THIS='src/node'
V='v17.1.0'
SRC="node-$V"
@dotysan
dotysan / Cloudflare-new-worker-default.js
Last active Jun 6, 2021
the default code when you create a new Cloudflare Worker
View Cloudflare-new-worker-default.js
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
/**
* Many more examples available at:
View ios7deobfuscate.pl
#!/usr/bin/perl -pw
use strict;
# Sun 6 Jun 2004 Curtis Doty <Curtis@GreenKey.net>
# - modified Riku Meskanen's ios7decrypt.pl script
# - added WEP key translation and supposed extra keys
my @md5xlat = ( 0x64, 0x73, 0x66, 0x64, 0x3b, 0x6b, 0x66, 0x6f, # dsfd;kfo
0x41, 0x2c, 0x2e, 0x69, 0x79, 0x65, 0x77, 0x72, # A,.iyewr
0x6b, 0x6c, 0x64, 0x4a, 0x4b, 0x44, 0x48, 0x53, # kldJKDHS
@dotysan
dotysan / md5.gs
Last active May 20, 2021 — forked from KEINOS/md5.gs
GAS(Google Apps Script) user function to get MD5 hash or 4digit shortened hash for Multibyte(UTF-8, 2bytes character) environment.
View md5.gs
/**
* ------------------------------------------
* MD5 function for GAS(GoogleAppsScript)
*
* You can get a MD5 hash value and even a 4digit short Hash value of a string.
* ------------------------------------------
* Usage1:
* `=MD5("YourStringToHash")`
* or
* `=MD5( A1 )` with the same string at A1 cell
@dotysan
dotysan / ca-certgun-roster.sh
Last active Jan 3, 2019
California roster of handguns
View ca-certgun-roster.sh
#! /usr/bin/env bash
#
# fetches the California roster of handguns certified for sale
#
set -x
main() {
today=$(date +%F)
curl --verbose --output certguns-$today.html 'https://www.oag.ca.gov/firearms/certguns'
echo '"Manufacturer","Model","Gun Type","Barrel Length","Caliber","Expires"' >certguns-$today.csv
@dotysan
dotysan / java-buh-bye.sh
Created Sep 13, 2018
erradicate java on a Mac
View java-buh-bye.sh
sudo rm -rf \
/Library/Application\ Support/Oracle \
/Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin \
/Library/Java \
/Library/PreferencePanes/JavaControlPanel.prefPane \
/Library/Preferences/com.oracle.java.Helper-Tool.plist
rm -fr \
~/Library/Application\ Support/Java \
~/Library/Application\ Support/Oracle \