Skip to content

Instantly share code, notes, and snippets.

View spellgen's full-sized avatar

Stefan Engstrom spellgen

View GitHub Profile
package waitlist
import "sync"
type waitChanList []chan struct{}
type WaitList struct {
m map[string]waitChanList
sync.RWMutex
}
@spellgen
spellgen / readme.md
Created September 3, 2021 18:42
convert webkit timestamp to go

Date calculations can overflow with webkit times (microseconds since Jan 1 1601).

This works in go1.17

@spellgen
spellgen / clever.named_queries
Created August 27, 2021 23:19 — forked from gchristian/clever.named_queries
Example named query file for PowerSchool Clever sync
# This is an example only. I no longer use it and hope to update it eventually.
# If you are starting from scratch you should be using the users table not the teachers view
# for creating a PK for your staff. If you don't, teachers who teach at multiple schools will
# not work correctly. My fix was to just keep using the schoolstaff id's (that is what the
# teacher view uses) but make sure it is always the users homeschool's sschoolstaff id. It'd be
# cleaner to have just used the users table to begin with though. I have a much better understanding
# of mysql and ps tables then I was when I first wrote this.
<queries>
<query name="org.yourschool.clever.schools.all" coreTable="SCHOOLS" flattened="true">
@spellgen
spellgen / tee.txt
Last active March 26, 2021 23:03
Clone reader with pipe + tee
package main
import (
"bytes"
"fmt"
"io"
"io/ioutil"
"sync"
)
package main
import (
"bufio"
"fmt"
"os"
"time"
)
type point struct {
package main
import (
"bufio"
"fmt"
"os"
"strconv"
"strings"
"time"
)
package main
import (
"aoc/vm"
"fmt"
)
type jump struct {
pos int
op string
package vm
import (
"bufio"
"fmt"
"io"
"strconv"
"strings"
)
package main
import (
vm "aoc/vm"
"fmt"
"os"
)
func main() {
if len(os.Args) < 2 {
package main
import (
"fmt"
"github.com/spellgen/scan"
"os"
)
type passLine struct {
s int