Skip to content

Instantly share code, notes, and snippets.

View gotbadger's full-sized avatar
🦡
Set your status

Philip Hayton gotbadger

🦡
Set your status
View GitHub Profile
@gotbadger
gotbadger / keybase.md
Created September 19, 2018 10:39
Keybase

Keybase proof

I hereby claim:

  • I am gotbadger on github.
  • I am gotbadger (https://keybase.io/gotbadger) on keybase.
  • I have a public key ASDdgTBj8wXVSDYQHl3FTjZi7HSsXd1U2uJ9okUMy-dHQAo

To claim this, I am signing this object:

@gotbadger
gotbadger / main.py
Last active May 25, 2018 09:37
Open Graph Receipt Printer
import sys
import os
import time
from ftfy import fix_text
from opengraph import OpenGraph
import urllib.request
from escpos import printer
if len(sys.argv) != 2:
sys.exit('Usage: python3 main.py https://www.instagram.com/p/some_image')
@gotbadger
gotbadger / fixsteam.sh
Created March 18, 2018 21:22
Fix Steam on OSX case sensitive file systems
#!/bin/bash
## Try to use following solution.
## ------------------------------------
USER=$(whoami)
cd /Users/$USER/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/public; ls *.res | while read line ; do file=$(echo $line | tr '[:upper:]' '[:lower:]'); mv $line $file; done
cd /Users/$USER/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/steam/cached/; ls *.res | while read line ; do file=$(echo $line | tr '[:upper:]' '[:lower:]'); mv $line $file; done
cd /Users/$USER/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/friends; ls *.res | while read line ; do file=$(echo $line | tr '[:upper:]' '[:lower:]'); mv $line $file; done
cd /Users/$USER/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/graphics; ls *.res | while read line ; do file=$(echo $line | tr '[:upper:]' '[:lower:]'); mv $line $file; done
cd /Users/$USER/Library/Application\ Support/Steam/Steam.AppBundle/Steam/Contents/MacOS/servers; ls *.res | while read l
get the bin file for your device:
https://github.com/xoseperez/espurna/releases
setup the hardware as described. Im using an FTDI cable this shows in my system as /dev/tty.usbserial-FTE384H9 and is used in the following examples
set GPIO 0 low
check with console that you see boot mode message
install esptool if needed
pip install esptool
@gotbadger
gotbadger / ways_to_use_vcr.rb
Created November 3, 2017 10:21 — forked from myronmarston/ways_to_use_vcr.rb
Ways to use VCR for a request made by a let block
# 1) Use VCR.use_cassette in your let block. This will use
# the cassette just for requests made by creating bar, not
# for anything else in your test.
let(:foo) { VCR.use_cassette("foo") { create(:bar) } }
it "uses foo" do
foo
end
# 2) Wrap the it block that uses #foo in VCR.use_cassette.
@gotbadger
gotbadger / test.sh
Created December 30, 2016 12:46
CPU becnhmark multicore test
sudo apt-get install sysbench
for each in 1 4; do sysbench --test=cpu --cpu-max-prime=20000 --num-threads=$each run; done
@gotbadger
gotbadger / imgtest.sh
Created August 26, 2016 11:17
iterm2 image test
#!/bin/bash
printf "\033]"
printf "1337;File=;inline=1:R0lGODlhPQBEAPeoAJosM//AwO/AwHVYZ/z595kzAP/s7P+goOXMv8+fhw/v739/f+8PD98fH/8mJl+fn/9ZWb8/PzWlwv///6wWGbImAPgTEMImIN9gUFCEm/gDALULDN8PAD6atYdCTX9gUNKlj8wZAKUsAOzZz+UMAOsJAP/Z2ccMDA8PD/95eX5NWvsJCOVNQPtfX/8zM8+QePLl38MGBr8JCP+zs9myn/8GBqwpAP/GxgwJCPny78lzYLgjAJ8vAP9fX/+MjMUcAN8zM/9wcM8ZGcATEL+QePdZWf/29uc/P9cmJu9MTDImIN+/r7+/vz8/P8VNQGNugV8AAF9fX8swMNgTAFlDOICAgPNSUnNWSMQ5MBAQEJE3QPIGAM9AQMqGcG9vb6MhJsEdGM8vLx8fH98AANIWAMuQeL8fABkTEPPQ0OM5OSYdGFl5jo+Pj/+pqcsTE78wMFNGQLYmID4dGPvd3UBAQJmTkP+8vH9QUK+vr8ZWSHpzcJMmILdwcLOGcHRQUHxwcK9PT9DQ0O/v70w5MLypoG8wKOuwsP/g4P/Q0IcwKEswKMl8aJ9fX2xjdOtGRs/Pz+Dg4GImIP8gIH0sKEAwKKmTiKZ8aB/f39Wsl+LFt8dgUE9PT5x5aHBwcP+AgP+WltdgYMyZfyywz78AAAAAAAD///8AAP9mZv///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA
@gotbadger
gotbadger / asset.rake
Created August 16, 2016 14:42
Somtimes you need to diff the output of rake assets:precompile run this script after to remove fingerprints
task non_digested: :environment do
assets = Dir.glob(File.join(Rails.root, 'public/assets/**/*'))
regex = /(-{1}[a-z0-9]{32}*\.{1}){1}/
assets.each do |file|
next if File.directory?(file) || file !~ regex
source = file.split('/')
source.push(source.pop.gsub(regex, '.'))
non_digested = File.join(source)
@gotbadger
gotbadger / Makefile
Last active July 17, 2016 13:18 — forked from caius/Makefile
Save edge router config & scripts to current directory
.PHONY: save save_config save_commands save_scripts
save:
make -j save_config save_commands save_scripts
save_config:
ssh 192.168.1.1 "/opt/vyatta/bin/vyatta-op-cmd-wrapper show configuration" 2> /dev/null > config.txt
save_commands:
ssh 192.168.1.1 "/opt/vyatta/bin/vyatta-op-cmd-wrapper show configuration commands" 2> /dev/null > commands.txt
@gotbadger
gotbadger / gist:fed5973f70a4fef50c62
Created February 4, 2015 12:45
Grab your pubkey OSX
pbcopy < ~/.ssh/id_rsa.pub