Skip to content

Instantly share code, notes, and snippets.


Mario Colque bycolco

View GitHub Profile
bycolco /
Created Jan 14, 2021 — forked from grenade/
Correct file permissions for ssh keys and config.
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/id_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/github_rsa
ssh-keygen -t rsa -b 4096 -N '' -C "" -f ~/.ssh/mozilla_rsa
bycolco / 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:
node docker-npm.js install
node docker-npm.js rebuild
bycolco /
Created Dec 3, 2017 — forked from webinista/
Create a proxy server on an Amazon EC2 (VPC) instance

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.
bycolco / 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:
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 } },
bycolco /
Created Nov 25, 2016 — forked from dominikwilkowski/
Ubuntu 16.04 setup with NGINX http/2 and letsencrypt


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.


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

bycolco / 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() {{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

Keybase proof

I hereby claim:

  • I am colkito on github.
  • I am 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:

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


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.