docker run --rm --privileged \
-v $PWD:/go/src/github.com/sj14/multicode \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/sj14/multicode \
-e GITHUB_TOKEN=YOURTOKEN \
-e GO111MODULE=on \
goreleaser/goreleaser --rm-dist --snapshot --skip-publish
This file contains 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
#!/usr/bin/env bash | |
set -o xtrace # output every line which gets executed | |
set -o nounset # fail if an unset variable is used | |
#set -o errexit # fail if a command exits with non-zero | |
set -o pipefail # fail if a command in a pipe fails | |
COUNTER=0 | |
while test $COUNTER -le 30 |
This file contains 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
// Produce (context to kafka message header) | |
propagators := propagation.TraceContext{} | |
propagators.Inject(ctx, splunkkafka.NewMessageCarrier(msg)) | |
err := producer.Produce(msg, deliveryChan) | |
// Consume (kafka message headers to context) | |
message, err := client.ReadMessage(1 * time.Second) |
This file contains 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
func syncProduce(ctx context.Context, producer *kafka.Producer, topic string, key, data []byte) error { | |
if producer == nil { | |
return errors.New("nil producer") | |
} | |
if producer.IsClosed() { | |
return errors.New("closed producer") | |
} | |
deliveryChan := make(chan kafka.Event, 1) | |
// do not close the delivery channel, as messages still could be sent there, which would panic |
This file contains 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 | |
func main() { | |
val := reflect.ValueOf(&MY_STRUCTURE).Elem() | |
printStructure(val, 4) | |
} | |
func printStructure(s reflect.Value, level int) { | |
for i := 0; i < s.NumField(); i++ { | |
f := s.Field(i) |
This file contains 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
## | |
# Host Database | |
# | |
# localhost is used to configure the loopback interface | |
# when the system is booting. Do not change this entry. | |
## | |
127.0.0.1 localhost | |
255.255.255.255 broadcasthost | |
::1 localhost |
This file contains 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
#!/bin/bash | |
interfaces=( $(netstat -in | egrep 'utun\d .*\d+\.\d+\.\d+\.\d+' | cut -d ' ' -f 1) ) | |
rulefile="rules.tmp" | |
echo "" > $rulefile | |
sudo pfctl -a com.apple/tun -F nat | |
for i in "${interfaces[@]}" | |
do | |
RULE="nat on ${i} proto {tcp, udp, icmp} from 192.168.64.0/24 to any -> ${i}" | |
echo $RULE >> $rulefile | |
done |
I hereby claim:
- I am sj14 on github.
- I am simjue (https://keybase.io/simjue) on keybase.
- I have a public key ASD4NSo5o8EeuD_BFMsysgkVNqX-9Sbpyjqlk-w3qDqo1wo
To claim this, I am signing this object:
This file contains 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
/* | |
* By Simon Jürgensmeyer, 2014. | |
* based on the work of Nayuki Minase: | |
* http://nayuki.eigenstate.org/page/how-to-implement-the-discrete-fourier-transform | |
*/ | |
package main | |
import "fmt" | |
import "math" |