Skip to content

Instantly share code, notes, and snippets.

View genghisjahn's full-sized avatar

Jon Wear genghisjahn

View GitHub Profile
@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!!!"
private static void OldBadWay()
{
//Warning! This is bad code! Don't use this!
SoapExample.LocalLibrary locallib = new SoapExample.LocalLibrary();
remoteSoap.RemoteLibrarySoapClient remoteclient = new remoteSoap.RemoteLibrarySoapClient();
var ssCall = new RemoteSSClient();
Console.Clear();
DateTime start;
private static void RunTest(dynamic service,string name, int num1, int num2, ConsoleColor color)
{
Console.ForegroundColor = color;
DateTime start = DateTime.UtcNow;
Console.WriteLine("{0}: {1} + {2} = ",name, num1, num2);
var local = service.AddThis(num1, num2);
Console.WriteLine("{0} Answer: {1}",name, local);
DateTime end = DateTime.UtcNow;
Console.WriteLine("{0} Ticks: {1}",name, GetDiff(start, end));
Console.WriteLine("-----");
RunTest(locallib, "Local Assembly", 100, 100, ConsoleColor.Green);
RunTest(remoteclient, @"SOAP/XML", 100, 100, ConsoleColor.Red);
RunTest(ssCall, "Service Stack", 100, 100, ConsoleColor.Cyan);
@genghisjahn
genghisjahn / humanperson.cs
Last active December 22, 2015 01:59
Human & Person classes
public class Human
{
public string LastName { get; set; }
public string FirstName { get; set; }
public string BirthDay { get; set; }
public Int16 HeightInInches { get; set; }
public override string ToString()
{
return string.Format("{0}, {1} is {2} inches tall. Born on {3}", this.LastName, this.FirstName, this.HeightInInches, this.BirthDay);
}