Skip to content

Instantly share code, notes, and snippets.

View iSkore's full-sized avatar
Vue + Vuetify + AWS Amplify = Power Overwhelming

Nick Soggin iSkore

Vue + Vuetify + AWS Amplify = Power Overwhelming
View GitHub Profile
@iSkore
iSkore / index.html
Created October 15, 2016 15:28 — forked from stesie/index.html
AWS IoT-based serverless JS-Webapp Pub/Sub demo
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>AWS IoT Pub/Sub Demo</title>
</head>
<body>
<h1>AWS IoT Pub/Sub Demo</h1>
<form>
<button type="button" id="connect">connect!</button>
@iSkore
iSkore / AWSRawRequest.js
Created October 14, 2016 21:52
Example of how to make a request to AWS's API using raw HTTP request in Node.JS
'use strict';
let crypto = require( 'crypto' ),
request = require( 'request' ),
qstr = require( 'querystring' ),
keys = Object.keys,
signString = ( method, endpoint, uri, qs ) => `${method}\n${endpoint}\n${uri}\n${qs}`,
makeString = ( ...args ) => args.join( '' ),
generateHmac = ( signedData, awsSecretKey ) => crypto.createHmac( 'sha256', awsSecretKey ).update( signedData ).digest( 'base64' ),
urlEncode = o => keys( o ).reduce( ( r, k ) => ( r[ encodeURIComponent( k ) ] = encodeURIComponent( o[ k ] ), r ), {} ),
@iSkore
iSkore / ec2setup.md
Last active October 12, 2017 11:35
  • chmod 400 key.pem
  • ssh -i "nick-aws-key.pem" ubuntu@ec2-public-dns.compute-1.amazonaws.com
  • sudo apt-get upgrade
  • sudo apt-get update
  • curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
  • sudo apt-get install -y nodejs
  • sudo apt-get install -y build-essential
  • sudo apt-get install awscli
  • sudo vi /etc/ssh/sshd_config
  • PasswordAuthentication no => PasswordAuthentication yes
@iSkore
iSkore / c-test.c
Last active November 8, 2017 12:58
#include <stdio.h>
int main(int argc, char *argv[]) {
int w = 0;
for( int x = 0; x < 100; x++ ) {
for( int y = 0; y < 100; y++ ) {
for( int z = 0; z < 100; z++ ) {
w += z;
}
@iSkore
iSkore / logging.js
Last active January 24, 2017 19:22
Extremely fast logging system. Put this at the TOP of any script and call `log()` when you're complete.
"use strict";
// Average completion time: 9.57 ms
const [ a, o, ms, s, log ] = ( function * () {
yield * [
( process.hrtime )(),
process.hrtime,
ms => ( ( ms[ 0 ] * 1e9 + ms[ 1 ] ) / 1000000 ),
s => s / 1000,
() => {
@iSkore
iSkore / RandomString.js
Last active September 29, 2016 12:10
Super fast random string generator
const rand = () => {
const a = [
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L',
'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X',
'Y', 'Z', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v',
'w', 'x', 'y', 'z', 0, 1, 2, 3, 4, 5, 6, 7, 8, 9
];
let i = -1;
while ( ++i < 62 ) {
@iSkore
iSkore / RecursivePromise.js
Last active September 28, 2016 19:27
Recursive Promise Resolution
// With Lodash
let resolveAll = P => {
let map = ( pl, next ) => Promise.all( pl.map( p => Promise.resolve( p ).then( next ) ) ),
props = o => {
let pToR = [];
_.map( _.keys( o ), k => pToR.push( Promise.resolve( o[ k ] ).then( v => _.set( o, k, v ) ) ) );
return Promise.all( pToR ).return( o );
},
rNP = o => Promise.resolve( o ).then( o => {
if( _.isArray( o ) ) return map( o, rNP );
@iSkore
iSkore / getAllWithKey.js
Created September 15, 2016 19:09
Get all values for key
function getAllWithKey( o, k ) {
return new Promise( ( res, rej ) => {
let paths = [],
vals = [],
find = obj => {
return new Promise( r => {
let run = oa => _.forEach( oa, ( v, n ) => {
if( _.has( v, k ) ) {
vals.push( v[ k ] );
_.unset( v, paths );
@iSkore
iSkore / tricks.md
Last active September 19, 2016 04:22
Some funny tricks

Forced un-encapsulation

const { resolve } = require( 'path' );

resolve( './path/' );

Object construction & check for lengthy OR statements

@iSkore
iSkore / webstorm.md
Last active September 1, 2016 18:46
WebStorm's a wild animal. Here's how to tame it.

Settings

  • Editor -> Colors & Fonts -> Copy Scheme and change font to Source Code Pro

  • Keymap -> Run -> ⌘-R