Skip to content

Instantly share code, notes, and snippets.

sed "$(( $RANDOM % 4 + 1))q;d" ~/values.txt
@thinktainer
thinktainer / README.md
Created December 8, 2021 14:01 — forked from ArgonQQ/README.md
Brew install specific version / Locally freeze version

Brew install specific version / Locally freeze version

# Please define variables
packageName=<packageName>
packageVersion=<packageVersion>

# Create a new tab
brew tap-new local/$packageName
curl "http://localhost:$1/streaming/channelsz?channel=$2&subs=1"
tmux new-session -d -s $1 -c $2
case $1 in
start)
autossh -f -M 0 -Nn -D 127.0.0.1:2431 jumpbox.prod.gcp.uw.systems
autossh -f -M 0 -Nn -D 127.0.0.1:2430 jumpbox.dev.gcp.uw.systems
autossh -f -M 0 -Nn -D 127.0.0.1:2429 jumpbox.prod.uw.systems
autossh -f -M 0 -Nn -D 127.0.0.1:2428 jumpbox.dev.uw.systems
;;
stop)
ps aux | rg 'autossh.*uw\.systems' | cut -d ' ' -f 2 | xargs kill
;;
set -g prefix C-b
bind-key -n C-b send-prefix
setw -g monitor-activity on
# Act like Vim
set-window-option -g mode-keys vi
bind-key h select-pane -L
bind-key j select-pane -D
bind-key k select-pane -U
func (n *natsEventSource) allEvents(callback func(eventWithTs) error) {
errChan := make(chan error, 1)
tick := make(chan struct{})
timeout := time.Duration(n.config.messageTimeout) * time.Second
msgHandler := func(m *stan.Msg) {
evt, err := unmarshalEventWithTs(m.Data)
if err != nil {
errChan <- errors.Wrap(err, fmt.Sprintf("unmarshalling msg with seqno: %d", m.Sequence))
return
}
@thinktainer
thinktainer / pdownload.go
Last active March 7, 2018 13:08
parallel processing loop (generic / interface{} based)
package s3repo
import (
"context"
"log"
"sync"
"github.com/pkg/errors"
)
let mut output: Box<io::Write> = match matches.value_of("out") {
Some(o) if o == "-" => Box::new(io::stdout()),
Some(o) => Box::new(File::create(&Path::new(o)).unwrap()),
None => Box::new(io::stdout()),
};
@thinktainer
thinktainer / gen_proto.sh
Created December 14, 2017 10:09
generate protos with timestamp gogoproto
protoc -I $GOPATH/src -I $PWD --gogoslick_out=Mgoogle/protobuf/any.proto=github.com/gogo/protobuf/types,Mgoogle/protobuf/timestamp.proto=github.com/gogo/protobuf/types,import_path=commission_results:. commission_events.proto