Setup One: Buy a Mac if you don't have one.
Setup Two: Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Setup Three:
Setup One: Buy a Mac if you don't have one.
Setup Two: Install Homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Setup Three:
#!/usr/bin/env bash | |
# Must be run on an Amazon Linux AMI that matches AWS Lambda's runtime which can be found at: | |
# https://docs.aws.amazon.com/lambda/latest/dg/current-supported-versions.html | |
# | |
# As of May 21, 2019, this is: | |
# Amazon Linux AMI 2018.03.0 (ami-0756fbca465a59a30) | |
# | |
# You need to prepend PATH with the folder containing these binaries in your Lambda function | |
# to ensure these newer binaries are used. |
const crypto = require('crypto'); | |
const algorithm = 'aes-256-ctr'; | |
let key = 'MySuperSecretKey'; | |
key = crypto.createHash('sha256').update(String(key)).digest('base64').substr(0, 32); | |
const encrypt = (buffer) => { | |
// Create an initialization vector | |
const iv = crypto.randomBytes(16); | |
// Create a new cipher using the algorithm, key, and iv | |
const cipher = crypto.createCipheriv(algorithm, key, iv); |
/* | |
* AWS Sdk KMS spike: (assuming node v6.6+) | |
* 1 - Create master key at KMS | |
* 2 - Copy alias or ARN | |
* 3 - run this i.e. | |
* $ node spike.js KEY_ALIAS YOUR_PLAINTEXT_TO_ENCRYPT | |
*/ | |
const AWS = require('aws-sdk'); | |
// aws-sdk is not reading my region info so i'll have to set it here |
var crypto = require('crypto') | |
, fs = require('fs') | |
// Algorithm depends on availability of OpenSSL on platform | |
// Another algorithms: 'sha1', 'md5', 'sha256', 'sha512' ... | |
var algorithm = 'sha1' | |
, shasum = crypto.createHash(algorithm) | |
// Updating shasum with file content | |
var filename = __dirname + "/anything.txt" |
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>HMAC-SHA256 Example</title> | |
</head> | |
<body> | |
<script src="http://crypto.stanford.edu/sjcl/sjcl.js"></script> | |
<script> | |
var sharedSecret, query, signature, hmac, xhr; |
#!/bin/bash | |
PASS=`pwgen -s 40 1` | |
mysql -uroot <<MYSQL_SCRIPT | |
CREATE DATABASE $1; | |
CREATE USER '$1'@'localhost' IDENTIFIED BY '$PASS'; | |
GRANT ALL PRIVILEGES ON $1.* TO '$1'@'localhost'; | |
FLUSH PRIVILEGES; | |
MYSQL_SCRIPT |
Download Google Drive files with WGET | |
Example Google Drive download link: | |
https://docs.google.com/open?id=[ID] | |
To download the file with WGET you need to use this link: | |
https://googledrive.com/host/[ID] | |
Example WGET command: |
#!/bin/bash | |
# bash generate random alphanumeric string | |
# | |
# bash generate random 32 character alphanumeric string (upper and lowercase) and | |
NEW_UUID=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1) | |
# bash generate random 32 character alphanumeric string (lowercase only) | |
cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 32 | head -n 1 |
#!/bin/bash | |
##################################################### | |
# Name: Bash CheatSheet for Mac OSX | |
# | |
# A little overlook of the Bash basics | |
# | |
# Usage: | |
# | |
# Author: J. Le Coupanec | |
# Date: 2014/11/04 |