Skip to content

Instantly share code, notes, and snippets.

@lcustodio
lcustodio / ssh_key.tf
Created August 12, 2020 09:44 — forked from irvingpop/ssh_key.tf
Terraform external data source example - dynamic SSH key generation
# ssh key generator data source expects the below 3 inputs, and produces 3 outputs for use:
# "${data.external.ssh_key_generator.result.public_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key}" (contents)
# "${data.external.ssh_key_generator.result.private_key_file}" (path)
data "external" "ssh_key_generator" {
program = ["bash", "${path.root}/../ssh_key_generator.sh"]
query = {
customer_name = "${var.customer_name}"
customer_group = "${var.customer_group}"
@lcustodio
lcustodio / hashmap.R
Created December 1, 2019 21:49
R Hashmap
# https://rnotebook.io/anon/ae2ac79d0d10d6f6/notebooks/hashmap.ipynb
library(hash)
h <- hash()
a <- matrix(1:4, nrow = 12, ncol = 3)
print(a)
# has.key("4",h)
@lcustodio
lcustodio / Mac OSX Setup - Brew
Created January 21, 2019 00:09 — forked from jbelke/Mac OSX Setup - Brew
Mac OSX Setup - Brew and Cask
# Get Sudo.
if [ $EUID != 0 ]; then
sudo "$0" "$@"
exit $?
fi
# Install Xcode first - https://itunes.apple.com/us/app/xcode/id497799835?ls=1&mt=12
# Install Xcode command line tools.
xcode-select --install
@lcustodio
lcustodio / clear-docker.sh
Created December 21, 2017 16:56
Clear docker volumes
docker system prune -a --volumes
@lcustodio
lcustodio / GIF-Screencast-OSX.md
Created December 12, 2017 10:22 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@lcustodio
lcustodio / inspect-node-in-chrome.sh
Created November 27, 2017 10:36
Debug Node into Chrome
#NiM - Node.js V8 --inspector Manager (NiM)
#https://chrome.google.com/webstore/detail/nodejs-v8-inspector-manag/gnhhdgbaldcilmgcpfddgdbkhjohddkj?hl=en
node --inspect-brk 01-hello.js
@lcustodio
lcustodio / api-discussion.md
Last active October 25, 2017 12:50
Api discussion

Option 1

POST

{
  "command": "SET_PROCESS_THRESHOLD",
  "parameters": {
  	"processName": "New Vacation Request",
    "newTargetDurationInMillis": "NULL | 0"
 }
@lcustodio
lcustodio / container.js
Created September 16, 2017 12:24
Component wrapper to centralize blog-like content
import React from "react"
export default ({ children }) =>
<div style={{ margin: "3rem auto", maxWidth: 600 }}>
{children}
</div>
@lcustodio
lcustodio / destructuring.js
Created July 10, 2017 12:06 — forked from mikaelbr/destructuring.js
Several demos and usages for ES6 destructuring. Runnable demos and slides about the same topic: http://git.mikaelb.net/presentations/bartjs/destructuring
// === Arrays
var [a, b] = [1, 2];
console.log(a, b);
//=> 1 2
// Use from functions, only select from pattern
var foo = () => [1, 2, 3];
@lcustodio
lcustodio / measures.js
Created September 7, 2016 20:50
Node processing time measurement tools
const arrayOfObjects = [
{name: 'A', level: 5},
{name: 'B', level: 10},
{name: 'C', level: 15},
{name: 'D', level: 20},
{name: 'E', level: 25},
{name: '-', level: 0}
];
let cloneArrayA = arrayOfObjects.slice();