Skip to content

Instantly share code, notes, and snippets.

View blahah's full-sized avatar

Rik blahah

View GitHub Profile
@blahah
blahah / public_domain_for_code.md
Last active July 9, 2017 07:12
WIP Public domain dedication of code/creative works - reading list + references
@blahah
blahah / resources.md
Created July 6, 2017 21:35
resources for sciencefair datasource creation (WIP)
@blahah
blahah / instructions.md
Last active April 18, 2018 21:24
Help diagnose ScienceFair connectivity issues: instructions

Run a simple test suite

npm install -g dat-test
dat-test

Test your basic p2p connecitvity

@blahah
blahah / err.txt
Created June 17, 2017 16:10
sodium native osx 10.10.1 error
Error: dlopen(/Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/node-51.node, 1): Library not loaded: @loader_path/libsodium.dylib
Referenced from: /Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/node-51.node
Reason: no suitable image found. Did find:
/Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib: code signature invalid for '/Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib'
/Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib: code signature invalid for '/Applications/ScienceFair.app/Contents/Resources/app/node_modules/sodium-native/prebuilds/darwin-x64/libsodium.dylib'
at Object.Module._extensions..node (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447
@blahah
blahah / prep.sh
Created June 16, 2017 09:05
Prepare node environment for working with poor internet
yarn config set yarn-offline-mirror ~/./npm-packages-offline-cache && \
yarn config set ignore-optional true && \
yarn config set prefer-offline true && \
yarn config set yarn-offline-mirror-pruning true
npm config set cache-min Infinity
@blahah
blahah / ggplot.R
Created June 8, 2017 15:04
ggplot2 data exploration
library(ggplot2)
install.packages('hexbin')
cars <- mtcars
cars$car <- rownames(mtcars)
cars <- cars[with(cars, order(hp)), ]
cars$car <- factor(cars$car, levels = cars$car)
cars$cyl[cars$cyl == 4] <- '4 cylinders'
cars$cyl[cars$cyl == 6] <- '6 cylinders'
cars$cyl[cars$cyl == 8] <- '8 cylinders'
@blahah
blahah / InkBackend.js
Last active May 24, 2017 11:01
InkBackend refactor to get Editoria component
const config = require('config')
const rp = require('request-promise-native')
const Busboy = require('busboy')
const temp = require('temp').track()
const fs = require('fs')
const path = require('path')
const promiseRetry = require('promise-retry')
let inkConfig = config.get('pubsweet-component-ink-backend')
let inkEndpoint = inkConfig.inkEndpoint
@blahah
blahah / install.sh
Last active May 19, 2017 13:08
Recreate EBADF error on windows when syncing files from a hyperdrive
npm init -y
npm install mkdirp blahah/hyperdrive dat-storage folder-walker through2 hyperdiscovery pumpify untildify
@blahah
blahah / 1_basic_browser.js
Last active February 8, 2023 09:04
loading geoJSON examples
// we have a geoJSON file (in this case for Guinea) on the web:
var guinea = 'https://raw.githubusercontent.com/johan/world.geo.json/master/countries/GIN.geo.json'
// and we have a function that does something with the geoJSON file:
var handleGeoJSON = function (data) {
// data is the JSON parsed into a JS object
console.log(data)
}
// using jquery (you must have loaded jQuery first) - http://api.jquery.com/jquery.getjson
hephaestus:hypercore rik$ npm run bench
> hypercore@5.11.1 bench /Users/rik/c/mafintosh/hypercore
> cd bench && ./all.sh
> git checkout a54dcf9
# clearing cache
> rm -rf cores