Skip to content

Instantly share code, notes, and snippets.

@bcomnes
bcomnes / client.js
Created October 29, 2015 22:48
reload on socket.io event
var ioClient = require('socket.io-client')
var socket = ioClient()
socket.on('refresh', function(data) {
window.location.reload();
})
@bcomnes
bcomnes / index.html
Last active November 4, 2015 17:53
socket.io example
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Websockets!!!11</title>
</head>
<body>
<button name="button">Click me</button>
<script src="/socket.io/socket.io.js"></script>
<script>
@bcomnes
bcomnes / temp-dir-test.js
Created November 7, 2015 23:21
test with temp dirs
var test = require('tape')
var tmp = require('temporary-directory')
var tempDir
var cleanupTestDir
test('set up temp dir', function (t) {
tmp('bigup', function created (err, dir, cleanup) {
t.error(err, 'temp dir created without error')
cleanupTestDir = cleanup
# /etc/systemd/system/update-ddns.service
[Unit]
Description=Update DDNS
Documentation=https://dns.he.net/docs.html
Wants=network-online.target
After=network-online.target
[Service]
Type=oneshot
ExecStart=/bin/bash /root/update-ddns.sh
@bcomnes
bcomnes / .bash_profile
Last active October 6, 2021 15:38
bashrc utopia
#
# ~/.bash_profile
#
# Do everything in bashrc
[[ -f ~/.bashrc ]] && . ~/.bashrc
@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

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 / 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
@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
function asyncTest (cb) {
setTimeout(
function () {
console.log('waited 5 seconds')
setTimeout(function () {
console.log('waited 3 seconds')
cb()
}, 3000)
}, 5000)
}