Skip to content

Instantly share code, notes, and snippets.

View scottjbarr's full-sized avatar

Scott Barr scottjbarr

View GitHub Profile
@scottjbarr
scottjbarr / .goconfig
Last active June 12, 2021 14:52
Install a particular version of Go, and a .goconfig to setup your shell
# source this file from your .bash_profile
export GOROOT=~/.go/versions/go1.10.3
export GOPATH=~/p/go
export PATH=$GOROOT/bin:$GOPATH/bin:$PATH
@scottjbarr
scottjbarr / .aliases
Created March 11, 2017 07:27
.aliases
alias emacsd="/usr/bin/emacs --daemon"
alias emacs="/usr/bin/emacsclient -t -nw"
@scottjbarr
scottjbarr / ubuntu_cheatsheet.md
Last active September 11, 2016 02:26
A collection of Linux Notes

Linux Notes

Ubuntu

Open current directory in file browser from terminal

xdg-open .

View image from terminal

@scottjbarr
scottjbarr / 500px.rb
Created September 9, 2016 04:55
Grab pictures from the 500px editors RSS feed. Just a quick hacky way of getting new images for my screensaver.
# See https://support.500px.com/hc/en-us/articles/204910987-What-RSS-feeds-are-available-
out=`curl -s https://500px.com/editors.rss`
urls = out.split("\n").select { |url| url.include?("img src") }.map { |s| s.split('"')[3] }
urls.each do |url|
id = url.split("/").last
filename = "#{id}.jpg"
@scottjbarr
scottjbarr / docker_cheatsheet.md
Last active August 31, 2017 01:19
Docker Cheatsheet

Docker Cheatsheet

Reminders for running docker

Start container in background, exposing port and enabling shell

docker run -d -p 127.0.0.1:9000:80 -it debian /bin/bash

Connect to running container

package main
import (
"context"
"flag"
"fmt"
"net/http"
"github.com/gorilla/mux"
"github.com/satori/go.uuid"
package main
import (
"fmt"
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
)
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"gopkg.in/yaml.v2"
)
@scottjbarr
scottjbarr / text_adv-part-1.go
Last active October 26, 2019 17:41 — forked from p4tin/text_adv-part-1.go
Writing a Text Adventure Game in Go - Part 1 (uses a *Location for Game.CurrentLocation)
package main
import (
"fmt"
"math/rand"
"time"
)
type Game struct {
Welcome string
## Go And Postgresql
Some notes on options for Go and Postgresql access.
## Drivers
- https://github.com/lib/pq
- https://github.com/jackc/pgx