Skip to content

Instantly share code, notes, and snippets.

$ clang -E -dM -xc -m64 - <<EOF
#line 3 "/Users/jamesgray/proj/term4k/wat/main.go"
void hrrr() {}
#define hrr hrrr
#define saywat hrr
#include <sys/types.h> /* for size_t below */
/* Define intgo when compiling with GCC. */
$ cat main.c
int main() {
(int);
return 0;
}
$ gcc main.c
main.c: In function ‘main’:
main.c:2: error: expected expression before ‘;’ token
diff -r a10c7a350ab5 src/cmd/cgo/gcc.go
--- a/src/cmd/cgo/gcc.go Sat Oct 12 18:40:41 2013 -0400
+++ b/src/cmd/cgo/gcc.go Mon Oct 14 02:12:48 2013 -0500
@@ -306,7 +306,7 @@
b.WriteString("void __cgo__f__(void) {\n")
b.WriteString("#line 1 \"cgo-test\"\n")
for i, n := range toSniff {
- fmt.Fprintf(&b, "%s; /* #%d */\nenum { _cgo_enum_%d = %s }; /* #%d */\n", n.C, i, i, n.C, i)
+ fmt.Fprintf(&b, "(%s); /* #%d */\nenum { _cgo_enum_%d = %s }; /* #%d */\n", n.C, i, i, n.C, i)
}
diff -r 414057ac1f1f src/pkg/encoding/json/bench_test.go
--- a/src/pkg/encoding/json/bench_test.go Tue Aug 13 15:33:06 2013 +1000
+++ b/src/pkg/encoding/json/bench_test.go Sun Oct 13 00:17:22 2013 -0500
@@ -24,6 +24,10 @@
}
type codeNode struct {
+ codeNodeData
+}
+
package main
import (
"fmt"
glfw "github.com/go-gl/glfw3"
)
func errorCallback(err glfw.ErrorCode, desc string) {
fmt.Printf("%v: %v\n", err, desc)
}
P2P NAT-holepunching Hub
Each peer is addressable by a public key in the network, essentially by DHT, but
in such a way that keeps the device's IP pseudo-anonymous, where an
ipaddr-publickey pair only suggests knowledge of the peer. This has a name, but
I cannot recall or seem to search the right keywords for it.
I don't fully understand NAT holepunching, so this may not be adequate. As I
understand it, and to put it simply, a mutually known middleman out on the
internet is used to relay your public address to another peer. But, your
EXPLAIN ANALYZE
SELECT appid, max(time) AS maxtime FROM game_players
WHERE
appid != 0 AND time < date_trunc('hour', CURRENT_TIMESTAMP)
GROUP BY appid;
QUERY PLAN
-----------------------------------------------------------------------------------------------------------------------------------
HashAggregate (cost=488892.89..488930.88 rows=3799 width=12) (actual time=11097.638..11098.185 rows=3855 loops=1)
#include "stdio.h"
#include "string.h"
void InsertHtmlSpace(char *inout, unsigned int len)
{
unsigned int spaces = 0;
unsigned int i, o;
for (i = 0; i < len; i++)
{
package main
// void nothing() {}
import "C"
import "fmt"
import "testing"
func nothing() {}
func CNothing(b *testing.B) {
package main
import "fmt"
import "unsafe"
func FastInvSqrt(x float32) float32 {
xhalf := float32(0.5) * x
i := *(*int32)(unsafe.Pointer(&x))
i = int32(0x5f3759df) - int32(i>>1)
x = *(*float32)(unsafe.Pointer(&i))