Skip to content

Instantly share code, notes, and snippets.

View mikeal's full-sized avatar

Mikeal Rogers mikeal

View GitHub Profile
@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?

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()}
}
)
@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 / package.json
Created April 24, 2018 22:34
Dev script for package.json Vue.js Electron demo.
{ "scripts":
{ "dev": "NODE_ENV=DEV vue-cli-service serve & sleep 5 && NODE_ENV=DEV electron app.js" }
}
@mikeal
mikeal / app.js
Created April 24, 2018 22:32
Application file for Vue.js Electron demo app.
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let url
if (process.env.NODE_ENV === 'DEV') {
url = 'http://localhost:8080/'
} else {
url = `file://${process.cwd()}/dist/index.html`
}
@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
const electron = require('electron')
const app = electron.app
const BrowserWindow = electron.BrowserWindow
let url
if (process.env.NODE_ENV === 'DEV') {
url = 'http://localhost:8080/'
} else {
url = `file://${process.cwd()}/dist/index.html`
}
@mikeal
mikeal / r2.js
Last active April 6, 2025 09:18
HTTP Client Comparison
const r2 = require('r2')
let doJsonThing = async (path, propname) => {
let res = await r2(`http://api.com${path}`).json
return res[propname]
}
@mikeal
mikeal / byteStorage.js
Last active July 18, 2017 22:09
Potentially a better way to design streaming byte storage.
// Byte Storage as Content Addressable Storage
class ByteStorage {
async set (key, value) async {
// Send to temporary storage w/ random UUID
let tmpfile = randomFile()
let p1 = send(value, tmpfile)
// Also stream the value to a hasher
let p2 = send(value, /* streaming hashing function */ )
let values = await Promise.all(p1, p2)