Skip to content

Instantly share code, notes, and snippets.

@serxoz
serxoz / VOID-INSTALL.md
Created June 23, 2023 12:41 — forked from tobi-wan-kenobi/VOID-INSTALL.md
Void Linux installation (NVMe, btrfs, LVM, full disk encryption using LUKS, 2FA-ish, SSD TRIM)

Void Linux installation (NVMe, btrfs, LVM, full disk encryption using LUKS, 2FA-ish, SSD TRIM)

Here's a record of my experiences when setting up Void Linux for the first time, maybe it contains useful information for somebody :-)

Basics

  • Laptop: Lenovo IdeaPad S340
  • Void Linux installer version: 20191109 (x86_64 musl)

Features

@serxoz
serxoz / nginx.conf
Created January 30, 2023 10:56 — forked from plentz/nginx.conf
Best nginx configuration for improved security(and performance)
# to generate your dhparam.pem file, run in the terminal
openssl dhparam -out /etc/nginx/ssl/dhparam.pem 2048
@serxoz
serxoz / post-installation-void-linux-glibc.txt
Last active November 23, 2022 15:28 — forked from bastomiadi/post-installation-void-linux-glibc.txt
Post installation Void Linux (Glibc)
0. Check keyboard layout on /etc/rc.conf
set KEYMAP="es" and TIMEZONE="Europe/Madrid"
1. Update all package system
sudo xbps-install -Suv
2. add non-free repo
sudo xbps-install -Rs void-repo-nonfree
3. Software & utilities
@serxoz
serxoz / sockstat
Created October 26, 2022 10:18
OpenBSD sockstat like script (fstat parser)
#!/bin/ksh
# Since OpenBSD does not have sockstat this script parses the output
# of fstat to print a summary indicating which process is listening on which port
fstat | awk '
BEGIN {
OFS="\t";
}
{
@serxoz
serxoz / python-fork-exemplo.py
Created September 28, 2022 11:37
Exemplo de fork en python
import time
import sys
import os
def fai_cousas():
# Fai cousas durante 10 segundos e logo sae
time.sleep(10)
print("Feito")
sys.exit(0)
@serxoz
serxoz / postgresql-manjaro.md
Created September 23, 2022 19:38 — forked from marcorichetta/postgresql-manjaro.md
Install PostgreSQL on Manjaro and set it up for Django
@serxoz
serxoz / main.go
Created September 21, 2022 08:29 — forked from hnakamur/main.go
A go example to stop a worker goroutine when Ctrl-C is pressed (MIT License)
package main
import (
"fmt"
"os"
"os/signal"
"time"
"golang.org/x/net/context"
)
@serxoz
serxoz / client.go
Created August 1, 2022 23:48 — forked from xjdrew/client.go
golang tls client and server, require and verify certificate in double direction
package main
import (
"crypto/tls"
"crypto/x509"
"flag"
"io"
"io/ioutil"
"log"
"os"
@serxoz
serxoz / gpg-symmetrical-example.py
Created July 14, 2022 08:40
GPG Symmetrical Example
import gnupg
gpg = gnupg.GPG()
# cifrado simétrico
vaca = gpg.encrypt("esto é unha proba", [], symmetric=True, passphrase='1234')
print(vaca.data)
# b'-----BEGIN PGP MESSAGE-----\n\njA0EBwMCPaDu/4KW8In40kYBvzWul1ccpl4+GP4YVZHv4ppEZ3JydNIKPQViMvhO\nIndNIr2/+3dKFqifBQdZQiAr4X3U3R0QKeWbi1XOcGecPoj5L90m\n=dHQ6\n-----END PGP MESSAGE-----\n'
# descifrado
boi = gpg.decrypt(vaca.data, passphrase='1234')
@serxoz
serxoz / gist:b79bed970bacf35f660a12af15c0c55a
Created June 20, 2022 06:56 — forked from yuezhu/gist:47b15b4b8e944221861ccf7d7f5868f5
Generate self-signed certificate for HAProxy
# Generate a unique private key (KEY)
sudo openssl genrsa -out mydomain.key 2048
# Generating a Certificate Signing Request (CSR)
sudo openssl req -new -key mydomain.key -out mydomain.csr
# Creating a Self-Signed Certificate (CRT)
openssl x509 -req -days 365 -in mydomain.csr -signkey mydomain.key -out mydomain.crt
# Append KEY and CRT to mydomain.pem