Skip to content

Instantly share code, notes, and snippets.

// Comment on https://www.reddit.com/r/golang/comments/3zgaxf/happy_new_year_gofragmentsnet_2_new_examples
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
)
@caelifer
caelifer / large_constants.go
Last active February 29, 2016 17:54
How to deal with large constants which overflow basic types
package main
import (
"fmt"
"math/big"
)
const (
KB = 1000
MB = 1000 * KB
package main
import (
"fmt"
"math/rand"
"os"
"sort"
"strconv"
)
package main
import (
"fmt"
"regexp"
"sort"
)
func main() {
cm := NewCMR(4)
package main
import (
"fmt"
"log"
"regexp"
"strings"
"time"
)
set quote_regexp = "^([ \t]?[|>])+"
color body red default "^[-].*"
color body green default "^[+].*"
color body brightdefault default "^diff --git.*"
color body brightdefault default "^index [a-f0-9].*"
color body brightdefault default "^[-]{3} a.*"
color body brightdefault default "^[+]{3} b.*"
color body cyan default "^@@[^@]*@@"
package main
import (
"fmt"
"time"
)
func main() {
t1 := time.Now()
import java.util.Calendar;
import java.util.Date;
public class PreviousDOWCalculator {
private static final int[] dows = {
Calendar.MONDAY,
Calendar.TUESDAY,
Calendar.WEDNESDAY,
Calendar.THURSDAY,
Calendar.FRIDAY,
package main
import (
"fmt"
"strings"
)
func main() {
t1 := NewNode("A")
t2 := NewNode("B", t1)
package main
import (
"log"
"math/rand"
"sync"
"time"
)
func init() {