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
@thinktainer
thinktainer / powershell-ctags
Created August 22, 2012 08:47
Add powershell ctags
ctags.exe -R --langdef=powershell --langmap=powershell:.ps1,.psm1 --regex-powershell="/^function[\t ]*([a-zA-Z0-9_-]+)/\1/d,definition/" --regex-powershell="/^filter[\t ]*([a-zA-Z0-9_-]+)/\1/d,definition/" *
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
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
;;
@thinktainer
thinktainer / ilmerge.cmd
Created April 7, 2014 02:14
ilmerge for .NET 4.5
ilmerge /t:exe /targetplatform:"v4,$env:windir\Microsoft.NET\Framework64\v4.0.30319" /lib:. /out:Upload.exe .\lsul.exe
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"
)