Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / .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 / 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 / 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)
function asyncTest (cb) {
setTimeout(
function () {
console.log('waited 5 seconds')
setTimeout(function () {
console.log('waited 3 seconds')
cb()
}, 3000)
}, 5000)
}
@bcomnes
bcomnes / scuttlebot@.service
Last active May 18, 2019 22:45
scuttlebot.service: /etc/systemd/service/scuttlebot@.service
[Unit]
Description=sbot
[Service]
ExecStart=/usr/local/bin/sbot server --host example.com --blobs.party
# Track https://github.com/ssbc/patchwork/issues/224 for info on --blobs.party
Restart=on-failure
ReadWriteDirectories=/home/%i/.ssb
User=%i
@bcomnes
bcomnes / gist:886d7eb19794db166d40
Created January 7, 2016 20:07
origin branch naming scheme
<onewheelskyward> bret we use well-formed branch names. story/TICKET/(task|bug)/SUBTICKET/something-useful-here

Apple Hardware Test (AHT)

Description

Apple computers ship with a pre-installed suite of hardware diagnostic tools, known as Apple Hardware Test (AHT). In principle you can start them by holding the d key while booting. Newer models support holding option d to load AHT over the internet. Refer to the official Apple documentation for details: Using AHT on Intel-based Macs, Mountain Lion, Mavericks and Yosemite. Apple redesigned the AHT, now called Apple Diagnostics, for Macs introduced after June 2013. Consult the reference codes to interpret the results.

If however, you reinstalled an older computer from scratch, the diagnostic tools might no longer be available. Unless you have the original disks that came with your comput

@bcomnes
bcomnes / os_diff.sh
Last active March 2, 2020 17:54
Run different sh scripts depending on system: http://stackoverflow.com/a/17072017/1287889
#!/bin/bash
if [ "$(uname)" == "Darwin" ]; then
# Do something under Mac OS X platform
elif [ "$(expr substr $(uname -s) 1 5)" == "Linux" ]; then
# Do something under GNU/Linux platform
elif [ "$(expr substr $(uname -s) 1 10)" == "MINGW32_NT" ]; then
# Do something under Windows NT platform
fi