Skip to content

Instantly share code, notes, and snippets.

View dancompton's full-sized avatar
🌴
On vacation

dancompton dancompton

🌴
On vacation
View GitHub Profile
local fn = vim.fn
local install_path = '~/.local/share/nvim/site/pack/packer/start/packer.nvim'
vim.cmd [[packadd packer.nvim]]
local function load_plugins()
local use = require('packer').use
require("packer").startup(
{
function()
package bitflags
import (
"bytes"
"unicode"
"github.com/gogo/protobuf/protoc-gen-gogo/generator"
"github.com/opsee/protobuf/opseeproto"
)
grammar Jsonnet;
jsonnet
: expr EOF
;
expr
: value=(NULL | TRUE | FALSE | SELF | DOLLAR | STRING | NUMBER ) # Value
| '(' expr ')' # Parens
| '{' objinside? '}' # Object
#!/bin/bash
set -e
VERSION="1.9.3"
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]; then
# assume Zsh
shell_profile="zshrc"
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]; then
# assume Bash
@dancompton
dancompton / bitflags.go
Last active June 27, 2016 22:28
gogo protobuf plugin that generates helper like funcs like Uint64() for bitflag message types (iow messages consisting of only bool fields)
/*
Given the protobuf below, generates the following funcs so that the message can be used as bitflags:
func (this *User) UInt64() uint64 {
b := uint64(0)
if this.ScopeA {
b |= uint64(1) << uint64(0)
}
if this.ScopeB {
b |= uint64(1) << uint64(1)
@dancompton
dancompton / Makefile
Last active June 23, 2021 18:21
old makefile
# CONTAINER_TAG is git revision unless overriden by YOURPROJ_VERSION
CONTAINER_TAG := $(shell git rev-parse HEAD)
ifeq ($(YOURPROJ_VERSION), "")
CONTAINER_TAG := $(YOURPROJ_VERSION)
endif
CONTAINER_NAME := "docker/yourproj"
CONTAINER_PORTS := "7000:7000"
all: clean deps build
@dancompton
dancompton / gist:c1b8d5ed441efa64b8bf
Created February 27, 2016 01:24
simple golang bruteforcer
//used something like this in a disclosure to sauceyapp.com regarding bruteforcing
package main
import (
"bytes"
"fmt"
"io/ioutil"
"math/rand"
"net/http"
@dancompton
dancompton / exponentialbackoff.go
Created February 22, 2016 23:20
Exponential backoff that takes a clojure
// something like
type clj func() (interface{}, error)
func DoWithBackoff(retries int, fn clj) (interface{}, error) {
for try := 0; try < retries; try++ {
output, err := fn()
if err != nil || try < 6 { // Todo(you) remove || try < 6
log.WithError(err).Error("Failed to execute.")
continue
} else {
import collections
import pprint
import operator
d = collections.defaultdict(int)
z = {}
original = '''FNNVRJAINVMUHZBJLTXFEMNVAINVMUOWUCNVNVRJCKXFWELTNVWXTZMUAIBJ'''
print 'total chars:',len(original)
for c in original:
@dancompton
dancompton / gist:9f6e3b4a09f1caf2c44d
Created October 10, 2015 23:15
Bruteforce saucey promocodes
package main
import (
"bytes"
log "github.com/Sirupsen/logrus"
"io/ioutil"
"math/rand"
"net/http"
"sync"
"time"