Skip to content

Instantly share code, notes, and snippets.

# Current Flows
## SOAP
Soap generates:
- replacements
- resends
@ayzu
ayzu / main.go
Created December 17, 2021 15:32
serialize writes
package main
import (
"database/sql"
"log"
"sync"
"github.com/jmoiron/sqlx"
_ "github.com/lib/pq"
)
@ayzu
ayzu / round_robin.py
Created September 13, 2021 09:07
Round-Robin Scheduler
# A single round-robin schedule:
# 1. match the members: (group1[i], group2[i])
# 2. rotate all the member except the first one
# continue the process.
from typing import List, Tuple
from dataclasses import dataclass
import datetime
package main
import (
"fmt"
"html/template"
"log"
"net/http"
"os"
"github.com/gorilla/pat"
@ayzu
ayzu / queue.md
Last active July 31, 2021 06:39
Dynamic Resizing Complexity 2

Queue

Implement Dequeue

  1. Using linked list
  2. Using array

Array-based implementation:

  1. allocate array of the max size.
@ayzu
ayzu / queue.md
Created July 31, 2021 06:26
Dynamic Resizing Complexity

Queue

Dequeue

  1. Using linked list
  2. Using array

Array:

  1. allocate array of the max size.
  2. front and back points at the current ends.
type request struct {
Field1, Field2 int
}
r := request{Field1: 1, Field2: 2}
data := `{"Field2": 202}`
err := json.Unmarshal([]byte(data), &r)
if err != nil {
panic(err)
s := map[string]int{
"Field1": 1,
"Field2": 2,
}
data := `{"Field2": 202}`
err := json.Unmarshal([]byte(data), &s)
if err != nil {
panic(err)
type Struct1 struct {
A int
B int
}
type Struct2 struct {
A int
}
func main() {
type Struct1 struct {
A int `db:"a"`
}
type Struct2 struct {
A int `json:"a"`
}
func main() {
s1 := Struct1{A: 1}