Skip to content

Instantly share code, notes, and snippets.

doing codes

Daniel Compton dan-compton

doing codes
Block or report user

Report or block dan-compton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View protoc-gen-bitflags.go
package bitflags
import (
dan-compton /
Last active Oct 17, 2019
Quantum Islands Problem: Retired Algos Interview Question

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


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.

dan-compton /
Created Mar 11, 2019
Install a given bazel version (linux)
#! /usr/bin/env bash # or place this function in your .zshrc
function bazel_install() {
curl -LO "${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
View Jsonnet.g4
grammar Jsonnet;
: expr EOF
: value=(NULL | TRUE | FALSE | SELF | DOLLAR | STRING | NUMBER ) # Value
| '(' expr ')' # Parens
| '{' objinside? '}' # Object
set -e
if [ -n "`$SHELL -c 'echo $ZSH_VERSION'`" ]; then
# assume Zsh
elif [ -n "`$SHELL -c 'echo $BASH_VERSION'`" ]; then
# assume Bash
dan-compton / bitflags.go
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)
dan-compton / gogoregistryplugin.go
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 (
type plugin struct {
dan-compton / Makefile
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_NAME := "docker/yourproj"
CONTAINER_PORTS := "7000:7000"
all: clean deps build
dan-compton / panic.go
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 {}
View gist:c1b8d5ed441efa64b8bf
//used something like this in a disclosure to regarding bruteforcing
package main
import (
You can’t perform that action at this time.