Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View rictorres's full-sized avatar
💅
startuppin'

Ricardo Torres rictorres

💅
startuppin'
View GitHub Profile
// Simplest Lambda URL test
package main
import (
"context"
"fmt"
"github.com/aws/aws-lambda-go/events"
"github.com/aws/aws-lambda-go/lambda"
IGNORE_FILE=$([ -f .eslintignore ] && echo ".eslintignore" || echo ".gitignore")
ESLINT_REPORT=$(echo "npx eslint . --cache=true --ignore-path=$IGNORE_FILE -f json || true")
echo $ESLINT_REPORT
@rictorres
rictorres / vps-test-dd.md
Last active March 2, 2020 05:04
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
rictorres / .htaccess
Created July 16, 2012 21:27 — forked from necolas/.htaccess
Simple, quick way to concatenate, minify, and version static files in a Wordpress theme
# Filename-based cache busting
# taken from https://github.com/h5bp/html5-boilerplate/
# 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
rictorres / maintenance-mode.conf
Created September 11, 2015 10:26
nginx maintenance mode
server {
listen 80;
server_name mysite.com;
root /var/www/mysite.com/;
location / {
if (-f $document_root/maintenance.html) {
return 503;
}
... # the rest of your config goes here
@rictorres
rictorres / check-deps.js
Created March 1, 2019 16:23
check deps ("success" exit code)
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?

Variables

JavaScript:

@rictorres
rictorres / letsencrypt_2018.md
Created June 18, 2018 20:45 — forked from cecilemuller/letsencrypt_2020.md
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 first.com and second.com.

Create folders for their files:

'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
rictorres / headerfooter.js
Created November 19, 2014 18:04
A simple way of rendering page headers/footers using https://github.com/sgentle/phantomjs-node
var phantom = require('node-phantom');
phantom.create(function (ph) {
ph.createPage(function (page) {
page.open("http://www.google.com", function (status) {
var paperConfig = {
format: 'A4',
orientation: 'portrait',
border: '1cm',