This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
recv := make(chan int) | |
send := make(chan int) | |
go func() { | |
queue = make([]int, 0) | |
done := false | |
for !done { | |
if len(queue) == 0 { | |
select { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import "github.com/jinzhu/gorm" | |
import ( | |
_ "github.com/lib/pq" | |
"fmt" | |
) | |
type Foo struct { | |
Id int64 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// $GOPATH/foopkg/whatever.go | |
package asdf | |
var X = "Hello" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"play/pkgaccess/pkg" | |
) | |
func main() { | |
fmt.Println(pkg.Bar) // Huh, I an access it | |
lcl := pkg.Bar // Huuuh, I can create a copy of it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Keep Downloads folder clean on a mac using xattr to track age. | |
# Normally, stick something like this in your crontab. It's pretty quick | |
# and not I/O intentisve, so I run every hour on some random time. | |
# | |
# Example crontab: | |
# 37 * * * * LOGME=1 /Users/james/bin/tmpclean-mac.sh /Users/james/Downloads 7 | |
dir="$1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
. "play/fill" | |
) | |
func main() { | |
var a Foo // Foo is just an interface, not a concrete type. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import groovyx.net.http.HTTPBuilder | |
import static groovyx.net.http.Method.GET | |
import static groovyx.net.http.ContentType.TEXT | |
def http = new HTTPBuilder('https://grickle.org/') | |
http.get( path: '/myip.php', contentType: TEXT ) { resp, reader -> | |
printn "Status: ${resp.statusLine}" // <-- typo right here | |
System.out << reader | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package controllers | |
import ( | |
"github.com/astaxie/beego" | |
"io/ioutil" | |
) | |
type MainController struct { | |
beego.Controller | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ time go run random-quiz-crypto.go | |
decryptKey 239333 | |
decrypt 375289 -> 230801 | |
decrypt 485994 -> 200009 | |
decrypt 047367 -> 190020 | |
decrypt 543573 -> 051400 | |
decrypt 785337 -> 131504 | |
decrypt 477107 -> 002023 | |
decrypt 727268 -> 150000 | |
"WHAT IS TEN MOD TWO " |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import networkx as nx | |
import community | |
G = nx.Graph() | |
G.add_node('node_a') | |
G.add_node('node_b') | |
G.add_node('node_c') | |
G.add_node('node_d') |
OlderNewer