Skip to content

Instantly share code, notes, and snippets.

View banister's full-sized avatar
🇳🇱

John Mair banister

🇳🇱
View GitHub Profile
@banister
banister / cool-buttons.markdown
Created December 29, 2021 06:05
Cool Buttons
/* Copied, Pasted and summarized from ps' source code.
You can use sysctl to get other process' argv.
*/
#include <sys/sysctl.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define pid_of(pproc) pproc->kp_proc.p_pid
@banister
banister / bpf.c
Created April 2, 2021 03:58 — forked from c-bata/bpf.c
Capture packets from bpf devices on macOS.
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/uio.h>
#include <unistd.h>
#include <string.h>
#include <sys/errno.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <net/bpf.h>

file

#!/usr/bin/env bash
CLIENT_ID=<REDACTED>
LOG_FILE=~/.image_uploader.log
touch $LOG_FILE
exec 1>>$LOG_FILE # redirect stdout to the log file
exec 2>&1 # ditto for stderr
#!/usr/bin/env bash
set -x
CLIENT_ID=<REDACTED>
LOG_FILE=~/.image_uploader.log
touch $LOG_FILE
# folder to watch
SCREENSHOT_FOLDER=/home/user/Pictures/screenshots
gitwalk() {
git log ${1}..HEAD --oneline | awk '{print $1}' | tac | xargs -I{} -n1 sh -c 'git log -p {}'
}
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
@banister
banister / oh-my-zsh installer
Created January 13, 2018 18:53
omz-installer.sh
main() {
# Use colors, but only if connected to a terminal, and that terminal
# supports them.
if which tput >/dev/null 2>&1; then
ncolors=$(tput colors)
fi
if [ -t 1 ] && [ -n "$ncolors" ] && [ "$ncolors" -ge 8 ]; then
RED="$(tput setaf 1)"
GREEN="$(tput setaf 2)"
YELLOW="$(tput setaf 3)"
jViTBizGANaGywdZaYavwXUBWBuf5qQJVFVBQP6iaURq9veP87jsEBxCwX2ouY10
cWFL2RxOhWhKIkAj6aS8ZTVwliKBeTA2Mwb51mCfsXbUoupWGkmdtTyyVN0i
GQz2naCg+OGmAo8gysw1bIXKvqdTkIqrM1/ybBAKhD1EMFJhalChIYCv8PpD
uS8EFby+z5bTKJ6v/JXmORIylGZeAWLdF1LXGePx8xQCQA8/PlC8qAQJxf0vs0
iK2y2JAtSvcBwB9KGuNjOJ/IFsCSvnpQ92tM/t2vMnTQ9EUyGbse5Dhj7dgL
SCIK2E4RbSa5KFgIGyxBxQV4Y91/gmAE6Cf9WQ4Zo35E6oFQSIH73Xt5TxDouY
1n4yZGbf0Uu5/q5zkkcIV3Hb5UNs8or6iGylnRDiY3PBGSCPnP85roGD7DNp
ssrRXVq0+hgCdxSwN7j3zyTm9vAQ3A9xI0Re7PBXZ8ecXfWqXB1ph9b8oCKS6
tBlyTdFDGlbKcP/6yStHr/zWWDM1pgVr9uEPFBIVz/d+7KCe0oifb6B+8jGd
CTW5VzbtMyw6hImkDROwJ9BmVAjboUutMG0koI_31HKBRaaaaaaaaCmDwSGrQLRw