This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: port-diff [portname] | |
{ | |
port -q deps --no-build "$1" | awk -F': ' '/Lib/{gsub(/, /,"\n");print $NF}' | |
echo | |
port -q contents "$1" | xargs otool -L 2>/dev/null | | |
grep -E '\.(dylib|framework)' | xargs port -q provides | | |
awk -v name="$1" '$1!=name{print $1}' | sort | uniq | |
} | awk ' | |
/^$/{ c = 1; next } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Extract a JSON value in an object: | |
# | |
# items = get_json_value(json, "payload.tree.items") | |
# | |
# Or in an array: | |
# | |
# while ((item = get_json_value(items, i++))) | |
# name = decode_json_string(get_json_value(item, "name")) | |
# |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -euo pipefail | |
printf 'checking %s ... ' "$1" | |
name=$1 | |
lib=$2 | |
base=https://packages.macports.org |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const inspector = require("inspector"); | |
// See: | |
// https://github.com/nodejs/node/blob/v22.2.0/lib/internal/util/inspector.js#L83 | |
// Wrap a console implemented by Node.js with features from the VM inspector | |
function wrapConsole(console) { | |
const inspectorConsole = inspector.console; | |
for (const key of Object.keys(inspectorConsole)) { | |
// If the console has the same method as the inspector console, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//usr/bin/cc -o ${o=`mktemp`} "$0" && exec -a "$0" "$o" "$@" | |
#include <stdio.h> | |
int main(int argc, char *argv[]) | |
{ | |
printf("%s", argv[0]); | |
for (int i = 1; i < argc; i++) | |
printf(" %s", argv[i]); | |
printf("\n"); | |
return 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -eux | |
# Enable multi-instance operation | |
sudo postmulti -e init | |
mkdir -p ~/.config ~/.local/state/spool | |
# Create a new local instance |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: forward host port [localport] | |
forward() { | |
ssh -NL ${3-$2}:localhost:$2 $1 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# usage: lstcp [options] [port] | |
lstcp() ( | |
while getopts : o; do opts="$opts -$OPTARG"; done; shift $((OPTIND-1)) | |
lsof -i tcp"${1+:}$1" -s tcp:listen $opts | |
) | |
# usage: lsudp [options] [port] | |
lsudp() ( |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -euo pipefail | |
dir=~/.ssh/github.com | |
name=$(basename "$0") | |
help=$(printf "\ | |
usage: %s [-d] [repo] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -euo pipefail | |
root= | |
while getopts D: opt; do | |
case $opt in | |
D) root=$OPTARG ;; | |
?) exit 2 | |
esac | |
done |
NewerOlder