Skip to content

Instantly share code, notes, and snippets.


Ricardo Torres rictorres

View GitHub Profile
rictorres /
Last active Mar 2, 2020
VPS performance tests

Using dd

RunAbove Sandbox [ra]

  • 1 core / 2 GB RAM / 20 GB SSD

EC2 Micro [ec]

  • 1 core / 1 GB RAM / 8 GB

Digital Ocean [do]

  • 1 core / 512 MB RAM / 20 GB SSD
rictorres / .htaccess
Created Jul 16, 2012 — forked from necolas/.htaccess
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
View .htaccess
# Filename-based cache busting
# taken from
# This rewrites file names of the form `name.123456.js` to `name.js`
# so that the browser doesn't use the cached version when you have
# updated (but not manually renamed) the file.
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
rictorres / maintenance-mode.conf
Created Sep 11, 2015
nginx maintenance mode
View maintenance-mode.conf
server {
listen 80;
root /var/www/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
... # the rest of your config goes here
rictorres / check-deps.js
Created Mar 1, 2019
check deps ("success" exit code)
View check-deps.js
const npmCheck = require('npm-check')
const chalk = require('chalk')
const stripAnsi = require('strip-ansi')
const _flatten = require('lodash.flatten')
const _compact = require('lodash.compact')
const table = require('text-table')
const emoji = require('node-emoji')
function uppercaseFirstLetter(str) {
return str[0].toUpperCase() + str.substr(1)

JavaScript to Rust Cheat Sheet

The goal of this is to have an easily-scannable reference for the most common syntax idioms in JavaScript and Rust so that programmers most comfortable with JavaScript can quickly get through the syntax differences and feel like they could read and write basic Rust programs.

What do you think? Does this meet its goal? If not, why not?



rictorres /
Created Jun 18, 2018 — forked from cecilemuller/
How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

How to setup Let's Encrypt for Nginx on Ubuntu 18.04 (including IPv6, HTTP/2 and A+ SSL rating)

Virtual hosts

Let's say you want to host domains and

Create folders for their files:

View safe-string-compare.js
'use strict'
const crypto = require('crypto')
* Do a constant time string comparison. Always compare the complete strings
* against each other to get a constant time. This method does not short-cut
* if the two string's length differs.
* @param {string} a
rictorres / headerfooter.js
Created Nov 19, 2014
A simple way of rendering page headers/footers using
View headerfooter.js
var phantom = require('node-phantom');
phantom.create(function (ph) {
ph.createPage(function (page) {"", function (status) {
var paperConfig = {
format: 'A4',
orientation: 'portrait',
border: '1cm',
rictorres /
Last active Apr 14, 2017
getting ssl with certbot

Free SSL with Certbot on Ubuntu

1. install certbot

sudo add-apt-repository ppa:certbot/certbot

2. obtain a cert

certbot certonly --standalone --email EMAIL -d -d
View mysql-es6.js
'use strict';
const mysql = require('mysql');
const Prom = require('bluebird');
let pool = mysql.createPool({
host: 'localhost',