Skip to content

Instantly share code, notes, and snippets.

@egonelbre
egonelbre / default.txt
Last active December 15, 2018 12:05
Go all.bat on all different filesystems
Building Go cmd/dist using C:\Go
Building Go toolchain1 using C:\Go.
Building Go bootstrap cmd/go (go_bootstrap) using Go toolchain1.
Building Go toolchain2 using go_bootstrap and Go toolchain1.
Building Go toolchain3 using go_bootstrap and Go toolchain2.
Building packages and commands for windows/amd64.
##### Testing packages.
ok archive/tar 3.046s
@egonelbre
egonelbre / absolutecover.go
Created October 5, 2018 15:55
Converts Go profile from package paths to filepaths
package main
import (
"bufio"
"bytes"
"fmt"
"io"
"io/ioutil"
"os"
"path"
@egonelbre
egonelbre / main.go
Created March 1, 2018 18:09
Size visual changing
package main
import (
"encoding/hex"
"fmt"
"math/rand"
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.com/gopherjs/vecty/event"
@egonelbre
egonelbre / main.go
Last active October 14, 2018 02:17
Vecty bugs
package main
import (
"encoding/hex"
"fmt"
"math/rand"
"github.com/gopherjs/vecty"
"github.com/gopherjs/vecty/elem"
"github.com/gopherjs/vecty/event"
package main
import (
"fmt"
"reflect"
)
func assert(k bool, msg string) {
if !k {
panic(msg)
@egonelbre
egonelbre / main.go
Created August 23, 2017 09:34
Go: reflection based generation (https://play.golang.org/p/y5qKxuoV9t)
package main
import (
"fmt"
"reflect"
"time"
)
type Status struct {
APC string
@egonelbre
egonelbre / collision.cpp
Created August 9, 2017 09:06
Shape Collision
#include "stdio.h"
#include "math.h"
#include "assert.h"
#define static_assert _Static_assert
typedef float f32;
typedef struct Vec2 { f32 X, Y; } Vec2;
float Vec2_Distance(Vec2 a, Vec2 b){
f32 dx = a.X - b.X;
@egonelbre
egonelbre / ebiten-bad.s
Created March 4, 2017 20:32
ebiten compilation issue
TEXT github.com/hajimehoshi/ebiten.vertices(SB)
:0 0xebc68 e59a1008 MOVW 0x8(R10), R1
:0 0xebc6c e15d0001 CMP R1, R13
:0 0xebc70 9a000227 B.LS 0xec514
:0 0xebc74 e52de068 MOVW.W R14, -0x68(R13)
:0 0xebc78 ebffd931 BL github.com/hajimehoshi/ebiten/internal/graphics.QuadVertexSizeInBytes(SB)
:0 0xebc7c e59d0004 MOVW 0x4(R13), R0
:0 0xebc80 e58d0060 MOVW R0, 0x60(R13)
:0 0xebc84 e59d106c MOVW 0x6c(R13), R1
:0 0xebc88 e5912018 MOVW 0x18(R1), R2
set VCVARS="C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
call %VCVARS% x64
cl /O1 -Feloader.64.exe loader.cpp
call %VCVARS% x86
cl /O1 -Feloader.32.exe loader.cpp
del *.obj
@egonelbre
egonelbre / build.bat
Created November 14, 2016 12:32
shell32 load time measurement
rem don't use optimizations otherwise cl may remove Shell32 dependency
cl dynamic.cpp
cl static.cpp
cl none.cpp
del *.obj
rem compiled x64 https://dl.dropboxusercontent.com/u/4300994/Go/measure-shell32-loading.zip