Instantly share code, notes, and snippets.

🔥
doing codes

# Daniel Comptondan-compton

🔥
doing codes
• Sort options
Created Dec 2, 2019
View protoc-gen-bitflags.go
 package bitflags import ( "bytes" "unicode" "github.com/gogo/protobuf/protoc-gen-gogo/generator" "github.com/opsee/protobuf/opseeproto" )
Last active Oct 17, 2019
Quantum Islands Problem: Retired Algos Interview Question
View quantum_islands.md

# Quantum Islands, Parts 2 and 3 written by Dan Compton (DC)

• github.com/dan-compton
• sourcerer.io/dan-compton

## Part 1: Count Islands

Given an NxN matrix where 1 represents "land" and an element populated with 0 represents "water", find the number of islands on the map.

Created Mar 11, 2019
Install a given bazel version (linux)
View bazel_install.sh
 #! /usr/bin/env bash # or place this function in your .zshrc function bazel_install() { curl -LO "https://github.com/bazelbuild/bazel/releases/download/\${BAZEL_VERSION}/bazel_\${BAZEL_VERSION}-linux-x86_64.deb" \ && sudo dpkg -i bazel_\${BAZEL_VERSION}-linux-x86_64.deb || echo "done." \ && sudo apt-get -f install \ && bazel } BAZEL_VERSION=0.18.0 bazel_install
Created Mar 3, 2019 — forked from ironchefpython/Jsonnet.g4
View Jsonnet.g4
 grammar Jsonnet; jsonnet : expr EOF ; expr : value=(NULL | TRUE | FALSE | SELF | DOLLAR | STRING | NUMBER ) # Value | '(' expr ')' # Parens | '{' objinside? '}' # Object
Created Jul 11, 2018
View install_go.sh
 #!/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
Last active Jun 27, 2016
gogo protobuf plugin that generates helper like funcs like Uint64() for bitflag message types (iow messages consisting of only bool fields)
View bitflags.go
 /* 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)
Last active Jun 9, 2016
gogo protobuf plugin that generates threadsafe "registry types" for message types that declare the registry MessageOption
View gogoregistryplugin.go
 package registry import ( "github.com/gogo/protobuf/protoc-gen-gogo/generator" "github.com/dan-compton/protobuf/danproto" ) type plugin struct { *generator.Generator generator.PluginImports
Last active Apr 11, 2016
Ultimate docker makefile work in progress forever
View 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
Last active Mar 18, 2016
Find the panic!
View panic.go
 package main import "fmt" type BM struct { d string } func NewBM() *BM { return &BM{d: "Hi",}} type CM struct {}
Created Feb 27, 2016
simple golang bruteforcer
View gist:c1b8d5ed441efa64b8bf
 //used something like this in a disclosure to sauceyapp.com regarding bruteforcing package main import ( "bytes" "fmt" "io/ioutil" "math/rand" "net/http"
You can’t perform that action at this time.