Skip to content

Instantly share code, notes, and snippets.

View genghisjahn's full-sized avatar

Jon Wear genghisjahn

View GitHub Profile

Keybase proof

I hereby claim:

  • I am genghisjahn on github.
  • I am genghisjahn (https://keybase.io/genghisjahn) on keybase.
  • I have a public key whose fingerprint is 617E C2B6 541C C343 4BE5 5AEF 7C34 BAA9 9CF5 A66F

To claim this, I am signing this object:

@genghisjahn
genghisjahn / random.go
Created February 6, 2015 03:42
Sphero Random Roll
package main
import (
"time"
"github.com/hybridgroup/gobot"
"github.com/hybridgroup/gobot/platforms/sphero"
)
func main() {
@genghisjahn
genghisjahn / demo.go
Created February 9, 2015 03:53
TextLengthDemo
func ProcessText(text string, items []TextLengthItem) string {
firstParts := []string{"This text is %v characters in length.", "Text is %v characters long.", "Text is %v characters in length."}
result_template := "%v %v"
textLength := len(text) + 2
for _, firstPart := range firstParts {
for _, item := range items {
length_sentence := fmt.Sprintf(firstPart, item.Text)
if textLength+len(length_sentence) == item.Value {
return fmt.Sprintf(result_template, text, length_sentence)
}
@genghisjahn
genghisjahn / pipestuff.md
Last active August 29, 2015 14:17
Pipe Command Stuff you need to Memorize

Memorize this stuff!!

  • git br | grep deeplink returns all the branches that have deeplink in the name.
  • find . | grep language finds all the files with the string language in the name.
  • find . -name "*.sql" finds all the files that end with .sql in the name.
  • find . "*user*" | xargs cat finds each file with user in the title and then cats them all.
  • find . -name "*.go" | xargs cat | wc -l finds each file that ends with .go and counts the total lines of code.
@genghisjahn
genghisjahn / log.go
Created June 1, 2015 15:47
Golang logging example
package main
import (
"os"
"github.com/go-logging"
)
//https://github.com/op/go-logging/
var log = logging.MustGetLogger("main")
@genghisjahn
genghisjahn / b2dsetup
Created July 14, 2015 14:17
boot2docker setup
boot2docker stop
install latest version of VBOX (currently 4.3.30)
install latest version of Boot2docker (currently https://github.com/boot2docker/osx-installer/releases/tag/v1.7.0)
boot2docker delete
boot2docker init
boot2docker start
boot2docker ssh 'sudo /etc/init.d/docker restart' # This line is key...
@genghisjahn
genghisjahn / vimstuff.txt
Created August 25, 2015 15:23
Vim installed stuff
Installed pathogen
Installed sensible-vim
Installed vim-go
Installed molokai color

The hypothetical student, still a mule, would drift around for a while. He would get another kind of education quite as valuable as the one he’d abandoned, in what used to be called the "school of hard knocks." Instead of wasting money and time as a high-status mule, he would now have to get a job as a low-status mule, maybe as a mechanic. Actually his real status would go up. He would be making a contribution for a change. Maybe that’s what he would do for the rest of his life. Maybe he’d found his level. But don’t count on it.

In time...six months; five years, perhaps...a change could easily begin to take place. He would become less and less satisfied with a kind of dumb, day-to-day shopwork. His creative intelligence, stifled by too much theory and too many grades in college, would now become reawakened by the boredom of the shop. Thousands of hours of frustrating mechanical problems would have made him more interested in machine design. He would like to design machinery himself. He’d think he could do a

@genghisjahn
genghisjahn / ham.go
Last active December 14, 2015 03:47
Hamming Distance Func
package main
import (
"fmt"
"strconv"
)
func main() {
a := "this is a test"
b := "wokka wokka!!!"
@genghisjahn
genghisjahn / waitgroup.go
Created January 12, 2016 18:27
Shows how to use a wait group to make sure all the go routines are done.
package main
import (
"fmt"
"math/rand"
"sync"
"time"
)
func main() {