Skip to content

Instantly share code, notes, and snippets.

Avatar

Brandon Mason bitmage

View GitHub Profile
@bitmage
bitmage / gitr
Last active January 21, 2021 22:05
git status recursively
View gitr
#!/bin/bash
shopt -s globstar
for repo in ./**/.git; do
dir=`dirname "$repo"`
printf "$dir:\n"
export GIT_DIR="$repo"
export GIT_WORK_TREE="$dir"
git log --branches --not --remotes --simplify-by-decoration --decorate --oneline
git status --short
View keybase.md

Keybase proof

I hereby claim:

  • I am bitmage on github.
  • I am bitmason (https://keybase.io/bitmason) on keybase.
  • I have a public key ASCYM6PGtXUuJl8TSG1l8nrfAk3P9VIhVvb3FhAKO5HJNAo To claim this, I am signing this object:
{
  "body": {
    "key": {
@bitmage
bitmage / emitters.js
Created August 13, 2019 19:14
event emitters example
View emitters.js
const {EventEmitter} = require('events')
// initialization
const ee = new EventEmitter()
ee.isReady = false
ee.on('ready', function() {ee.isReady = true})
ee.onReady = function(cb) {
if (this.isReady) {
// call immediately
cb()
View push and pull results.txt
~/projects/oss/nanomsg/examples((HEAD detached at 1.1.0)) $ ./out/zdb barrel tcp://127.0.0.1:5555 'hello'
BARREL: SENDING "hello"
BARREL: SENDING "hello"
BARREL: SENDING "hello"
BARREL: SENDING "hello"
BARREL: SENDING "hello"
ZDB: RECEIVED "hello"
ZDB: RECEIVED "hello"
ZDB: RECEIVED "hello"
ZDB: RECEIVED "hello"
View nanomsg pipeline example output.txt
~/projects/oss/nanomsg/examples((HEAD detached at 1.1.0)) $ ./out/pipeline node1 ipc:///tmp/pipeline.ipc "Hello, World\!"
NODE1: SENDING "Hello, World\!"
NODE0: RECEIVED "Hello, World\!"
~/projects/oss/nanomsg/examples((HEAD detached at 1.1.0)) $ ./out/pipeline node1 ipc:///tmp/pipeline.ipc "Hello, World\!"
NODE1: SENDING "Hello, World\!"
~/projects/oss/nanomsg/examples((HEAD detached at 1.1.0)) $ ./out/pipeline node1 ipc:///tmp/pipeline.ipc "Hello, World\!"
NODE1: SENDING "Hello, World\!"
NODE0: RECEIVED "Hello, World\!"
~/projects/oss/nanomsg/examples((HEAD detached at 1.1.0)) $ ./out/pipeline node1 ipc:///tmp/pipeline.ipc "Hello, World\!"
NODE1: SENDING "Hello, World\!"
@bitmage
bitmage / success.txt
Created April 15, 2017 01:50
I created this Gist with cURL!
@bitmage
bitmage / proxy.yaml
Created March 26, 2017 04:16
kubernetes example deployment
View proxy.yaml
---
kind: Deployment
apiVersion: extensions/v1beta1
metadata:
name: proxy
spec:
replicas: 1
template:
metadata:
name: proxy
@bitmage
bitmage / proxy-service.yaml
Created March 26, 2017 04:11
kubernetes example service
View proxy-service.yaml
---
kind: Service
apiVersion: v1
metadata:
name: proxy-service
spec:
type: LoadBalancer
loadBalancerIP: 99.100.101.102
selector:
app: proxy
@bitmage
bitmage / start.sh
Created February 7, 2017 03:40
Replace ENV variables in an nginx config. Minimal solution - a perl one liner!
View start.sh
#!/bin/sh
perl -pe 's/\$\{([^}]+)\}/defined $ENV{$1} ? $ENV{$1} : die("Missing env variable: $1")/eg' \
< /src/proxy-redirect.conf >/etc/nginx/conf.d/nginx.conf \
&& nginx -g 'daemon off;'
@bitmage
bitmage / source.jl
Created September 28, 2016 04:25
enumeration example
View source.jl
import Base.==
import Base.convert
sources = Set([:given, :self, :old, :neighbor])
immutable Source
s
Source(s) = in(s, sources) ? new(s) : error("Invalid source: $(s). Valid options are: $(sources)")
end
==(l::Source, r::Source) = l.s == r.s