Skip to content

Instantly share code, notes, and snippets.

View soltrinox's full-sized avatar
🤖
Building Cybernetic Systems

Mr. Rosario soltrinox

🤖
Building Cybernetic Systems
View GitHub Profile
@soltrinox
soltrinox / 0_reuse_code.js
Last active August 29, 2015 14:20
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@soltrinox
soltrinox / mongo-autostart-osx.md
Created May 27, 2016 07:30 — forked from subfuzion/mongo-autostart-osx.md
mongo auto start on OS X

Install with Homebrew

brew install mongodb

Set up launchctl to auto start mongod

$ ln -sfv /usr/local/opt/mongodb/*.plist ~/Library/LaunchAgents

/usr/local/opt/mongodb/ is a symlink to /usr/local/Cellar/mongodb/x.y.z (e.g., 2.4.9)

@soltrinox
soltrinox / lex.js
Created June 28, 2020 11:47 — forked from gittimos/lex.js
Using the Lex postText API with AWS Node.js SDK
var AWS = require('aws-sdk');
AWS.config.update({region: 'us-east-1'});
var lexruntime = new AWS.LexRuntime();
var params = {
botAlias: '$LATEST', /* required, has to be '$LATEST' */
botName: 'BOT', /* required, the name of you bot */
inputText: 'TEXT', /* required, your text */
userId: 'USER', /* required, arbitrary identifier */
@soltrinox
soltrinox / README.md
Created February 2, 2021 08:22 — forked from jamesmishra/README.md
Using Terraform to run a docker-compose.yml file directly on an Amazon EC2

Introduction

This is a Hashicorp Terraform module that provisions an AWS EC2 instance for the purpose of running a given docker-compose.yml file.

Usage

# ===== OUR MAGIC DOCKER-COMPOSE.YML FILE HERE =====
# It is also possible to get Terraform to read an external `docker-compose.yml`
# file and load it into this variable.
# We'll be showing off a demo nginx page.
@soltrinox
soltrinox / README.md
Created February 2, 2021 08:22 — forked from jamesmishra/README.md
Using Terraform to run a docker-compose.yml file directly on an Amazon EC2

Introduction

This is a Hashicorp Terraform module that provisions an AWS EC2 instance for the purpose of running a given docker-compose.yml file.

Usage

# ===== OUR MAGIC DOCKER-COMPOSE.YML FILE HERE =====
# It is also possible to get Terraform to read an external `docker-compose.yml`
# file and load it into this variable.
# We'll be showing off a demo nginx page.
@soltrinox
soltrinox / json-to-ndjson.md
Created October 27, 2021 22:23 — forked from bzerangue/json-to-ndjson.md
JSON to NDJSON

NDJSON is a convenient format for storing or streaming structured data that may be processed one record at a time.

  • Each line is a valid JSON value
  • Line separator is ‘\n’

1. Convert JSON to NDJSON?

cat test.json | jq -c '.[]' > testNDJSON.json
@soltrinox
soltrinox / gulp-task.js
Created November 24, 2021 02:38 — forked from timaschew/gulp-task.js
proxy browser-sync server with express and secure everything with basic auth
// just add pass server as your task function
// Start a server with LiveReload to preview the site in
const OUTPUT_PARENT = 'dist'
const OUTPUT_DIRECTORY = OUTPUT_PARENT + '/browser-sync'
function server(done) {
browser.init({
server: {
directory: true,
@soltrinox
soltrinox / ssr_wasm.md
Created May 16, 2022 00:05 — forked from tpmccallum/ssr_wasm.md
How to implements server-side rendering (SSR) using WebAssembly (Wasm)

System

First we update the system (Ubuntu 20)

sudo apt-get update
sudo apt install build-essential
sudo apt-get install npm
npm install svg-url-loader --save-dev
sudo apt install mlocate
extension Array {
subscript(circular index: Int) -> Element? {
var i = index
if i < 0 || isEmpty {
return nil
} else if i > count - 1 {
i = index % count
}
return self[i]
}
from algoliasearch import algoliasearch
import pymongo
from pymongo import MongoClient
import json
client = algoliasearch.Client("Your_Application_ID", 'Your_API_Key')
index = client.init_index('Experiment_1')
MONGODB_URL1 = 'Your_MongoDB_Connection_String'
def move_collection(from_collection):