Skip to content

Instantly share code, notes, and snippets.

View OR13's full-sized avatar
💭
...

Orie Steele OR13

💭
...
View GitHub Profile
@OR13
OR13 / TransmuteCLI.md
Last active July 9, 2017 02:49
Transmute CLI Commands
$ npm run transmute -- ipfs deploy --env local --target ./cli/mock
$ npm run transmute eventstore create
$ npm run transmute -- eventstore permissions --contractAddress 0x1cc9bbbef5918672997dffe449bd71b0eb44fe37
$ npm run transmute -- eventstore grant --contractAddress 0xe2c2f8a71100dcf98815d66350a269f6b781d832 --g admin,write,create:any,"['*']"
$ npm run transmute -- eventstore can --contractAddress 0xe2c2f8a71100dcf98815d66350a269f6b781d832 --q admin,create:any,event

@OR13
OR13 / canRoleActionResource.js
Created July 9, 2017 02:44
canRoleActionResource
describe('canRoleActionResource(role, action, resource) congruity to can(role).action(resource)', () => {
it('for defined permissions', async () => {
// We start by granting an admin create:any for event store
let grantAdminCreateAnyEventStore = { role: 'admin', resource: 'grant', action: 'create:any', attributes: ['*'] }
ac.setGrants([grantAdminCreateAnyEventStore])
// A defined permission in Node
let acAdminCreateAnyEventStorePerm = ac.can('admin').createAny('grant')
assert(acAdminCreateAnyEventStorePerm.granted, "expect admin can create any grant")
// Now we do the same in Ethereum
let tx = await tac.setGrant('admin', 'grant', 'create:any', ['*'], {
@OR13
OR13 / AccessControl.js
Created July 9, 2017 02:42
AccessControl
var ac = new AccessControl();
ac.grant('user') // define new or modify existing role. also takes an array.
.createOwn('video') // equivalent to .createOwn('video', ['*'])
.deleteOwn('video')
.readAny('video')
.grant('admin') // switch to another role without breaking the chain
.extend('user') // inherit role capabilities. also takes an array
.updateAny('video', ['title']) // explicitly defined attributes
.deleteAny('video');
@OR13
OR13 / EsEventStruct.sol
Created July 9, 2017 02:35
EsEventStruct.sol
struct EsEventStruct {
address TxOrigin;
uint Created;
bytes32 EventType; // Event Type + Version
bytes1 KeyType; // A — Address, U — UInt, B — Bytes32, X — Bytes32 (ascii)
bytes1 ValueType; // A — Address, U — UInt, B — Bytes32, X — Bytes32 (ascii)
bytes32 Key; // Key
bytes32 Value; // Value
}
@OR13
OR13 / demo.js
Last active August 14, 2017 02:05
Spam Slack
window.setInterval(function(){
var msg = 'virus ' + Math.random();
// make sure the command does not have a confirmation step... like giphy does
// msg = @user ... etc...
document.getElementsByClassName('ql-editor')[0].innerHTML = '<p>' + msg + '</p>'
window.TS.view.submit();
}, 1 * 1000);
https://www.youtube.com/watch?v=w_yS_bbv0CQ
https://www.youtube.com/watch?v=uJaBhnrvzJE
@OR13
OR13 / bot_brains_list.txt
Last active December 27, 2016 18:16
Bot Brains
https://dev.havenondemand.com/apis
https://cloud.google.com/natural-language/
https://recast.ai/
https://www.luis.ai/
https://api.ai/
https://howdy.ai/botkit/
https://github.com/hackerkid/bots
http://linkeddatafragments.org/
@OR13
OR13 / demo.js
Created November 8, 2016 04:34
Web3 Signatures + ECRecover
var Web3 = require('web3');
var utils = require('ethereumjs-util');
var web3 = new Web3();
var defaultProvider = new web3.providers.HttpProvider('http://localhost:8545');
web3.setProvider(defaultProvider);
var account_address = web3.eth.accounts[0];
@OR13
OR13 / troll.sh
Last active October 13, 2016 14:15
Troll
while true; do say "troll"; sleep 2; done