Skip to content

Instantly share code, notes, and snippets.

View sdesalas's full-sized avatar
🕹️

Steven de Salas sdesalas

🕹️
View GitHub Profile
@sdesalas
sdesalas / handler.js
Created May 28, 2017 13:44 — forked from jeffrafter/handler.js
Simple HTTP Server and Router in node.js
exports.createHandler = function (method) {
return new Handler(method);
}
Handler = function(method) {
this.process = function(req, res) {
params = null;
return method.apply(this, [req, res, params]);
}
}
@sdesalas
sdesalas / Terraform-Blue-Green-AWS.md
Created June 21, 2017 06:54 — forked from ryan0x44/Terraform-Blue-Green-AWS.md
Blue-Green AWS Auto Scaling Deployments with Terraform

A quick note on how I'm currently handling Blue/Green or A/B deployments with Terraform and AWS EC2 Auto Scaling.

In my particular use case, I want to be able to inspect an AMI deployment manually before disabling the previous deployment.

Hopefully someone finds this useful, and if you have and feedback please leave a comment or email me.

Overview

I build my AMI's using Packer and Ansible.

@sdesalas
sdesalas / readme.md
Created July 18, 2017 15:12 — forked from jobsamuel/readme.md
Run NodeJS as a Service on Ubuntu 14.04 LTS

Run NodeJS as a Service on Ubuntu 14.04 LTS

With Node you can write very fast JavaScript programs serverside. It's pretty easy to install Node, code your program, and run it. But > how do you make it run nicely in the background like a true server?

  • Go to /etc/init/
  • $ sudo vim yourapp.conf
  • Paste script.conf
  • $ sudo start yourapp
  • And when you wanna kill the process $ sudo stop yourapp
@sdesalas
sdesalas / JNI.cpp
Created November 24, 2018 13:31 — forked from Nimrodda/JNI.cpp
Raw JNI with async callbacks
static jclass callbacksClass;
static jobject callbacksInstance;
JNIEXPORT void JNICALL Java_com_example_NativeClass_nativeMethod(JNIEnv* env, jclass callingObject, jobject callbacks)
{
// Cache the Java callbacks instance
callbacksInstance = env->NewGlobalRef(callbacks);
// Cache the Java callbacks class (in case of interface, this will be the concrete implementation class)
jclass objClass = env->GetObjectClass(callbacks);
@sdesalas
sdesalas / index.html
Last active March 28, 2019 16:15 — forked from santiagocodes/index.html
findThePrecious.com MC solution
<!DOCTYPE html>
<html lang="zxx">
<head>
<meta charset="UTF-8">
<title>findThePrecious.com</title>
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<nav>
<ul>
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('How old are you ? ')
process.stdin.on('data', (age) => {
console.log('You are ' + age.trim() + ' years old ')
if (age > 99){
console.log('Too old!!')
} else if (age < 0) {
@sdesalas
sdesalas / quest.js
Last active April 4, 2019 13:25 — forked from evadav/quest.js
My first application Node.JS
process.stdin.resume()
process.stdin.setEncoding('utf8')
console.log('How old are you ? ')
process.stdin.on('data', (age) => {
console.log('you are' + age.trim() +'years old')
if (age > 99){
console.log ('Too old')
} else if (age < 1) {
console.log ('You have not been born yet')
@sdesalas
sdesalas / gandalf.css
Created April 4, 2019 13:34 — forked from evadav/gandalf.css
02 - Give style with CSS
body {
font-family: Arial, Helvetica, sans-serif;
}
.gandalf{
position:relative;
max-width: 420px;
height: 500px;
padding: 40px;
@sdesalas
sdesalas / parse_dotenv.bash
Created March 30, 2020 11:11 — forked from judy2k/parse_dotenv.bash
Parse a .env (dotenv) file directly using BASH
# Pass the env-vars to MYCOMMAND
eval $(egrep -v '^#' .env | xargs) MYCOMMAND
# … or ...
# Export the vars in .env into your shell:
export $(egrep -v '^#' .env | xargs)
@sdesalas
sdesalas / createWallet.js
Created March 5, 2022 16:03 — forked from PraneshASP/createWallet.js
Create a bitcoin wallet with this simple script.
//Import dependencies
const bip32 = require('bip32')
const bip39 = require('bip39')
const bitcoin = require('bitcoinjs-lib')
//Define the network
const network = bitcoin.networks.bitcoin //use networks.testnet for testnet
// Derivation path
const path = `m/49'/0'/0'/0` // Use m/49'/1'/0'/0 for testnet