Skip to content

Instantly share code, notes, and snippets.

View StabbyCutyou's full-sized avatar

Sean Kelly StabbyCutyou

View GitHub Profile
@ajstarks
ajstarks / spark.go
Last active November 18, 2015 16:41
Sparkline experiment
package main
import (
"github.com/ajstarks/svgo"
"os"
)
var canvas = svg.New(os.Stdout)
// sparkline defines the components of the sparkline:
@numist
numist / there_i_fixed_it.rb
Created November 13, 2014 17:48
Get the system time zone in Olson format using Ruby
def get_local_timezone_str
# Yes, this is actually a shell script…
olsontz = `if [ -f /etc/timezone ]; then
cat /etc/timezone
elif [ -h /etc/localtime ]; then
readlink /etc/localtime | sed "s/\\/usr\\/share\\/zoneinfo\\///"
else
checksum=\`md5sum /etc/localtime | cut -d' ' -f1\`
find /usr/share/zoneinfo/ -type f -exec md5sum {} \\; | grep "^$checksum" | sed "s/.*\\/usr\\/share\\/zoneinfo\\///" | head -n 1
fi`.chomp
@mattes
mattes / check.go
Last active October 11, 2024 16:22
Check if file or directory exists in Golang
if _, err := os.Stat("/path/to/whatever"); os.IsNotExist(err) {
// path/to/whatever does not exist
}
if _, err := os.Stat("/path/to/whatever"); !os.IsNotExist(err) {
// path/to/whatever exists
}