Skip to content

Instantly share code, notes, and snippets.

@joseluisq
joseluisq / stash_dropped.md
Last active March 18, 2025 14:49
How to recover a dropped stash in Git?

How to recover a dropped stash in Git?

1. Find the stash commits

git log --graph --oneline --decorate ( git fsck --no-reflog | awk '/dangling commit/ {print $3}' )

This will show you all the commits at the tips of your commit graph which are no longer referenced from any branch or tag – every lost commit, including every stash commit you’ve ever created, will be somewhere in that graph.

@creack
creack / main.go
Created January 7, 2018 17:30 — forked from enricofoltran/main.go
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"fmt"
"log"
"net/http"
"os"
"os/signal"
"strconv"
@enricofoltran
enricofoltran / main.go
Last active April 6, 2025 09:48
A simple golang web server with basic logging, tracing, health check, graceful shutdown and zero dependencies
package main
import (
"context"
"flag"
"fmt"
"log"
"net/http"
"os"
"os/signal"
@joseluisq
joseluisq / asyncawait_calculator.js
Created November 20, 2017 10:43
Async/Await Calculator example using `asyncawait` module
/**
* Async/Await Calculator example
*
* Tested on Node v6
*/
const _async = require('asyncawait/async')
const _await = require('asyncawait/await')
const DELAY = 1000
@tejaskokje
tejaskokje / json.lua
Last active December 6, 2023 09:02
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 / Debugging.md
Last active September 3, 2023 16:54
A simple NodeJS App debugging example in VS Code using Nodemon.

NodeJS debugging in VS Code with Nodemon

A simple NodeJS App debugging example in VS Code using Nodemon.

Note: Feel free to customize .vscode/launch.json and ./nodemon.json files.

Install

yarn add nodemon --dev
@joseluisq
joseluisq / arch_linux_icon.md
Last active May 16, 2023 20:25
How to change Gnome 3+ application grid icon with a custom Arch Linux icon

Papirus-Dark with Arch Linux Icon

How to change Gnome 3+ application grid icon with a custom Arch Linux icon

Before:

Papirus-Dark

After:

@joseluisq
joseluisq / README.md
Last active March 4, 2025 07:27
Install PHP 7 Xdebug in Arch Linux

Install PHP 7 Xdebug in Arch Linux

"Normally", these instructions should be also valid (in similar way) for other Linux distros.

1.- Install Xdebug using pacman:

sudo pacman -Sy xdebug
@joseluisq
joseluisq / date_helper.js
Last active February 27, 2018 08:59
Date utility functions based on `node-time`, `dateFormat` and `date-fns` packages.
const time = require('time')(Date)
const dateFormat = require('dateformat')
const TIMEZONE_DEFAULT = 'UTC'
const MILLISECONDS_IN_MINUTE = 60000
const MILLISECONDS_IN_DAY = 86400000
/**
* Date utility functions based on `node-time`, `dateFormat` and `date-fns` packages.
*
@joseluisq
joseluisq / docker_non_root.md
Created September 12, 2017 16:09
Manage Docker as a non-root user (without sudo)

Manage Docker as a non-root user

The docker daemon binds to a Unix socket instead of a TCP port. By default that Unix socket is owned by the user root and other users can only access it using sudo. The docker daemon always runs as the root user. If you don’t want to use sudo when you use the docker command, create a Unix group called docker and add users to it. When the docker daemon starts, it makes the ownership of the Unix socket read/writable by the docker group.

  • Add the docker group if it doesn't already exist:
sudo groupadd docker