Skip to content

Instantly share code, notes, and snippets.

Joe Taber infogulch

Block or report user

Report or block infogulch

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@infogulch
infogulch / utf8.cpp
Created Dec 6, 2018
UTF-8 Decoder in Mill assembly
View utf8.cpp
// decode accepts a byte and a vector of the next 3 bytes (the %first byte and the possible
// %continuation bytes and returns a decoded code point in an integer, and the number of bytes
// consumed (including the first byte) The vector may contain NaR bytes if at the end of a buffer
F('decode') %first, %cont;
// fast path for 1 byte
con(v(0xe0, 0xf0, 0xf8)) %prefmask, //R0 # masks of the three possible prefixes
lssu(%first, 0x80) %onebyte, // E0 # check if the first byte is < 0x80
andlu(%first, %prefmask) %masked, // E1 # bit-and with bitmasks of 3 possible prefixes
retntr(%onebyte, %first, 1); // F0# if < 0x80 return the first byte & consume one byte
@infogulch
infogulch / multisort.go
Last active May 6, 2016
How to design a Go slice type that needs to be sortable in many ways.
View multisort.go
// How to design a Go slice type that needs to be sortable in many ways.
package main
import (
"fmt"
"sort"
)
type data struct {
i int
@infogulch
infogulch / blah.go
Last active Sep 22, 2015
Test file for /clipperhouse/gen/pull/65
View blah.go
package main
@infogulch
infogulch / README.md
Last active Dec 11, 2015
high level generic C type modules
View README.md

#How to compile Type make

View gist:4057353
cls := new TeeClasses(MyClass, MyOtherClass)
inst := new cls()
inst.MyMethod("a","b") ; this calls MyMethod from *both* classes
class MyClass
{
MyMethod(arg1, arg2)
{
msgbox % A_ThisFunc " called with: " arg1 ", " arg2
View gist:3830136
table t1 contains 4 rows, with id = 1, 2, 3, 5
SELECT X, Y
FROM (
SELECT A.id as X, (SELECT MIN(b.id) FROM t1 AS B WHERE B.id > A.id) as Y
FROM t1 AS B
) C
WHERE Y IS NOT NULL
id1 | id2
View commands.py
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# pyspades is distributed in the hope that it will be useful,
View run.py
# Copyright (c) Mathias Kaerlev 2011-2012.
# This file is part of pyspades.
# pyspades is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# pyspades is distributed in the hope that it will be useful,
@infogulch
infogulch / trusted.py
Created Aug 9, 2012
Before/After changes
View trusted.py
"""
Adds the ability to 'trust' certain players, i.e. they cannot be votekicked
or rubberbanded.
Maintainer: mat^2 / hompy
"""
from commands import add, admin, get_player
import votekick
@infogulch
infogulch / slab6.c
Created Jul 27, 2012
Excerpt from slab6.c: savevox()
View slab6.c
void savevox (char *filnam)
{
FILE *fil;
long i, x, y, z;
voxtype *vptr, *vptr2;
optimizexdimen();
optimizeydimen();
optimizezdimen();
You can’t perform that action at this time.