Skip to content

Instantly share code, notes, and snippets.

View supershabam's full-sized avatar
📴

Ian Hansen supershabam

📴
View GitHub Profile
interface LoginRequest {
kind: "LoginRequest";
username: string;
password: string;
}
interface LoginSuccess {
kind: "LoginSuccess";
@supershabam
supershabam / goebpfhacks.go
Created July 10, 2017 05:55
ugly hot-off-the-experimentation-press golang to load a noop ebpf program (it just returns zero on a kprobe and isn't even attached to anything)
package main
import (
"bytes"
"encoding/binary"
"fmt"
"strconv"
"syscall"
"unsafe"
package main
import "fmt"
import "sync"
import "time"
import "log"
type IDMesg struct {
ID string
Mesg string
@supershabam
supershabam / main.go
Last active September 9, 2015 02:43
vitess sql parser to get a list of columns a query will generate
package main
import (
"errors"
"fmt"
"log"
"github.com/youtube/vitess/go/vt/sqlparser"
)
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/rxjs/2.3.22/rx.all.js"></script>
<meta charset="utf-8">
<title>JS Bin</title>
</head>
<body>
<script id="jsbin-javascript">
if test -f /sys/kernel/mm/transparent_hugepage/enabled; then
echo never > /sys/kernel/mm/transparent_hugepage/enabled
fi
if test -f /sys/kernel/mm/transparent_hugepage/defrag; then
echo never > /sys/kernel/mm/transparent_hugepage/defrag
fi
//go:generate pipeliner map(func(string) (string, error) concurrently as concErrMap into conc_err_map.go
func concErrMap(concurrency int, fn func(string) (string, error), in <-chan string) (<-chan string, <-chan error) {
out := make(chan string)
errc := make(chan error, 1)
done := make(chan struct{})
once := sync.Once{}
go func() {
defer close(out)
var outerErr error
defer func() {
@supershabam
supershabam / conc_map.go
Last active August 29, 2015 14:16
go generate pipeliner example
//go:generate pipeliner map(func(string) string) concurrently as concMap into conc_map.go
func concMap(concurrency int, fn func(string) string, in <-chan string) <-chan string {
out := make(chan string)
go func() {
defer close(out)
wg := sync.WaitGroup{}
wg.Add(concurrency)
for i := 0; i < concurrency; i++ {
go func() {
defer wg.Done()
#!/bin/bash
echo "HI"
-A INPUT -p tcp --dport ssh -j ACCEPT
-A INPUT -p tcp --dport 1337 -s group:leet -j ACCEPT
var groups = map[string][]string{
"leet": []string{"1.2.3.4", "4.3.2.1"},
}
yields
-A INPUT -p tcp --dport ssh -j ACCEPT