Skip to content

Instantly share code, notes, and snippets.

Peter Sanford psanford

Block or report user

Report or block psanford

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
psanford /
Created Sep 20, 2019
bpftrace wrapper to trace reads from stdin and writes to stdout and stderr for a given process name
if [ -z "$COMM"] ; then
echo "usage: $0 <name_of_process>" >&2
exit 1
psanford /
Created Aug 9, 2019
build bpftrace on ubuntu 18.04
set -e
set -x
# from
apt-get install -y clang-7 libclang-7-dev llvm-7 llvm-7-dev
apt-get install -y bison cmake flex g++ git libelf-dev zlib1g-dev libfl-dev
psanford / reformat-directory.el
Last active Aug 2, 2019
emacs batch reformat directory
View reformat-directory.el
(defun reformat-directory (dir)
"Reformat all files of extention in directory"
(interactive "D")
(let* ((ext ".go")
;; disable find-file hooks to speed up processing:
;; don't run git commands on every file
(find-file-hook '())
psanford / gopls-config.el
Last active Sep 26, 2019
gopls (go lsp-mode) config for emacs with useful optional packages.
View gopls-config.el
;;; Pre gopls/lsp-mode/go-mode setup
;;; This section installs use-package from melpa if it isn't
;;; already installed. You can skip this if you already have use-package
;; enable melpa if it isn't enabled
(require 'package)
(when (not (assoc "melpa" package-archives))
(setq package-archives (append '(("melpa" . "")) package-archives)))
psanford / examples.sql
Last active Apr 7, 2019
sqlite3 examples
View examples.sql
.mode csv
-- import column names from first show
.headers on
-- show current settings
.import transactions.csv transactions
select * from transactions;
# Hello world of rootless runc with an overlayfs root file system.
# This will only work as is with kernels that allow overlayfs mounts
# from non-root accounts (such as ubuntu 18.04).
set -e
set -x
mkdir /tmp/runc-rootless
psanford / gist:8ed59ae471b2d9d4524dc5a2cfc03d66
Last active Feb 15, 2018 keyboard shortcuts
View gist:8ed59ae471b2d9d4524dc5a2cfc03d66
["f", "Show next/latest diffs", "setProposedRevRanges()"],
["j", "Next unreviewed file", "nextUnreviewedFile()"],
["k", "Previous unreviewed file", "prevUnreviewedFile()"],
[null, "Next personally unreviewed file", "nextPersonallyUnreviewedFile()"],
[null, "Previous personally unreviewed file", "prevPersonallyUnreviewedFile()"],
["shift+n", "Next changed file", "nextChangedFile()"],
["shift+p", "Previous changed file", "prevChangedFile()"],
["shift+j", "Next visible file", "nextVisibleFile()"],
psanford /
Last active Sep 26, 2019
connect to meraki client vpn from strongswan (ubuntu 16.04 edition)

These are my notes for connecting to a meraki client vpn from ubuntu 16.04. This configuration assumes you are using a psk for the ipsec auth.

Install the following packages:

apt-get install -y strongswan xl2tpd

Configure strong swan

psanford / usdt
Created Jan 30, 2016 — forked from brendangregg/usdt
usdt (ftrace)
View usdt
# usdt - trace user statically defined tracepoints. User-level dynamic tracing.
# Written using Linux ftrace. Experimental.
# WARNING: This is a proof of concept for USDT tracing from Linux ftrace, and
# is not safe to use in production environments. In particular, the -i option
# sets memory semaphores by piping the output of printf through dd and then
# to process memory via /proc/PID/mem. Yes, this program pipes the output of
# the shell directly over top of live process memory. If you don't understand
psanford /
Last active Sep 15, 2015
dvb dtv scanning notes
# speak the signal strength out loud
script -c "azap -c ~/.mplayer/channels.conf -r 'KNTV HD'" /dev/null | perl -nl -e '$|=1; /signal ([a-zA-Z0-9]+).*FE_HAS_LOCK/; `echo $1 | festival --tts`; '
#yes or no
script -c "azap -c ~/.mplayer/channels.conf -r 'KNTV HD'" /dev/null | tee /tmp/azap | perl -nl -e '$|=1; /signal ([a-zA-Z0-9]+).*FE_HAS_LOCK/; $out=$1 eq "541d" ? "no": "yes" ; `echo $out | festival --tts` ; '
# edit /usr/share/festival/voices/english/kal_diphone/festvox/kal_diphone.scm to adjust speech rate
(Parameter.set 'Duration_Stretch 0.5)
You can’t perform that action at this time.