Skip to content

Instantly share code, notes, and snippets.

View olso's full-sized avatar
🏠
Working from home

Martin Olsansky olso

🏠
Working from home
View GitHub Profile

Keybase proof

I hereby claim:

  • I am olso on github.
  • I am olso (https://keybase.io/olso) on keybase.
  • I have a public key ASAjyl8XHSDHwxAZp-o0tBRL9pOHZTa0IUfL_oSL8V7jVQo

To claim this, I am signing this object:

@olso
olso / timesheet-log.sh
Created July 31, 2017 09:49
Timesheet log
git log --after="2017-06-01" --until="2017-07-01" --pretty=format:'%ad;%s' --author='olso' > ~/Desktop/timesheet-june-log.csv
@olso
olso / shamir-shares.md
Last active January 25, 2019 13:07
Shamir shares, if you crack, contains reward in form of bitcoin blockchain private key

secret-share-split --count 4 --threshold 3 > ~/shares.txt

01545e8642e2934a1074ff32bc8d491dade5821933258c22b00cebfa7c9b922fe01aeb3281093b513954ce25fb75ee32ea21333d7cac8dfbe319a91a874bbf0691b61dd2
025b2e71b0d9ec727319a57c879c72818c1d84bad26f41a0cd13bff6e6b42b60441aeb3281093b513954ce25fb75ee32ea21333d7cac8dfbe319a91a874bbf0691b61dd2
@olso
olso / chrome-disabled-web-sec.sh
Last active January 11, 2018 13:36
Launch Chrome with disabled web sec
open -n -a "Google Chrome" --args --disable-web-security --profile-directory="Profile 1"
build_go:
docker run --rm \
-v `pwd`/src:/game \
--env GOOS=js --env GOARCH=wasm \
golang:1.12-rc \
/bin/bash -c "go build -o /game/game.wasm /game/main.go; cp /usr/local/go/misc/wasm/wasm_exec.js /game/wasm_exec.js"
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1.0" />
<style>body{height:100%;width:100%;padding:0;margin:0;background-color:#000000;color:#FFFFFF;font-family:Arial,Helvetica,sans-serif}</style>
<script type="text/javascript" src="./wasm_exec.js"></script>
<script type="text/javascript">
async function run(fileUrl) {
try {
package main
import (
// https://github.com/golang/go/tree/master/src/syscall/js
"syscall/js"
)
var (
// js.Value can be any JS object/type/constructor
window, doc, body, canvas, laserCtx, beep js.Value
func main() {
setup()
// declare renderer at compile time
var renderer js.Func
// looks like JS callback, right 😌
renderer = js.FuncOf(func(this js.Value, args []js.Value) interface{} {
updateGame()
// for the 60fps anims
window.Call("requestAnimationFrame", renderer)
func main() {
// https://stackoverflow.com/a/47262117
// creates empty channel
runGameForever := make(chan bool)
setup()
// attempt to receive from empty channel
// since noone ever sends anything on it, it's essentially a blocking forever operation
// we basically have a daeomon/service/background program
func updatePlayer(event js.Value) {
mouseX := event.Get("clientX").Float()
mouseY := event.Get("clientY").Float()
// basically threads/async/parallelism
// TODO difference with Web Workers
// TODO difference with Service Workers
// https://gobyexample.com/goroutines
go log("mouseEvent", "x", mouseX, "y", mouseY)