Skip to content

Instantly share code, notes, and snippets.

Avatar
🦀

Jose Quintana joseluisq

🦀
View GitHub Profile
@joseluisq
joseluisq / interfaces
Last active Nov 13, 2022
Alpine Linux auto Ethernet Configuration - /etc/network/interfaces https://wiki.alpinelinux.org/wiki/Configure_Networking
View interfaces
auto eth0
iface lo inet loopback
iface eth0 inet dhcp
@joseluisq
joseluisq / json.lua
Created Oct 18, 2022 — forked from tejaskokje/json.lua
LUA script to dump JSON output from wrk/wrk2
View json.lua
-- 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 / README.md
Last active Sep 26, 2022
How to open in file/line number with VSCode from Hotspot
View README.md

How to open a file/line number with VSCode from Hotspot

  1. Open Hotspot
  2. Settings > Code navigation > Custom...
  3. Then Copy/paste the lines below
/usr/bin/code -g %f:%l:%c
  1. On for example Caller/Callee tab, right click on file location wanted.
  2. Finally, click open in editor
@joseluisq
joseluisq / settings.json
Created Jun 20, 2022
My custom VSCode settings for Mac
View settings.json
{
// ---- Editor ----
"editor.fontFamily": "Fira Code",
"editor.fontSize": 12,
"editor.fontLigatures": true,
"editor.detectIndentation": true,
"editor.wordWrap": "on",
"editor.formatOnSave": false,
"editor.rulers": [
132
View keybase.md

Keybase proof

I hereby claim:

  • I am joseluisq on github.
  • I am joseluisq (https://keybase.io/joseluisq) on keybase.
  • I have a public key ASCqLTIgaAbKLdRO9_EgKnYlH747jhjMPp_qFwFOcklXtgo

To claim this, I am signing this object:

@joseluisq
joseluisq / env.ts
Last active May 10, 2022
Get a Typescript typed environment variable value from `process.env` (NodeJS) with type casting for booleans, strings and numbers
View env.ts
/**
* Return an environment variable typed value from `process.env`.
* It also supports a default value in case of `undefined`.
*
* The function will follow these steps to take a typed value:
* 1. First it will try to get the env value from `process.env`.
* 2. Then if `undefined` then it try with the default environment variable value if defined.
* 3. Otherwise if the default value is `undefined` then it will return the Javascript default values:
* - Boolean: `false`
* - String: `""`
View 40-libinput.conf
# Match on all types of devices but joysticks
#
# If you want to configure your devices, do not copy this file.
# Instead, use a config snippet that contains something like this:
#
# Section "InputClass"
# Identifier "something or other"
# MatchDriver "libinput"
#
# MatchIsTouchpad "on"
@joseluisq
joseluisq / try_files.rs
Created Jun 27, 2021
A simple Nginx `try_files` directive parsing example written in Rust
View try_files.rs
enum Token {
Start,
Middle,
End,
}
/// Parses the Nginx-like `try_files` directive string and returns a vector of tokens.
pub fn parse(val: &str) -> Vec<String> {
let mut kind = Token::Start;
let mut token = String::new();
@joseluisq
joseluisq / response.ts
Created Apr 5, 2021
Una simple convención que representa respuestas de servidor JSON.
View response.ts
/** Representa una respuesta JSON satisfactoria */
interface ResponseOk<T = null> {
success: true
data: T
}
/** Representa una respuesta JSON errónea */
interface ResponseFail<T = null> {
success: false
code: string|number