Skip to content

Instantly share code, notes, and snippets.

View dotysan's full-sized avatar

Curtis Doty dotysan

View GitHub Profile
@dotysan
dotysan / dedupe.sh
Created February 6, 2022 00:58
Use fdupe to hardlink duplicates
#! /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 November 17, 2021 02:20
my notes on installing personal nodejs
#! /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 June 6, 2021 21:10
the default code when you create a new Cloudflare Worker
addEventListener("fetch", (event) => {
event.respondWith(
handleRequest(event.request).catch(
(err) => new Response(err.stack, { status: 500 })
)
);
});
/**
* Many more examples available at:
#!/usr/bin/perl -pw
use strict;
# Sun 6 Jun 2004 Curtis Doty <[email protected]>
# - 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 10:12 — 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.
/**
* ------------------------------------------
* 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 January 3, 2019 02:03
California roster of handguns
#! /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 September 13, 2018 23:10
erradicate java on a Mac
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 \
@dotysan
dotysan / nsec3prober.py
Last active October 12, 2016 22:27
Probe DNS TLDs for NSEC3 usage.
#!/usr/bin/env python3
# Copyright (C) 2012 Internet Systems Consortium.
#
# 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 INTERNET SYSTEMS CONSORTIUM
# DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL
#! /usr/bin/env bash
#! /bin/bash
set -e
# associative arrays requre bash v4; here's cute way to find it
if [ ${BASH_VERSINFO[0]} -lt 4 ]
# BEWARE! exec in a subshell doesn't. So we must use `for shell in
# $(which -a bash)` instead of `which -a bash |while read shell`.
then for shell in $(which -a bash)
do if [ $("$shell" -c 'echo ${BASH_VERSINFO[0]}') -ge 4 ]
@dotysan
dotysan / mkcrypt.sh
Created June 17, 2016 20:25
Cheap attempt to generate a random password and its crypt-pw using mostly bash.
#! /bin/bash -e
#
# Cheap attempt to generate a random password and its crypt-pw using mostly bash.
#
SALT="./0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
mkapass() {
local len=${1-8}
while [ ${n:=1} -le $len ]