Skip to content

Instantly share code, notes, and snippets.

View mwmahlberg's full-sized avatar
🎯
Focusing

Markus Mahlberg mwmahlberg

🎯
Focusing
  • Cologne, Germany
View GitHub Profile
{
"_id":"$objectid",
"name": { "$choose" : { "from" : [ "Foo", "Bar", "Baz", "Blarg", "Blubb" ] } },
"categoriesIds": {
"$array":{
"of":{
"$number" : {"min" : 1, "max" : 1000 }
},
"number":{
"$number" : {"min" : 1, "max" : 100 }
package main
import (
"fmt"
"golang.org/x/crypto/bcrypt"
)
func main() {
pwd := []byte("password")
fmt.Println("Generating hashes...")
package main
import (
"os"
"io/ioutil"
)
// FileReadable returns true only if path is readable.
func FileReadable(path string) bool {
fi, err := os.Stat(path)
@mwmahlberg
mwmahlberg / main.go
Created January 22, 2016 22:02
Using json.Decoder to decode API call.
package main
import (
"encoding/json"
"fmt"
"net/http"
)
// So ungefähr
type Contrib struct {
@mwmahlberg
mwmahlberg / main.go
Last active January 23, 2016 12:51
XML stream parsing example for answer to http://stackoverflow.com/q/34958199/1296707:
package main
import (
"bytes"
"encoding/xml"
"fmt"
)
const (
book = `<?xml version="1.0" encoding="UTF-8"?>
@mwmahlberg
mwmahlberg / connect.sh
Created February 19, 2016 16:14
Script for connecting to mongod/mongos without the need to type in authInfo
#!/bin/bash
USER="foo"
PASS="bar"
AUTHDB="someDb"
mongo $1 -u $USER -p $PASS --authenticationDatabase $AUTHDB
@mwmahlberg
mwmahlberg / Caddyfile
Created March 24, 2016 13:19
Basic Docker Image for Caddy + golang fcgi
:80
log stdout
startup /usr/local/bin/fcgiapp &
shutdown /usr/bin/killall fcgiapp
fastcgi / 127.0.0.1:10000
# Data
{
"_id" : ObjectId("5744753e97bfc8000a18e3b2"),
"breeds" : [
"pomeranian"
],
"colors" : [
"apricot"
],
"delinquent" : false,
@mwmahlberg
mwmahlberg / regen2.sh
Last active June 30, 2016 17:58
Rework of the generator script for gogoprotobuf
#!/bin/bash -e
# This script fetches and rebuilds the "well-known types" protocol buffers.
# To run this you will need protoc and goprotobuf installed;
# see https://github.com/golang/protobuf for instructions.
# You also need Go and Git installed.
PKG=github.com/gogo/protobuf/ptypes
UPSTREAM=https://github.com/google/protobuf
UPSTREAM_SUBDIR=src/google/protobuf
@mwmahlberg
mwmahlberg / 1.0.md
Created April 1, 2017 21:09
1.0 Strategien

Strategien für 1.O

Diese Ideensammlung ist noch nicht ganz fertig, aber es sollte einen ersten Überblick geben.

Einführung

Ich nehme den Angriff von ZIP zum Anlass, um einige Dinge mal aufzuzeigen. Zum einen werde ich darlegen, warum ich Hives für einen Schmarren halte. Um das so verständlich wie möglich zu machen, muss ich ein wenig Grundsätzliches über Strategie erläutern. Das ist eher ein trockenes Thema (was viele überraschen wird), deswegen fasse ich mich da so kurz wie möglich. Schlussendlich werde ich eine Strategie vorschlagen, die sich grundlegend von anderen unterscheidet.

Grundsätzliche Überlegungen

Um mal mit einem Missverständnis direkt aufzuräumen. Strategie bei Strategiespielen hat wenig mit [Strategie beim Militär][wp:mil] zu tun, sondern mit [Spieltheorie][wp:st]. Im Grunde geht es bei jedem Strategiespiel darum, Ressourcen effizient so zu managen, dass man möglichst erfolgreich ist. Dazu gehören zwei Faktoren: Effizienter Ressourcengewinn und effektiver Ressourceneinsatz. Letzt