Skip to content

Instantly share code, notes, and snippets.

Avatar

Carl Youngblood cayblood

View GitHub Profile
@cayblood
cayblood / resize.sh
Created Sep 29, 2020 — forked from wongcyrus/resize.sh
Cloud9 Disk Resize
View resize.sh
#!/bin/bash
# Specify the desired volume size in GiB as a command-line argument. If not specified, default to 20 GiB.
SIZE=${1:-20}
# Get the ID of the environment host Amazon EC2 instance.
INSTANCEID=$(curl http://169.254.169.254/latest/meta-data//instance-id)
# Get the ID of the Amazon EBS volume associated with the instance.
VOLUMEID=$(aws ec2 describe-instances \
View useAmplifyAuth.js
///////////////////////////////////////////////////////////////////////////////
// The code in this source file is licensed under the Creative Commons
// Attribution 4.0 International Public License. License text can be found at
// https://creativecommons.org/licenses/by/4.0/deed.ast. It may be shared and
// used freely for any purpose, as long as author attribution is included with
// the source code.
//
// written by Sophia Brandt
// https://www.rockyourcode.com/custom-react-hook-use-aws-amplify-auth/
///////////////////////////////////////////////////////////////////////////////
View gist:f6a4c01509fe7e54685b8b24a1ae9199
∴ sudo jamf recon
Password:
Retrieving inventory preferences from https://casper.amazon.com:8443/...
Finding extension attributes...
Locating applications...
Locating hard drive information...
Locating accounts...
Locating printers...
Searching path: /System/Applications
Searching path: /Applications
@cayblood
cayblood / basic-chaincode.js
Created Mar 19, 2020
Basic chaincode example
View basic-chaincode.js
'use strict';
const shim = require('fabric-shim');
let Chaincode = class {
async Init(stub) {
console.info('============= Init called =============');
return shim.success();
}
async Invoke(stub) {
View docker-compose-cli.yaml
version: '2'
services:
cli:
container_name: cli
image: hyperledger/fabric-tools:1.2.0
tty: true
environment:
- GOPATH=/opt/gopath
- CORE_VM_ENDPOINT=unix:///host/var/run/docker.sock
- CORE_LOGGING_LEVEL=info # Set logging level to debug for more verbose logging
@cayblood
cayblood / permissions-example.js
Last active Feb 26, 2020
example of how to use hyperledger fabric permissions
View permissions-example.js
'use strict';
const shim = require('fabric-shim');
async function requireRole(stub, role) {
const ClientIdentity = shim.ClientIdentity;
let cid = new ClientIdentity(stub);
if (!cid.assertAttributeValue('role', role))
throw new Error(`Unauthorized access: ${role} required`);
}
@cayblood
cayblood / AMBManagementMachinePolicy.json
Created Feb 26, 2020
Policy attached to fabric client machine role that connects to Amazon Managed Blockchain networks.
View AMBManagementMachinePolicy.json
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "ManageNetworkResources",
"Effect": "Allow",
"Action": [
"managedblockchain:CreateProposal",
"managedblockchain:GetProposal",
"managedblockchain:DeleteMember",
View prompt.bash
# display user@host and current working dir
PS1='\[$(tput setaf 2)\]\u\[$(tput sgr0)\]@\[$(tput setaf 3)\]\h\[$(tput sgr0)\] \w'
# display git info if applicable
PS1=$PS1'\[$(tput setaf 5)\]`if [ "$(vcprompt)" != "" ]; then echo " $(vcprompt | tr -d '"'"'[:space:]'"'"')"; fi`'
# display rvm info if applicable
PS1=$PS1'\[$(tput setaf 1)\] [`if [ "$(~/.rvm/bin/rvm-prompt)" != "" ]; then echo "$(~/.rvm/bin/rvm-prompt)"; fi`]\[$(tput sgr0)\]'
# display nvm info if available
View amb-workshop.md
@cayblood
cayblood / saltaires-deploy.sh
Created Apr 12, 2019
Saltaires static web site deployment script
View saltaires-deploy.sh
#!/bin/bash
# Load RVM into a shell session *as a function*
if [[ -s "$HOME/.rvm/scripts/rvm" ]] ; then
# First try to load from a user install
source "$HOME/.rvm/scripts/rvm"
elif [[ -s "/usr/local/rvm/scripts/rvm" ]] ; then
# Then try to load from a root install
source "/usr/local/rvm/scripts/rvm"
else
You can’t perform that action at this time.