Skip to content

Instantly share code, notes, and snippets.

View stoewer's full-sized avatar
:octocat:

A. Stoewer stoewer

:octocat:
  • Australia, Brisbane
  • 10:33 (UTC +10:00)
View GitHub Profile
@stoewer
stoewer / parquet_write_map.go
Created June 26, 2023 08:13
parquet-go GenericWriter should write map keys to matching columns
package main
import (
"errors"
"fmt"
"io"
"log"
"os"
"github.com/segmentio/parquet-go"
@stoewer
stoewer / ToSnakeCase.go
Last active March 29, 2022 16:59
Convert camel case to snake case in Go http://play.golang.org/p/9ybqJat1Hr
import (
"fmt"
"strings"
"regexp"
)
var matchFirstCap = regexp.MustCompile("(.)([A-Z][a-z]+)")
var matchAllCap = regexp.MustCompile("([a-z0-9])([A-Z])")
@stoewer
stoewer / InspectStructs.go
Last active April 8, 2016 17:45
Inspect a struct in go
package main
import (
"fmt"
"reflect"
)
type Foo struct {
Bar string `param:"bar"`
Bla string `param:"bla"`
@stoewer
stoewer / migrate_bc16.sql
Created March 4, 2016 13:13
Fills GCA database with good defaults after migration to the BC16 schema
UPDATE conference SET isactive = FALSE WHERE isactive IS NULL ;
UPDATE conference SET haspresentationprefs = TRUE WHERE haspresentationprefs IS NULL ;
UPDATE conference SET ctime = deadline WHERE ctime IS NULL ;
UPDATE conference SET mtime = deadline WHERE mtime IS NULL ;
UPDATE conference SET conferencegroup = 'BC' WHERE conferencegroup IS NULL ;
UPDATE abstract SET ctime = c.deadline FROM abstract a JOIN conference c ON a.conference_uuid = c.uuid WHERE a.ctime IS NULL ;
UPDATE abstract SET mtime = c.deadline FROM abstract a JOIN conference c ON a.conference_uuid = c.uuid WHERE a.mtime IS NULL ;
UPDATE account SET ctime = (SELECT deadline FROM conference WHERE short = 'BC15') WHERE ctime IS NULL ;
@stoewer
stoewer / git_status.sh
Last active April 8, 2016 17:50
Show git status in prompt
# git status
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
}
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]:$(parse_git_branch)$ '
template<typename TOBJ, typename TRET, typename TCHECK>
condition
must(const TOBJ &parent, TRET(TOBJ::*get)(void)const, const TCHECK &check, const std::string &msg);
-----BEGIN PGP MESSAGE-----
Version: GnuPG v1
owFdkntQFVUcx7kECj4QCAclZsQlLRQve/acu7sHfGBSZCpaVwcE6s7ZPWdhFe7F
vReuQBoilvQwSCvLQFPKUKcCzXTGB4oylTaOgqNm6Iz2UEpTJ6CGAdplbNLOX+fx
+f1+3+/vd2pGPxIQaOvYEZ6bXtPQYTt1UwlwbiPR5ZzioaVccjmnFujM7bN2blLI
uGRuOStViJfZdU+c20OZfZk37j6TyJUww6t73CbF25Fd4lYlWrgVrOnuPGYUGbqV
iyNIVSASHQqSiUOTqQJFGYg8pohAwDtUJGGeIIrMlPker++hqtxQTpdOzds0NNvi
51j8bJRm8cVDDxIlCANIsWCmBohBghnQNEXElAHA8xboZcZ9S4QaOnG7vD4P8zPD
Ul3IjOUFzGV4PEPWVZ9ugQDxkAfYAQVTF/Hmm6FUIiIAiFJJFHgFASLwMqIaQKrA
@stoewer
stoewer / gist:9461273
Created March 10, 2014 08:20
Javascript OO pattern and inheritance
function isGlobal(other) {
return (function() { return this == other; })();
}
function inherit(object, superclass) {
if (superclass instanceof Function) {
if (arguments.length > 2) {