Skip to content

Instantly share code, notes, and snippets.

caelifer

Block or report user

Report or block caelifer

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View swap-uint16-bytes.go
// Swap bytes routines (hi <-> lo) for uint8, uint16, uint32 and uint64
func swapbytes8(d uint8) uint8 {
return (d << 4) | (d >> 4)
}
func swapbytes16(d uint16) uint16 {
return (d << 8) | (d >> 8)
}
View regexdna.go
/* The Computer Language Benchmarks Game
* http://benchmarksgame.alioth.debian.org/
*
* contributed by The Go Authors.
* modified by Tylor Arndt.
* modified by Chandra Sekar S to use optimized PCRE binding.
* modified by Timour Ezeev - use stdlib regexp package + precompile regexps
*/
package main
View random.go
package main
import (
"math/rand"
"os"
)
const (
LINES = 60
GROUPS = 6
View sub-matrix.go
package main
import (
"bufio"
"fmt"
"io"
"strconv"
"strings"
)
View fizzbuzz-simple.go
package main
import "fmt"
func main() {
for i := 1; i <= 45; i++ {
res := ""
if i%2 == 0 {
res += "Carr"
View wc-like counter.go
package main
import (
"bufio"
"fmt"
"io"
"log"
"strings"
"unicode"
)
View jitter.go
package main
import (
"fmt"
"math/rand"
"time"
)
type Factor struct {
num, denom uint32
View grid.go
package main
import (
"errors"
"fmt"
"time"
)
type Grid struct {
height, width int
View alice_and_bob.go
package main
// Exersice #1 from http://whipperstacker.com/2015/10/05/3-trivial-concurrency-exercises-for-the-confused-newbie-gopher/
import (
"fmt"
"math/rand"
"sync"
"time"
)
View groupkill.go
package main
import (
"log"
"os"
"os/exec"
"syscall"
"time"
)
You can’t perform that action at this time.