Skip to content

Instantly share code, notes, and snippets.

View theGeekPirate's full-sized avatar
🎯
Focusing

theGeekPirate

🎯
Focusing
View GitHub Profile
@theGeekPirate
theGeekPirate / buildAllProduction.sh
Last active June 25, 2023 12:15
Builds a Go production (debug info stripped) binary for all supported platforms (excluding mobile)
#!/bin/sh
#From https://golang.org/doc/install/source#environment
platforms=(aix android darwin dragonfly freebsd illumos js linux netbsd openbsd plan9 solaris windows)
arches=(386 amd64 arm arm64 mips mipsle mips64 mips64le ppc64 ppc64le s390x wasm)
#.go file to build
test "$1" && target="$1"
if ! test "$target"; then
@theGeekPirate
theGeekPirate / buildAllDebug.sh
Last active August 8, 2020 16:56
Builds a Go debug binary for all supported platforms (excluding mobile)
#!/bin/sh
#From https://golang.org/doc/install/source#environment
platforms=(aix android darwin dragonfly freebsd illumos js linux netbsd openbsd plan9 solaris windows)
arches=(386 amd64 arm arm64 mips mipsle mips64 mips64le ppc64 ppc64le s390x wasm)
#.go file to build
test "$1" && target="$1"
if ! test "$target"; then
@theGeekPirate
theGeekPirate / browser.go
Last active December 5, 2019 04:31
Opens the browser on all non-mobile supported platforms
package browser
import (
"fmt"
"os/exec"
"runtime"
)
// TODO: aix, android, hurd, illumos, ?js?, nacl, zos
// TODO: Test plan9, solaris (can we just use "sdtwebclient" instead?)
@theGeekPirate
theGeekPirate / BAPCSalesCanadaLiveFeed.go
Created November 15, 2018 01:15
BAPCSalesLiveFeed will show a constant stream of live updates from the /r/bapcsalescanada subreddit. It was hacked together as quickly as possible in preparation for Black Friday.
// BAPCSalesLiveFeed will show a constant stream of live updates from the /r/bapcsalescanada subreddit.
// It was hacked together as quickly as possible in preparation for Black Friday.
// Note that this leaks memory _very slowly_ due to us constantly adding IDs to the postCache.
// This isn't a big deal since the amount of data stored is miniscule, but worth noting if you're
// going to be running it non-stop for a couple of years on a memory-constrained system for whatever reason.
package main
import (
"encoding/json"
@theGeekPirate
theGeekPirate / twitch.sh
Last active May 6, 2018 18:33
Twitch Streams
#!/bin/bash
#Uses https://github.com/GiedriusS/TwitchNotifier along with zenity
#to provide a nice list of followed streams which are currently online,
#then plays the selected stream using youtube-dl and mpv.
if [ -z "$2" ]; then
streamsOnline=$(twitchnotifier -c thegeekpirate -n | sort)
numCharsLongestChan=$(echo "$streamsOnline" | cut -d "^" -f 1 | wc -L)
numCharsLongestGame=$(echo "$streamsOnline" | cut -d "^" -f 2 | wc -L)
width=$((117+(numCharsLongestChan+numCharsLongestGame)*5))
// SendMessage is a convenience method to send messages with
func SendMessage(s *discordgo.Session, m *discordgo.MessageCreate, message string) {
_, err := s.ChannelMessageSend(m.ChannelID, message)
if err != nil {
return
}
}
// SendDM will attempt to send a direct message to the user
func SendDM(s *discordgo.Session, m *discordgo.MessageCreate, message string) {
@theGeekPirate
theGeekPirate / gist:e52e7c382afa11864c02b4cff4851ac8
Last active March 5, 2018 05:05
5m Reddit Video Link Grabber Hack
package main
import (
"encoding/xml"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
040b7d78de5b002ba128eb8de8f2b03b2f3657885d0fb1850cee9ae7163841ccf4f84262902370a55ffd9c95e9b09751af48d3c1c7603d5fe20a703a19510c5ef9;bradennapier

Keybase proof

I hereby claim:

  • I am thegeekpirate on github.
  • I am dozn (https://keybase.io/dozn) on keybase.
  • I have a public key ASCndaED49r_hfM6uz81gP1e6ID0J9W3Gv2hKe_OWOpgago

To claim this, I am signing this object: