Skip to content

Instantly share code, notes, and snippets.

View jamiew's full-sized avatar

Jamie Dubs jamiew

View GitHub Profile
@jamiew
jamiew / .gitconfig
Last active June 15, 2020 20:03
public pieces of my .gitconfig
[user]
name = Jamie Dubs
email = noreply@example.com
[apply]
whitespace = fix
[branch]
autosetuprebase = always
autosetupmerge = always
[color]
branch = auto
@jamiew
jamiew / mac_installation.sh
Created January 29, 2020 22:47 — forked from nickccm1122/mac_installation.sh
Mac installation
#!/bin/bash
# set firmware password
# sudo firmwarepasswd -setpasswd -setmode command
# Disable the Character Accent Menu and Enable Key Repeat
defaults write -g ApplePressAndHoldEnabled -bool false
# Prevent generate .DS_Store
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
@jamiew
jamiew / helium-score.sh
Last active January 29, 2020 19:27
Fetch node score from Helium API
#!/bin/sh
# requires jq, for manipulating JSON:
# brew install jq
#
# find your hotspot's address here:
# https://explorer.helium.foundation/api/hotspots/
address="xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
curl -s "https://explorer.helium.foundation/api/hotspots/$address" | jq '.data .score'
@jamiew
jamiew / git-friendly.rb
Created December 28, 2019 06:16
WIP git-friendly homebrew install
# /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/git-friendly.rb
# ```
# brew install --verbose --debug git-friendly
# brew audit --new-formula git-friendly
# brew test --verbose --debug git-friendly
# ```
class GitFriendly < Formula
desc "Streamline your git workflow: `pull`, `branch`, `merge`, `push`"
homepage "https://github.com/jamiew/git-friendly"
url "https://github.com/jamiew/git-friendly/archive/1.0.tar.gz"
@jamiew
jamiew / ._example output
Last active December 19, 2019 16:52
How I debugged my slow bash startup
# Start a new shell
... startup: 31
... git-completion: 113
... git-prompt: 41
... exports: 47
... rbenv: 216
... other scripts: 41
~$
@jamiew
jamiew / plex-scan.sh
Created December 7, 2019 16:01
WIP script to intelligently upate my Plex library after sabnzbd downloads are done
#!/bin/bash
# sabnzbd post-download notification script for Plex
# Define $PLEX_TOKEN in your environment
# Debug arguments to sab
echo "Args:"
for word in "$@"; do
echo "$word"
done
# on debian-based linux
# run as root so drop_caches works
for i in /home/jamie /mnt/duo /mnt/data3; do
echo $i
echo "writes: "
dd if=/dev/zero of=$i/tempfile bs=1M count=1024 conv=fdatasync,notrunc status=progress 2>&1 | grep copied
echo "dropping caches..."
echo 3 > /proc/sys/vm/drop_caches
echo "reads: "
dd if=$i/tempfile of=/dev/null bs=1M count=1024 status=progress 2>&1 | grep copied;
@jamiew
jamiew / cloudflare-callback-example.html
Created October 16, 2019 14:41
Need javascript callbacks from Cloudflare in order to intelligently autoplay-mute
<html>
<head>
<meta charset="UTF-8">
<title>Cloudflare player javascript test</title>
<script type="text/javascript">
function loadVideo(){
const videoId = "5d5bc37ffcf54c9b82e996823bffbb81";
let player = document.getElementById('video-player');
player.innerHTML = `<stream src="${videoId}" controls="" preload=""></stream>`;
@jamiew
jamiew / balsn-warmup.php
Created October 8, 2019 13:48
basln-ctf warmup.php
<?php
$secret=bASe64_deCODe(str_ROt13("CTygMlOmpz"."Z9VaSkYzcjMJpvCt==")))
highLIGHT_file(__FILE__)
inCLUDE("config.php"))
($op=@$_GET['op'])
&&(@strlen($op)<3
&&@($op+8)<'A_A')
?
( ($_=@$_GET['Σ>―(#°ω°#)♡→'])
&&(preg_match('/[\x00-!\'0-9"`&$.,|^[{_zdxfegavpos\x7F]+/i',$_)
@jamiew
jamiew / uploading GML with uniqueKey.sh
Created February 19, 2019 22:01
you can't specify uniqueKey as a URL parameter, it has to be inside the actual GML data
gml="<gml><tag><header><client><uniqueKey>jamiew007</uniqueKey></client></header><drawing><stroke><pt><x>1</x><y>1</y><t>1</t></pt></stroke></drawing></tag></gml>"
id=$(curl -s -A curlwriter -d "application=curlwriter&gml=$gml" "https://000000book.com/data")
open "https://000book.com/data/$id"