This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package iterx | |
import ( | |
"iter" | |
) | |
func Chunk[T any](s iter.Seq[T], size int) iter.Seq[iter.Seq[T]] { | |
return func(yield func(iter.Seq[T]) bool) { | |
next, stop := iter.Pull(s) | |
defer stop() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# place this file at ~/.oh-my-zsh/custom/plugins/whitekid | |
alias bumpup="git add . && git commit --amend -C HEAD && git push -f" | |
alias rebase-build="git remote update && git rebase && make" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TARGET=bin/<your-target> | |
GO_PKG=<your-module-name> | |
SRC=$(shell find . -type f -name '*.go' -not -path "./vendor/*" -not -path "*_test.go") | |
GO?=go | |
BUILD_FLAGS?=-v | |
.PHONY: clean test dep tidy | |
all: build |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"fmt" | |
"sync" | |
) | |
func chanEvent1() { | |
ch := make(chan struct{}) | |
var wg sync.WaitGroup |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"bufio" | |
"bytes" | |
"fmt" | |
"os" | |
"regexp" | |
"strings" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// yaml multiple document를 parsing하는데, 각 document의 타입을 미리 확정할 수 없을 때 | |
// 각각의 document를 scanner로 분리하고 try & error로 각 document를 decoding하는 예제.. | |
// | |
package main | |
import ( | |
"bufio" | |
"bytes" | |
"errors" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// play at https://play.golang.org/p/lHRnRJHPheY | |
package main | |
import ( | |
"context" | |
"errors" | |
"log" | |
"sync" | |
"time" | |
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"encoding/json" | |
"strings" | |
) | |
type Data struct { | |
Build struct { | |
Name string `json:"name"` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import inspect | |
import warnings | |
from functools import wraps | |
def decorator(func_or_class): | |
warnings.filterwarnings('default', category=DeprecationWarning) | |
is_class = inspect.isclass(func_or_class) | |
if is_class: | |
type_name = 'class' | |
else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// netcat go version | |
// Usage: | |
// go-nc hostname port | |
// | |
// - connect to hostname:port | |
// - read stdin and send to socket | |
// - read socket and write to stdout | |
package main | |
import ( |
NewerOlder