Skip to content

Instantly share code, notes, and snippets.

View SergioRibera's full-sized avatar
🦀

Sergio Alejandro Ribera Costa SergioRibera

🦀
View GitHub Profile
@numToStr
numToStr / au.lua
Last active August 20, 2023 05:15
Neovim autocmd in lua
--
-- Move this file to your neovim lua runtime path ie. ~/.config/nvim/lua/au.lua
--
local cmd = vim.api.nvim_command
local function autocmd(this, event, spec)
local is_table = type(spec) == 'table'
local pattern = is_table and spec[1] or '*'
local action = is_table and spec[2] or spec
if type(action) == 'function' then
@r0mdau
r0mdau / README.md
Last active December 28, 2023 23:33
Rust Actix vs Rust Hyper vs Go fasthttp vs Go net/http httprouter

Load tests

Injector

wrk is the binary used as injector, always used with these options:

./wrk -t12 -c1000 -d15s http://127.0.0.1:8080/

Results

@Klerith
Klerith / git-alias.md
Last active June 25, 2024 15:25
Useful Git Alias

Log

git config --global alias.lg "log --graph --abbrev-commit --decorate --format=format:'%C(bold blue)%h%C(reset) - %C(bold green)(%ar)%C(reset) %C(white)%s%C(reset) %C(dim white)- %an%C(reset)%C(bold yellow)%d%C(reset)' --all"

Status

git config --global alias.s status --short

Alternativa útil de status

git config --global alias.s status -sb

@Technius
Technius / main.rs
Created April 22, 2019 23:57
Asynchronous process I/O in Rust using tokio
// This code sample needs the dependencies:
// tokio = "0.1"
// tokio-process = "0.2"
use tokio::prelude::*;
use std::process::{Command, Stdio};
use tokio_process::CommandExt;
use std::time::Duration;
fn main() {
@bojanrajkovic
bojanrajkovic / option.cs
Last active March 14, 2024 20:13
Quick and dirty Rust-like Option<T> in C#. Basically untested, use at your own risk!
public static class Option
{
public static Option<T> None<T>() => new None<T>();
public static Option<T> Some<T>(T value) => new Some<T>(value);
}
public class Option<T> : IEquatable<Option<T>>
{
public static Option<T> None => new None<T>();
public bool IsNone => !hasValue;
@thacoon
thacoon / arch-linux-gnome-install
Last active June 24, 2024 10:31
Install a minimal gnome setup and some more useful things
# Install Gnome and some other useful thins
# The official installation guide (https://wiki.archlinux.org/index.php/Installation_Guide) contains a more verbose description.
# And based on https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger
# I have just copied commands from https://wiki.archlinux.de/title/Anleitung_f%C3%BCr_Einsteiger#Weitere_notwendige_Dienste
# It's just to have it with one view after doing a [fresh installation](https://gist.github.com/thacoon/05d5a39606ab554455d6713e8a714b2c)
# Some useful services
pacman -S acpid ntp dbus cups cronie
@GabLeRoux
GabLeRoux / archlinux-virtualbox.sh
Last active November 27, 2023 12:22
Virtualbox archlinux notes
# sudo /sbin/rcvboxdrv -h
# Unloading modules:
# Loading modules: modprobe: FATAL: Module vboxnetadp not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxnetflt not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxpci not found in directory /lib/modules/4.4.3-1-ARCH
# modprobe: FATAL: Module vboxdrv not found in directory /lib/modules/4.4.3-1-ARCH
# Solution
# from https://forum.antergos.com/topic/818/can-t-run-my-vitualbox/4
@subfuzion
subfuzion / curl.md
Last active June 29, 2024 16:04
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@ianmariano
ianmariano / genhash
Created December 4, 2014 05:35
generate a base-64 encoded sha-256 password hash with openssl on the command line
# generate an SHA-256 password hash base64 encoded
echo -n "password" | openssl dgst -sha256 -binary | openssl base64
# better yet, use pepper (suffix the password with the pepper)
echo -n "passwordpepper" | openssl dgst -sha256 -binary | openssl base64
# better yet, use salt (prefix the password with the salt)
echo -n "saltpassword" | openssl dgst -sha256 -binary | openssl base64