Skip to content

Instantly share code, notes, and snippets.

View dgryski's full-sized avatar
🏠
💻 🍞 ☕

Damian Gryski dgryski

🏠
💻 🍞 ☕
View GitHub Profile
@ksurent
ksurent / fuzz.go
Created November 24, 2019 19:43
A toy grammar–based fuzzer for bookingcom/carbonapi. Heavily inspired by The Fuzzing Book.
package main
import (
"flag"
"fmt"
"math"
"math/rand"
"os"
"runtime/debug"
"strings"
@dgryski
dgryski / gist:a8353cb0977641f1feb6db1b8ed0eaf7
Created February 27, 2018 06:39
using the C pre-processor with Go
laptop:cppgo dgryski$ cat gen.go
package main
//go:generate cpp-7 -E -P foo.gopp foo.go
laptop:cppgo dgryski$ cat foo.gopp
package main
import "fmt"
#define STRINGIFY(x) #x
#!/usr/bin/perl
use warnings;
use strict;
my $bin=$ARGV[0];
my @line = split /\s+/, `nm $bin |grep runtime.buildVersion`;
my $addr = hex($line[0]);
my $end = $addr + 16;
@jessicard
jessicard / macarons.md
Last active July 24, 2024 01:51
Macarons!

Basic macaron shell recipe

  • This will make approximately 100 shells, or about 4 dozen cookies
  • When practicing, I generally half this recipe to only make 1 sheet of cookies
  • When making macarons, you will generally flavor the filling but not the shells
  • You want to make the macarons the day before the event. You will store them in the refrigerator over night, and then take them out a few hours before to come to room temperature. This is because macarons are best when "ripened", or allowed to sit for at least one night and have the filling seep into the shells a bit. Otherwise, straight out of the oven, they can be too crunchy or hard
  • Macarons shells freeze well! Filled macarons can also freeze well depending on the filling. Buttercream fillings freeze great. Put the cookies into an airtight container before freezing
  • Everyones baking temperature and baking time vary depending on their oven - you might have to experiment a bit!
  • _I always separate egg whites myself by cracking the egg, p
@tidwall
tidwall / clone-bytes.go
Created September 15, 2016 16:47
Redcon example using bytes
package main
import (
"log"
"strings"
"sync"
"github.com/tidwall/redcon"
)
@dgryski
dgryski / naivegame-naive.go
Last active September 18, 2016 07:41 — forked from magiconair/naivegame-naive.go
Port of the FastGame Java impl
// This is a port of the FAST Java version of
// https://jackmott.github.io/programming/2016/09/01/performance-in-the-large.html
// Original Go translation of naive version from https://gist.github.com/magiconair/68a524fc847ba2860893a799f637f532
//
// Code is not pretty!!! ;)
//
//
package main
@magiconair
magiconair / naivegame-naive.go
Last active September 14, 2016 07:24
Port of the NaiveGame Java impl
// This is a port of the naive Java version of
// https://jackmott.github.io/programming/2016/09/01/performance-in-the-large.html
//
// Code is not pretty!!! ;)
//
// Results:
//
// $ GODEBUG=gctrace=1 go run naive/main.go
// gc 1 @0.079s 0%: 0.11+0.30+0.077 ms clock, 0.34+0.008/0.40/0.48+0.23 ms cpu, 4->4->0 MB, 5 MB goal, 8 P
// # command-line-arguments

This document has moved!

It's now here, in The Programmer's Compendium. The content is the same as before, but being part of the compendium means that it's actively maintained.

@termie
termie / debugoauth,go
Created June 23, 2016 21:29
debug http requests for oauth
type DebugRoundTripper struct {
transport http.RoundTripper
out io.Writer
}
func (d *DebugRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) {
outreq, _ := httputil.DumpRequestOut(req, false)
fmt.Fprintf(os.Stderr, "REQOUT:\n%q\n", outreq)
resp, err := d.transport.RoundTrip(req)
@skarllot
skarllot / Makefile.makefile
Created May 3, 2016 21:24
Makefile to merge coverage data from all subpackages (Golang)
.PHONY: test-cover-html
PACKAGES = $(shell find ./ -type d -not -path '*/\.*')
test-cover-html:
echo "mode: count" > coverage-all.out
$(foreach pkg,$(PACKAGES),\
go test -coverprofile=coverage.out -covermode=count $(pkg);\
tail -n +2 coverage.out >> coverage-all.out;)
go tool cover -html=coverage-all.out