Skip to content

Instantly share code, notes, and snippets.

@bcomnes
bcomnes / gist:2a873252434f216e7b83
Created March 9, 2016 21:10
go json parsing pattern
12:41 <schmichael> bret: this is a shortcut for creating one-off types for unmarshalling json: x := struct{Foo string `json:"foo"`}{}; json.Unmarshal(data, &x)
@bcomnes
bcomnes / ban-ip
Last active March 23, 2016 23:47
command to ban an IP using sshguard. requires sudo/root
#!/usr/bin/env bash
USAGE="Usage: $0 ipv4-address"
BLACKLISTDB="/var/db/sshguard/blacklist.db"
if [ "$#" == "0" ]; then
echo "$USAGE"
exit 1
fi
@bcomnes
bcomnes / .eslintrc
Last active March 15, 2016 22:50
.eslintrc
{
"parser": "babel-eslint",
"extends": ["standard", "standard-react"],
"env": { "browser": true, "node": true },
"rules": { "no-var": 2 }
}
@bcomnes
bcomnes / git-gpg.md
Last active June 21, 2025 19:42
my version of gpg on the mac
  1. brew install gnupg, pinentry-mac (this includes gpg-agent and pinentry)

  2. Generate a key: $ gpg --gen-key

  3. Take the defaults. Whatevs

  4. Tell gpg-agent to use pinentry-mac:

    $ vim ~/.gnupg/gpg-agent.conf 
    
@bcomnes
bcomnes / keybase.md
Created April 25, 2016 20:17
keybase.md

Keybase proof

I hereby claim:

  • I am bcomnes on github.
  • I am bret (https://keybase.io/bret) on keybase.
  • I have a public key ASBJBZN99sITUk1GqwHTTFKVnUqSJlWGQs62TR76dFQ-awo

To claim this, I am signing this object:

@bcomnes
bcomnes / delete_merged.sh
Created April 30, 2016 01:15
Delete merged branches on git
#!/usr/bin/env bash
git branch -r --merged |
grep origin |
grep -v '>' |
grep -v 'master' |
xargs -L1 |
awk '{sub(/origin\//,"");print}' |
xargs git push origin --delete
10:53 <bret> i like how react/redux works. i don't like the tool chain very much
10:54 <bret> its a good place to start to understand how view systems that take the always re-render strategy like react does
10:54 <bret> there are alternatives that are less documented but more minimal: https://github.com/Raynos/mercury
10:55 <substack> yo-yo or virtual-dom+main-loop are pretty nice alternatives that give you the basic architecture without the toolchain complexity
10:55 <substack> or bloat
10:55 <bret> https://github.com/shama/bel yeah yo yo too
10:55 <minskmaz> yeah my biggest complaint compes from from simple abstractions becoming huge apis
10:56 <substack> minskmaz: yo-yo/bel and virtual-dom/main-loop are basically finished except for bug fixes and extremely minor feature additions
10:56 <minskmaz> substack: I’ll check it out - how is it for 2 way binding ?
10:57 <substack> instead of 2-way binding, I use an event emitter to trigger state transitions
package main
import (
"encoding/base64"
"fmt"
"os"
"strings"
)
const (
firewall {
all-ping enable
broadcast-ping disable
ipv6-receive-redirects disable
ipv6-src-route disable
ip-src-route disable
log-martians enable
name WAN_IN {
default-action drop
description "WAN to internal"
@bcomnes
bcomnes / .gitignore
Last active June 22, 2016 17:15
Testing random-access-http and hypercore
node_modules
*.db
*.mp4