Skip to content

Instantly share code, notes, and snippets.

View joehand's full-sized avatar
🌳
be like tree

Joe Hand joehand

🌳
be like tree
View GitHub Profile
@joehand
joehand / install-cabal.sh
Last active July 6, 2019 05:18
Basic cabal install
#!/bin/bash
# gets latest cabal release zip for platform and extracts runnable binary into ~/.cabal
# usage: wget -qO- https://raw.githubusercontent.com/cabal-club/cabal-cli/master/bin/install.sh | bash
# based on https://github.com/jpillora/installer/blob/master/scripts/download.sh
CABAL_DIR="$HOME/.cabal/releases"
function cleanup {
rm -rf $CABAL_DIR/tmp.zip > /dev/null
var hyperdrive = require('hyperdrive')
var pump = require('pump')
var fs = require('fs')
var storage = require('dat-storage')
var source = hyperdrive('./source')
source.ready(() => {
var dest = hyperdrive(storage('./dest'), source.key, {
latest: true, sparse: false
@joehand
joehand / application.md
Last active February 15, 2019 02:47
Shuttleworth Fellow Application

Shuttleworth application

Application form: https://www.shuttleworthfoundation.org/apply/form/

Application timelines

  • Application opens: 1 February 2019
  • Application closes: 1 June 2019
  • Applicants notified: 1 July 2019
  • Fellowship start date: 1 September 2019
@joehand
joehand / package-lock.json
Created April 25, 2018 19:13
utp issue when running dat doctor
{
"name": "dat",
"version": "13.10.0",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
"abstract-random-access": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/abstract-random-access/-/abstract-random-access-1.1.2.tgz",
"integrity": "sha1-mo6sj/eYZvP5tLsUQ8p3jxWYrto=",
@joehand
joehand / readme.md
Created March 15, 2018 17:08
live website deployment w/ now + dat

now – Realtime global deployments

Using Dat, we can turn now's realtime deployment into live deployment.

Tutorial

  1. Install dat command line or desktop
  2. Create a new dat with your website files
@joehand
joehand / index.js
Created October 20, 2017 17:51
grab portals via hypercore-archiver
var archiver = require('hypercore-archiver')
var swarm = require('hypercore-archiver/swarm')
var ram = require('random-access-memory')
var hyperdrive = require('hyperdrive')
var discovery = require('hyperdiscovery')
module.exports = function (rotondeKey) {
var portals = archiver('./data', {sparse: true})
swarm(portals)
var tape = require('tape')
var ram = require('random-access-memory')
var hyperdrive = require('..')
tape('sparse read/write 1, passes', function (t) {
var archive = hyperdrive(ram)
archive.on('ready', function () {
var clone = hyperdrive(ram, archive.key, {sparse: true})
archive.writeFile('/hello.txt', 'world', function (err) {
t.error(err, 'no error')
@joehand
joehand / index.js
Last active October 5, 2017 18:52
hyperdrive-http sparse fail
var http = require('http')
var ram = require('random-access-memory')
var hyperdrive = require('hyperdrive')
var serve = require('./serve')
var archive = hyperdrive(ram)
archive.on('ready', function () {
var clone = hyperdrive(ram, archive.key, {sparse: true})
archive.writeFile('/hello.txt', 'world', function (err) {
if (err) console.error(err)
@joehand
joehand / index.js
Created August 31, 2017 19:15
analytics
var fairAnalytics = require('fair-analytics-client-api')
module.exports = analytics
function analytics (state, emitter) {
// create a fa instance
var fa = fairAnalytics({
url: `http://analytics.domain.com` // Fair Analytics server
})
var start = null
@joehand
joehand / error.md
Created April 30, 2017 21:06
memory error for mafintosh
Trace: debugging
    at Pager.get (/Users/joe/node_modules/dat-node/node_modules/memory-pager/index.js:28:32)
    at Bitfield.setByte (/Users/joe/node_modules/dat-node/node_modules/sparse-bitfield/index.js:69:25)
    at setByteNoAlloc (/Users/joe/node_modules/dat-node/node_modules/hypercore/lib/bitfield.js:135:19)
    at Bitfield._expand (/Users/joe/node_modules/dat-node/node_modules/hypercore/lib/bitfield.js:129:14)
    at Bitfield._setIndex (/Users/joe/node_modules/dat-node/node_modules/hypercore/lib/bitfield.js:108:37)
    at Bitfield.set (/Users/joe/node_modules/dat-node/node_modules/hypercore/lib/bitfield.js:69:8)
    at Feed._writeDone (/Users/joe/node_modules/dat-node/node_modules/hypercore/index.js:594:23)
    at ondone (/Users/joe/node_modules/dat-node/node_modules/hypercore/index.js:585:10)