Skip to content

Instantly share code, notes, and snippets.

🇨🇦
Hackety hack

Chris Cummer senorprogrammer

🇨🇦
Hackety hack
Block or report user

Report or block senorprogrammer

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
@senorprogrammer
senorprogrammer / emoji_fun.go
Created Dec 13, 2019
Fun with emoji string lengths
View emoji_fun.go
package main
import (
"fmt"
"unicode/utf8"
"github.com/rivo/uniseg"
)
func main() {
View switchgo.sh
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}"
View HappierNews
/*
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 / drobopi.md
Last active Mar 13, 2019
Mount Drobo on Raspberry Pi
View drobopi.md

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").
View range_intersection.rb
#!/usr/bin/env ruby
# From my blog post at http://www.postal-code.com/binarycode/2009/06/06/better-range-intersection-in-ruby/
class Range
def intersection(other)
raise ArgumentError, 'value must be a Range' unless other.kind_of?(Range)
my_min, my_max = first, exclude_end? ? max : last
other_min, other_max = other.first, other.exclude_end? ? other.max : other.last
@senorprogrammer
senorprogrammer / raspi-go-1-10.sh
Last active Sep 16, 2018
Installing Go 1.10 on RaspberryPi
View raspi-go-1-10.sh
# 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
View git_log_format.md

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.

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

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:

@senorprogrammer
senorprogrammer / hack.sh
Created Mar 31, 2012 — forked from erikh/hack.sh
OSX For Hackers
View hack.sh
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
View reservation_states.txt
pending => cancelled
=> confirmed => completed => refunded
=> transaction_pending =>transaction_declined
=> denied
=> expired
=> customer_cancelled_pending
You can’t perform that action at this time.