Skip to content

Instantly share code, notes, and snippets.

View andrewp-as-is's full-sized avatar
🔍

Andrew P andrewp-as-is

🔍
View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>URL</key>
<string>https://discordapp.com/developers/docs/resources/webhook#execute-webhook</string>
</dict>
</plist>
@andrewp-as-is
andrewp-as-is / Makefile
Last active July 20, 2019 15:08
node-sass
NODE_PATH:=~/node_modules
sass:
node-sass --include-path $(NODE_PATH) ./static/src/index.scss ./static/src/index.css
@andrewp-as-is
andrewp-as-is / perl.sh
Created May 10, 2019 11:47
pid elapsed time
#!/usr/bin/env bash
ps -eo pid,comm,etime | perl -ane '@t=reverse split(/[:-]/,$F[2]); $s=$t[0]+$t[1]*60+$t[2]*3600+$t[3]*86400; print "$F[0]\t$F[1]\t$F[2]\t$s\n"'
@andrewp-as-is
andrewp-as-is / sqlite3.sh
Created May 4, 2019 09:36
sqlite database locked
#!/usr/bin/env bash
# https://stackoverflow.com/questions/2740806/python-sqlite-database-is-locked
function sqlite3() {
executable="$(which sqlite3)" || exit
out="$("$executable" "$@" 2>&1)" && echo "$out" && return || {
[[ "$out" == *"locked"* ]] && exit; echo "$out" 1>&2 && exit 1
}
}
@andrewp-as-is
andrewp-as-is / awk.sh
Last active July 20, 2019 15:08
substract lines
#!/usr/bin/env bash
f1="file1.txt"
f2="file2.txt"
echo "f2 only:"
awk 'FNR==NR{array[$0];next}{if ($0 in array) next;print $0}' "$f1" "$f2"
#!/usr/bin/env bash
path=~/Desktop
tar -czf name.tar.gz -C "$path" .
# find . -type f ! -name $'Icon\r' > "$FILES_FROM" || exit;
# set -- tar -czf "$LocalPath" -T "$FILES_FROM"
# [ -s "$EXCLUDE_FROM" ] && set -- "$@" -X "$EXCLUDE_FROM"
@andrewp-as-is
andrewp-as-is / headerless top.sh
Last active August 14, 2019 08:08
unix top examples
#!/usr/bin/env bash
top -l 1 -n 5 | awk '!$0{i++;next;}i==1'
# top -l 1 -n 5 | awk '/^PID/{if (p) next; p=1} p && NF>30 {printf("%-8s %-12s %-6s %-6s\n", $1, $2, $3, $8)}'
@andrewp-as-is
andrewp-as-is / UNLICENSE
Last active September 25, 2019 08:05
UNLICENSE
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or
distribute this software, either in source code form or as a compiled
binary, for any purpose, commercial or non-commercial, and by any
means.
In jurisdictions that recognize copyright laws, the author or authors
of this software dedicate any and all copyright interest in the
software to the public domain. We make this dedication for the benefit
@andrewp-as-is
andrewp-as-is / docker-cleanup.sh
Last active May 23, 2020 10:22
Docker cleanup
sudo docker system prune -f
sudo docker volume rm $(sudo docker volume ls -qf dangling=true)
df -h --total
#!/usr/bin/env bash
curl -s https://bootstrap.pypa.io/get-pip.py -o /tmp/get-pip.py
python /tmp/get-pip.py