Skip to content

Instantly share code, notes, and snippets.

View senorprogrammer's full-sized avatar
🇨🇦
Hackety hack

Chris Cummer senorprogrammer

🇨🇦
Hackety hack
View GitHub Profile
package main
import (
"bytes"
"fmt"
"log"
"os/exec"
)
func main() {
@senorprogrammer
senorprogrammer / golang_time.go
Created March 1, 2020 12:06
Golang Time fun
package main
import (
"fmt"
"time"
)
func TimeIn(t time.Time, name string) (time.Time, error) {
loc, err := time.LoadLocation(name)
if err == nil {
@senorprogrammer
senorprogrammer / emoji_fun.go
Created December 13, 2019 00:17
Fun with emoji string lengths
package main
import (
"fmt"
"unicode/utf8"
"github.com/rivo/uniseg"
)
func main() {
@senorprogrammer
senorprogrammer / switchgo.sh
Created September 23, 2019 23:21 — forked from fatih/switchgo.sh
Switch between go version using https://github.com/golang/dl
function switchgo() {
version=$1
if [ -z $version ]; then
echo "Usage: switchgo [version]"
return
fi
if ! command -v "go$version" > /dev/null 2>&1; then
echo "version does not exist, download with: "
echo " go get golang.org/dl/${version}"
@senorprogrammer
senorprogrammer / drobopi.md
Last active April 7, 2024 00:48
Mount Drobo on Raspberry Pi

On the Drobo

  1. Install the NFS app.

  2. In your Drobo Dashboard, under "Share Settings", make sure the directory you want to share is accessible to "Everyone".

On the Raspberry Pi

  1. Create a mount point: mkdir Common, where "Common" is the name of the directory you want to share (could be "Downloads", "raspi", whatever you want; I used "Common").
@senorprogrammer
senorprogrammer / raspi-go-1-10.sh
Last active September 16, 2018 15:02
Installing Go 1.10 on RaspberryPi
# A condensation of the instructions found here: https://golang.org/doc/install
#
# For Bash, replace all `.zshrc` with `.bashrc`
wget https://dl.google.com/go/go1.10.4.linux-armv6l.tar.gz
sudo tar -C /usr/local -xvf go1.10.4.linux-armv6l.tar.gz
cat >> ~/.zshrc << 'EOF'
export GOPATH=$HOME/go
export PATH=/usr/local/go/bin:$PATH:$GOPATH/bin
EOF
/*
This custom stylesheet slims down HackerNews (https://news.ycombinator.com) to the bare, useful essentials.
*/
#hnmain .votelinks {
padding-left: 2px;
padding-right: 4px;
}
#hnmain {
@senorprogrammer
senorprogrammer / git_log_format.md
Last active June 13, 2017 23:34
git log format

Format:

git log --date=format:"%b %d, %Y" --pretty=format:"%Cgreen %h %C(white) %s %C(dim)%an on %cd"

Output:

29049a70 [CORE-607] Add specs for the okcomputer health checks Chris Cummer on Jun 13, 2017

Imagine the text above has pretty colors in it.

Keybase proof

I hereby claim:

  • I am senorprogrammer on github.
  • I am chriscummer (https://keybase.io/chriscummer) on keybase.
  • I have a public key whose fingerprint is 2685 5FD1 72BE FE6C 75E4 CBA9 DF5A B430 FA4E AE8F

To claim this, I am signing this object:

@senorprogrammer
senorprogrammer / gist:7123977
Last active December 26, 2015 08:39
Whether or not Pathname + Dir on jRuby behaves differently than in MRI

Test code (run from the Documents directory of a standard OS X user account).

d = Dir.new('Pictures')

pn = Pathname.new(d)

dir = pn.children.find { |child| child.directory? && child.basename.to_s == 'GoPro' }
puts dir.inspect

JRuby 1.7.5 result: