Skip to content

Instantly share code, notes, and snippets.

View hugosenari's full-sized avatar
🌞

Hugo Sena Ribeiro hugosenari

🌞
View GitHub Profile
@AndersonTorres
AndersonTorres / zig-em-30-minutos.org
Last active April 7, 2024 01:47
Zig em 30 Minutos (Tradução)
@thejustinwalsh
thejustinwalsh / git-secret-keybase.sh
Last active November 24, 2022 21:11
Using Keybase.io with git-secret
# install git secret (pick one)
brew install git-secret
sudo apt-get install git-secret
# Import keys into gpg from keybase
export GPG_TTY=$(tty) # Required for passphrase entry on WSL2 and MacOS
keybase pgp export | gpg --import
keybase pgp export --secret | bash -c "gpg --import --allow-secret-key-import"
# Import keys from user you wish to add
@kissgyorgy
kissgyorgy / listen.py
Created September 4, 2020 16:37
How to use PostgreSQL's LISTEN/NOTIFY as a simple message queue with psycopg2 and asyncio
import asyncio
import psycopg2
# dbname should be the same for the notifying process
conn = psycopg2.connect(host="localhost", dbname="example", user="example", password="example")
conn.set_isolation_level(psycopg2.extensions.ISOLATION_LEVEL_AUTOCOMMIT)
cursor = conn.cursor()
cursor.execute(f"LISTEN match_updates;")
@CMCDragonkai
CMCDragonkai / nix_inputs.md
Last active April 12, 2024 09:29
Understanding Nix Inputs #nix

Understanding Nix Inputs

Every Nix derivation produces a Nix store output that has 3 things:

  • Executables
  • Libraries
  • Data

Executables are always exported using the PATH environment variable. This is pretty much automatic.

@soofaloofa
soofaloofa / Collection+JSON
Last active October 20, 2023 19:21 — forked from soofaloofa-zz/ On choosing a hypermedia type
On choosing a hypermedia type for your API - HAL, JSON-LD, Collection+JSON, SIREN, Oh My!
GET https://api.example.com/player/1234567890
{
"collection": {
"version": "1.0",
"href": "https://api.example.com/player",
"items": [
{
"href": "https://api.example.com/player/1234567890",
"data": [
{"name": "playerId", "value": "1234567890", "prompt": "Identifier"},

Libuv and libev, two I/O libraries with similar names, recently had the privilege to use both libraries to write something. Now let's talk about my own subjective expression of common and different points.

The topic of high-performance network programming has been discussed. Asynchronous, asynchronous, or asynchronous. Whether it is epoll or kqueue, it is always indispensable to the asynchronous topic.

Libuv is asynchronous, and libev is synchronous multiplexing IO multiplexing.

Libev is a simple encapsulation of system I/O reuse. Basically, it solves the problem of different APIs between epoll and kqueuq. Ensure that programs written using livev's API can run on most *nix platforms. However, the disadvantages of libev are also obvious. Because it basically just encapsulates the Event Library, it is inconvenient to use. For example, accept(3) requires manual setnonblocking after connection. EAGAIN, EWOULDBLOCK, and EINTER need to be detected when reading from a socket. This is a

@GULPF
GULPF / stats.txt
Created April 28, 2018 22:05
Nim stdlib usage for top 1000 starred GitHub projects
Number of files that imports the module (~15000 files total)
1 oswalkdir
1 rstgen
1 ftpclient
1 distros
1 strmisc
2 rlocks
2 lenientops
2 unidecode
3 httpserver
@vvavrychuk
vvavrychuk / connman_cisco_anyconnect.rst
Last active August 5, 2022 03:44
Connecting to Cisco AnyConnect VPN using connman

It is possible to connect to Cisco AnyConnect VPN using connman.

First of all connman-vpn should be installed:

apt install connman connman-vpn
systemctl disable NetworkManager

Later is required because it is not possible to completely remove NetworkManager because too many packages depend on it.

@egmontkob
egmontkob / Hyperlinks_in_Terminal_Emulators.md
Last active May 3, 2024 11:35
Hyperlinks in Terminal Emulators
@zacharycarter
zacharycarter / wclwn.md
Last active March 12, 2024 12:45
Binding to C Libraries with Nim