Skip to content

Instantly share code, notes, and snippets.

Avatar
🎯
Focusing

theGeekPirate

🎯
Focusing
View GitHub Profile
@theGeekPirate
theGeekPirate / BAPCSalesCanadaLiveFeed.go
Created Nov 15, 2018
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.
View BAPCSalesCanadaLiveFeed.go
// 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
Twitch Streams
View twitch.sh
#!/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))
View gist:39c641d87bc963733b1d57658494dd50
// 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) {
View genesis_public_key
040b7d78de5b002ba128eb8de8f2b03b2f3657885d0fb1850cee9ae7163841ccf4f84262902370a55ffd9c95e9b09751af48d3c1c7603d5fe20a703a19510c5ef9;bradennapier
@theGeekPirate
theGeekPirate / gist:e52e7c382afa11864c02b4cff4851ac8
Last active Mar 5, 2018
5m Reddit Video Link Grabber Hack
View gist:e52e7c382afa11864c02b4cff4851ac8
package main
import (
"encoding/xml"
"errors"
"fmt"
"io/ioutil"
"log"
"net/http"
"os"
View keybase.md

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:

@theGeekPirate
theGeekPirate / browser.go
Last active Dec 5, 2019
Opens the browser on all non-mobile supported platforms
View browser.go
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 / buildAllDebug.sh
Last active Aug 8, 2020
Builds a Go debug binary for all supported platforms (excluding mobile)
View buildAllDebug.sh
#!/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 / buildAllProduction.sh
Last active Aug 8, 2020
Builds a Go production (debug info stripped) binary for all supported platforms (excluding mobile)
View buildAllProduction.sh
#!/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
You can’t perform that action at this time.