Skip to content

Instantly share code, notes, and snippets.

View joseluisq's full-sized avatar

Jose Quintana joseluisq

View GitHub Profile
@joseluisq
joseluisq / main.rs
Created February 10, 2021 22:23 — forked from lu4nm3/main.rs
Tokio Async: Concurrent vs Parallel
use futures::StreamExt;
use std::error::Error;
use tokio;
use tokio::macros::support::Pin;
use tokio::prelude::*;
use tokio::time::{Duration, Instant};
pub fn main() -> Result<(), Box<dyn std::error::Error>> {
let mut multi_threaded_runtime = tokio::runtime::Builder::new()
.threaded_scheduler()
@joseluisq
joseluisq / slugify.js
Last active August 3, 2023 17:21 — forked from mathewbyrne/slugify.js
Javascript Slugify
function slugify (text, ampersand = 'and') {
const a = 'àáäâèéëêìíïîòóöôùúüûñçßÿỳýœæŕśńṕẃǵǹḿǘẍźḧ'
const b = 'aaaaeeeeiiiioooouuuuncsyyyoarsnpwgnmuxzh'
const p = new RegExp(a.split('').join('|'), 'g')
return text.toString().toLowerCase()
.replace(/[\s_]+/g, '-') // Replace whitespace and underscore with single hyphen
.replace(p, c =>
b.charAt(a.indexOf(c))) // Replace special chars
.replace(/&/g, `-${ampersand}-`) // Replace ampersand with custom word
@joseluisq
joseluisq / List of in-browser VMs.md
Created June 9, 2023 22:22 — forked from SMUsamaShah/List of in-browser VMs.md
List of Javascript based virtual machines running in browser
@joseluisq
joseluisq / json.lua
Created October 18, 2022 20:17 — forked from tejaskokje/json.lua
LUA script to dump JSON output from wrk/wrk2
-- example reporting script which demonstrates a custom
-- done() function that prints results as JSON
done = function(summary, latency, requests)
io.write("\nJSON Output:\n")
io.write("{\n")
io.write(string.format("\t\"requests\": %d,\n", summary.requests))
io.write(string.format("\t\"duration_in_microseconds\": %0.2f,\n", summary.duration))
io.write(string.format("\t\"bytes\": %d,\n", summary.bytes))
io.write(string.format("\t\"requests_per_sec\": %0.2f,\n", (summary.requests/summary.duration)*1e6))
@joseluisq
joseluisq / 0readme.md
Last active July 19, 2022 20:20 — forked from plentz/nginx.conf
Best Nginx Configuration For Security

Best Nginx Configuration For Security

To generate your dhparam.pem file, run in the terminal

$ openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@joseluisq
joseluisq / generators-vs-asyncawait-vs-native-promises.js
Last active April 26, 2021 11:52 — forked from netroy/generators-vs-asyncawait-vs-native-promises.js
Native Promises vs Generators vs Async/Await Performance vs Bluebird Promises
const Benchmark = require('benchmark')
const co = require('co')
const bluebird = require('bluebird')
const suite = new Benchmark.Suite
suite
.add('co generators', {
defer: true,
fn: deferred => {
@joseluisq
joseluisq / install-comodo-ssl-cert-for-nginx.rst
Created June 14, 2016 02:23 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@joseluisq
joseluisq / renew-gpgkey.md
Created September 2, 2020 21:55 — forked from krisleech/renew-gpgkey.md
Renew Expired GPG key

Renew GPG key

Given that your key has expired.

$ gpg --list-keys
$ gpg --edit-key KEYID

Use the expire command to set a new expire date:

@joseluisq
joseluisq / dotenv.sh
Last active February 25, 2020 10:55 — forked from mihow/load_dotenv.sh
Load environment variables from a .env file from a Bash shell script
#!/usr/bin/env bash
set -e
set -u
if [ -f .env ]; then
export $(cat .env | xargs)
else
echo ".env file not found"
fi