Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar
🏠
Working from home

Mikeal Rogers mikeal

🏠
Working from home
View GitHub Profile
@mikeal
mikeal / install.bash
Last active January 28, 2020 03:39
Find and install latest node from source on Ubuntu.
#!/bin/bash
echo "Finding latest version."
VERSION=`curl -s http://nodejs.org/dist/latest/SHASUMS.txt | awk '/node-v/ {print $2}' | head -1 | sed s/node-v// | sed s/-/\ / | awk '{print $1}'`
echo "Preparing to install node-v$VERSION"
url="http://nodejs.org/dist/v"$VERSION"/node-v"$VERSION".tar.gz"
echo "GET" $url
curl $url | tar -zxf -
const gen = require('ipld-schema-gen')
const parse = require('ipld-schema')
const schema = `
type DataLayout map
advanced DataLayout
type Data bytes representation advanced DataLayout
`
const DataLayout = {
testMethod: node => {
@mikeal
mikeal / bunde-size-action.yml
Created August 20, 2019 02:57
What you need to add to your GitHub Action to add bundle size badges to your readme.
- uses: mikeal/bundle-size-action@master
- uses: mikeal/publish-to-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
@mikeal
mikeal / example.js
Created March 11, 2019 17:38
async-ready
class NeedsReady {
constructor () {
this.ready = new Promise(resolve => setTimeout(resolve, 1000))
}
async foo () {
await this.ready
return 'bar'
}
}
@mikeal
mikeal / stateless-interface.js
Created February 27, 2019 17:49
stateless interface example
class Database {
constructor (storage) {
this.count = 0
this.storage = storage
}
async get (cid) {
this.count += 1
return this.storage.get(cid.toBaseEncodedString())
}
async put (block) {
@mikeal
mikeal / script.zsh
Created February 21, 2019 04:04
delete all the aws log streams
aws logs describe-log-streams --log-group-name="/aws/lambda/ghmetrics-staging-get-filter" --query 'logStreams[*].l│··········
ogStreamName' --output table | awk '{print $2}' | grep -v ^$ | while read x; do aws logs delete-log-stream --log-stream-name="$x" --log-group-name="/a│··········
ws/lambda/ghmetrics-staging-get-filter"; done
@mikeal
mikeal / README.md
Last active January 26, 2019 22:56

Does this matter?

@mikeal
mikeal / vue.config.js
Created April 24, 2018 22:39
Vue config file for Electron demo.
module.exports = {
configureWebpack: config => {
if (process.env.NODE_ENV === 'production') {
config.output.publicPath = `${process.cwd()}/dist/`
}
}
}
@mikeal
mikeal / install.sh
Created April 24, 2018 22:28
Install step for Vue.js and Electron
npm install -g @vue/cli
vue create my-project
cd my-project
npm install electron
let myCid = await ipfs.dag.put({name: "Mikeal Rogers"})
let projectsCid = await ipfs.dag.put(
{ title: "A new post!",
content: "Opinions about things!"
author: {'/': myCid.toBaseEncodedString()}
}
)