Skip to content

Instantly share code, notes, and snippets.

View treywelsh's full-sized avatar
🧶

Pierre Lafievre treywelsh

🧶
View GitHub Profile
@treywelsh
treywelsh / http_slow_server.go
Created October 2, 2020 10:43
http server handle req context
package main
import (
"fmt"
"log"
"net"
"net/http"
"time"
)
@treywelsh
treywelsh / balancer.go
Last active March 14, 2019 13:59 — forked from angeldm/balancer.go
Rob Pike balancer for go
package main
import (
"container/heap"
"fmt"
"math/rand"
"time"
)
const nRequester = 100
@treywelsh
treywelsh / main.go
Last active November 24, 2023 03:06
golang dynamic xml unmarshalling mixed with fixed tags
package main
import (
"encoding/xml"
"fmt"
pkg "xml_unparsed/xmlmap"
//pkg "xml_unparsed/xmlslice"
)
/* source: https://stackoverflow.com/a/1371654
* Pro: The transitions appear clearly in source code
* Cons: need a lookup function (but could it be more cache efficient ? See data structures approach of N. Askitis)
*/
int entry_state(void);
int foo_state(void);
int bar_state(void);
int exit_state(void);
/* array and enum below must be in sync! */
subex ./ git log --oneline
NOTES:
git repository not tested
work only at first directory level
Could be useful with git aliases to run on a list of repos
@treywelsh
treywelsh / detach running process from bash
Last active April 23, 2018 20:38 — forked from zaius/background.sh
How to redirect a running process output to a file and log out
ctrl-z
bg
./fdredir.bash
# shell
disown