Skip to content

Instantly share code, notes, and snippets.

View Hiweus's full-sized avatar
🏠
Working from home

Andre Alves Leocadio Hiweus

🏠
Working from home
View GitHub Profile
@Hiweus
Hiweus / consume.js
Last active May 22, 2025 11:51
libsql docker setup
import { createClient } from "@libsql/client";
import crypto from 'node:crypto'
const turso = createClient({
url: "http://127.0.1:8080",
authToken: "...JWT generated from private key consult https://gist.github.com/Hiweus/15e2f94fb831b6ee389a4f21c9b460d6",
})
await turso.execute("create table if not exists user (id integer primary key autoincrement, name TEXT) strict")
@Hiweus
Hiweus / index.cjs
Created May 22, 2025 11:32
Generate ed25519 key par, export and generate expireless jwt
const { generateKeyPairSync, sign } = require('crypto');
const fs = require('fs');
// 1. Gera o par de chaves Ed25519
const { publicKey, privateKey } = generateKeyPairSync('ed25519');
// 2. Extrai chave pΓΊblica crua (32 bytes)
const publicRaw = publicKey.export({ format: 'der', type: 'spki' }).slice(-32);
const publicKeyBase64Url = publicRaw.toString('base64url');
ar3H/5RlnmGqQWUVlSfH5M2PcL0+bY9jw5rnuKEn9hdXZrqlD5U5AUpNp7Pmp2Zi3SRGLAZfJ+tDkYq2u/b/brtT26rLx5fy5bwTa/6OV/md6dfiBYy2u5lbkZ7KqOLNNIDjomC0E8GIiwYTIGoOQLN1KeZvUca1NyvrFNp32X7Z+ylxXlFQF0YYBRG08XBHtPnEiMwnEXG5GCtAzwl4gNEyZC6XE7MLQYfrkouE3TR/nbhoRVq8nl9K79K4/zNS3c0w3mkvYMFQz8nSfaT5qTYXZ2LdhiToVi1CQlA1nJeAmyT6JBWihjyXNRGWykLvaTiM4GvJx7X81RW37N4rBa58NCuUCdn3/uihkM5pLaCXLldNNoKcDZ9cQs4jup0pICp2UruY1Gw7eJki3MKaKc+MVr/Zu3peaNhVhXJuhDfEc73Tu/LmMUQSnQMtT5gWRac5pvqZXmMw9depXs1Ej8TAgM3lsKsbxlhuIbprU5fp2mcR2bLY3tTs2/XW5FHIH9CmtvIQtB3vJyBxwMS58+M9XtP4YtVFiXwNedxmwXQrGqHmwsPlLSIxNXTHi11fVIUPIGs4iSchW0Uk0pjtd/CDO/tB+oy9NTRvooHbPu7b6BPTHvcpS0qIWuC6BybAykeWbV+sxmcojq9eB1wCTh2N2B6NsyXBsu9Vg9K4R0272AWLNpFWhhGs0Y7h91klHVFyg5qgL/6dEwoIcqX8arZXI39TeBaeYUfoeH4+mKbDBzhLu25tuztrhnx6CuPT7WRIIerbyvSiKO9iag3tLoJUuFD3Z9+sf27vlwsxf3/TwxF24YiIl4ssROaHoSkPy4AMuOEslQTtNjASSSK3fK5zHT6IU84CTAT7NG3bGOzK8MFsFyi1wu1nQ1rOQao9idkzqEbFeKKp+2yHWFzt/dwJgNYvl0Drm+EQtfdLgLx6raaxzvjq79I+gEp2vQpF9qPD00fPVAhmvOLN5clyoRAAEbaex4brd0f5/X0CqN4KoKz5/MIzesVjYTTjP2Rf
@Hiweus
Hiweus / README.md
Created February 7, 2025 23:24
Hosting a docker register

Docker register

This command will host a docker register

docker run -d -p 5000:5000 -v ./register/images:/var/lib/registry -v ./certs:/certs -e REGISTRY_HTTP_TLS_CERTIFICATE=/certs/fullchain.pem -e REGISTRY_HTTP_TLS_KEY=/certs/privkey.pem --restart on-failure --name myregistry registry

Build and push

@Hiweus
Hiweus / README.md
Created February 7, 2025 20:22
Lightweight api gateway

Api gateway

Create a api gateway and serve ssl

Configuring localhost ssl

mkcert -install
mkcert "*.local.gd" local.gd
@Hiweus
Hiweus / README.md
Created February 4, 2025 02:26
Issue lets encrypt certificate using dns challenge

Installing dependencies

sudo apt install certbot -y

# Download and install dns plugin for certbot
# Run as root
mkdir -p /tmp/certificate && cd /tmp/certificate
wget https://github.com/joohoi/acme-dns-certbot-joohoi/raw/master/acme-dns-auth.py
# Replace python to python3 executable
@Hiweus
Hiweus / Dockerfile
Created January 24, 2025 01:30
busybox react host
FROM busybox
WORKDIR /app
# Copy React build files
COPY dist/ /app
# Set up the httpd configuration
# Http request will result in 404
# But the response content will be the site, so will render anyway
@Hiweus
Hiweus / README.md
Created December 9, 2024 02:47
bash autocompletion

Autocomplete

bash shell generally handle autocomplete using a specific function, example:

My function

function aa() {
  echo "$@";
 }
@Hiweus
Hiweus / App.css
Last active May 22, 2024 16:57
Example of composite component in react
.card {
background: red;
color: white;
font-weight: 500;
display: flex;
justify-content: space-between;
align-items: center;
width: 900px;
}
@Hiweus
Hiweus / gist:e4f60dfd9de7ec4f99a82c4ff3e3baa1
Created May 4, 2024 13:29 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: πŸ˜„ :smile: πŸ˜† :laughing:
😊 :blush: πŸ˜ƒ :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
πŸ˜† :satisfied: 😁 :grin: πŸ˜‰ :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: πŸ˜€ :grinning:
πŸ˜— :kissing: πŸ˜™ :kissing_smiling_eyes: πŸ˜› :stuck_out_tongue: