Skip to content

Instantly share code, notes, and snippets.

🎯
Focusing

Mario Colque colcodev

🎯
Focusing
Block or report user

Report or block colcodev

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@colcodev
colcodev / docker-npm.js
Last active Jul 7, 2018 — forked from jokeyrhyme/docker-npm.js
execute `npm` within a Docker container, within the host's working directory
View docker-npm.js
// ideal for use with AWS Lambda and native Node.js modules
// requires Docker: https://docs.docker.com/engine/installation/
/*
Usage:
node docker-npm.js install
node docker-npm.js rebuild
*/
@colcodev
colcodev / RunAProxyOnAmazonEC2VPC.md
Created Dec 3, 2017 — forked from webinista/RunAProxyOnAmazonEC2VPC.md
Create a proxy server on an Amazon EC2 (VPC) instance
View RunAProxyOnAmazonEC2VPC.md

This will create a proxy server in whatever your availability zone your VPC is in. For me, that's us-east-1b. For you, that may be something different. Steps 10+ should more or less work regardless of your provider since those steps cover the setup and configuration of TinyProxy.

  1. Click the Launch Instance button.
  2. Choose Ubuntu Server 14.04 LTS (HVM), SSD Volume Type. This isn't strictly necessary. If you choose another OS, check its documentation for how to install new packages.
  3. On the Choose an Instance Type screen, select t2.micro. It's Free Tier eligible.
  4. Click the Next: ... buttons until you reach the Configure Security Group screen.
    • You may wish to reduce the amount of storage on the Add Storage screen. This is optional.
    • You may wish to add a tag on the Tag Instance screen. This is also optional.
  5. On the Configure Security Group screen:
    • Select Create a new security group.
@colcodev
colcodev / mongoose-connection-options.js
Created Apr 6, 2017
mLab recommended mongoose connection options. More supported connections for the underlying Node Native driver can be found here: http://mongodb.github.io/node-mongodb-native/
View mongoose-connection-options.js
// mongoose 4.3.x
var mongoose = require('mongoose');
/*
* Mongoose by default sets the auto_reconnect option to true.
* We recommend setting socket options at both the server and replica set level.
* We recommend a 30 second connection timeout because it allows for
* plenty of time in most operating environments.
*/
var options = { server: { socketOptions: { keepAlive: 300000, connectTimeoutMS: 30000 } },
@colcodev
colcodev / README.md
Created Nov 25, 2016 — forked from dominikwilkowski/README.md
Ubuntu 16.04 setup with NGINX http/2 and letsencrypt
View README.md

Intro

This is a basic collection of things I do when setting up a new headless ubuntu machine as a webserver. Following the steps below should give you a reasonable secure server with HTTP/2 support (including ALPN in chrome) and the fast NGINX server. I am happy to add things so leave a comment.

Basics

After creating the server (droplet on DigitalOcean) log in with

@colcodev
colcodev / after_res_hooks.js
Created Oct 7, 2016 — forked from pasupulaphani/after_res_hooks.js
Mongoose connection best practices
View after_res_hooks.js
var db = mongoose.connect('mongodb://localhost:27017/DB');
// In middleware
app.use(function (req, res, next) {
// action after response
var afterResponse = function() {
logger.info({req: req}, "End request");
// any other clean ups
View gist:8f4b738679f670ac41dece8b40d37429
# Plain Ol' Node
node --max-old-space-size=1024 app.js # increase to 1gb
node --max-old-space-size=2048 app.js # increase to 2gb
node --max-old-space-size=3072 app.js # increase to 3gb
node --max-old-space-size=4096 app.js # increase to 4gb
node --max-old-space-size=5120 app.js # increase to 5gb
node --max-old-space-size=6144 app.js # increase to 6gb
# For pm2
pm2 start app.js --node-args="--max-old-space-size=1024" # increase to 1gb
View keybase.md

Keybase proof

I hereby claim:

  • I am colkito on github.
  • I am colkito (https://keybase.io/colkito) on keybase.
  • I have a public key whose fingerprint is 99B5 5A51 A065 9A3C 53B9 3DEA F394 55B3 EF35 3424

To claim this, I am signing this object:

@colcodev
colcodev / serverup.sh
Last active Mar 30, 2016
PM2 start with log date
View serverup.sh
NODE_ENV=<environment> pm2 start <server file> --name <app name> --log-date-format 'DD-MM-YYYY HH:mm:ss.SSS';
@colcodev
colcodev / README.md
Created Jan 12, 2016 — forked from jxson/README.md
README.md template
View README.md

Synopsis

At the top of the file there should be a short introduction and/ or overview that explains what the project is. This description should match descriptions added for package managers (Gemspec, package.json, etc.)

Code Example

Show what the library does as concisely as possible, developers should be able to figure out how your project solves their problem by looking at the code example. Make sure the API you are showing off is obvious, and that your code is short and concise.

Motivation

@colcodev
colcodev / gist:7a11d267657d72e07295
Created Jun 4, 2015
Generate android signin key
View gist:7a11d267657d72e07295
keytool -genkey -v -keystore [keystore_name].keystore -alias [alias_name] -keyalg RSA -keysize 2048 -validity 10000
You can’t perform that action at this time.