Skip to content

Instantly share code, notes, and snippets.

Working from home

Hampton hamptonmoore

Working from home
Block or report user

Report or block hamptonmoore

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

Keybase proof

I hereby claim:

  • I am hamptonmoore on github.
  • I am herohamp ( on keybase.
  • I have a public key whose fingerprint is D234 1B58 4752 4E03 03B1 EDC1 BF8B 5E53 E143 7F71

To claim this, I am signing this object:

View brightness
#!/usr/bin/env sh
expr $(cat /sys/class/backlight/intel_backlight/brightness) + "$1" > /sys/class/backlight/intel_backlight/brightness
hamptonmoore / maimpick
Created Feb 16, 2020
LARBS maimpick but with imgur as an destination
View maimpick
#!/usr/bin/env sh
# This is bound to Shift+PrintScreen by default, requires maim. It lets you
# choose the kind of screenshot to take, including copying the image or even
# highlighting an area to copy. scrotcucks on suicidewatch right now.
PHOTOPATH=~/Pictures/$(date '+%y%m%d-%H%M-%S').png
curl -s -H "Authorization: Client-ID c9a6efb3d7932fd" -H "Expect: " -F "image=$1" | sed -n 's:.*<link>\(.*\)</link>.*:\1:p' | xclip -selection clipboard
View battery
#!/usr/bin/env sh
AVERAGE=$(ls /sys/class/power_supply | grep "BAT" | xargs -I % cat /sys/class/power_supply/%/capacity | awk '{ total += $1; count++ } END { printf "%.0f", total/count }')
STATUSES=$(ls /sys/class/power_supply | grep "BAT" | xargs -I % cat /sys/class/power_supply/%/status | sed -e "s/,//;s/Discharging/🔋/;s/Not charging//;s/Charging/🔌/;s/Unknown//;s/Full//;s/ 0*/ /g;s/ :/ /g" | tr -d '\n')
hamptonmoore / smloadrM3U8ToMPDM3U
Created Feb 7, 2020
A simple utility to convert the m3u8 file generated by smloadr to an m3u file for MPD
View smloadrM3U8ToMPDM3U
awk '/^#/ {sub(/#.*/,"");getline;}1' "$1" > tmpfile
sed -i 's/..\///' tmpfile
mv tmpfile ~/.config/mpd/playlists/$(echo "$1" | sed 's/ //g' | sed 's/m3u8/m3u/')
rm "$1"
View Multiply any two numbers up to 50
function mult(a, b){
if (a == 0 && b == 0){
return 0
if (a == 0 && b == 1){
return 0
hamptonmoore / oAuthGoogle.js
Last active May 18, 2019
Simple NodeJS Module to get the email of oAuth
View oAuthGoogle.js
var { google } = require("googleapis");
var googleConfig = {
clientId: "clientId", // e.g.
clientSecret: "clientSecret", // e.g. _ASDFA%DFASDFASDFASD#FAD-
redirect: "redirectURL" // this must match your google api settings
var scopes = ["", ""];
var oauth2Client = new google.auth.OAuth2(googleConfig.clientId, googleConfig.clientSecret, googleConfig.redirect);
View Full Page iFrame Bookmarklet
javascript:document.body.innerHTML = `<style>* { margin: 0; padding: 0; }body, html { width:100% ;height:100% ;overflow:hidden ;margin:none;}iframe { width:100% ; height:100% ;border:none ;magrin:none;}</style><iframe src="${prompt("name")}" height="100%"></iframe>`;
View Inject jQuery into any webpage
javascript:(function(){function l(u,i){ var d=document;if(!d.getElementById(i)){var s=d.createElement('script');s.src=u;;d.body.appendChild(s);}}l('','jquery')})();
You can’t perform that action at this time.