Skip to content

Instantly share code, notes, and snippets.

View inscapist's full-sized avatar

Felx inscapist

  • Penang, Malaysia
View GitHub Profile
@inscapist
inscapist / about.md
Created September 7, 2024 14:59 — forked from mrnugget/about.md
The self-pipe trick in Ruby
A Tree is just a restricted form of a Graph.
Trees have direction (parent / child relationships) and don't contain cycles.
It has only one path between any two vertices
They fit with in the category of Directed Acyclic Graphs (or a DAG).
So Trees are DAGs with the restriction that a child can only have one parent.
Directed Acyclic Graphs is a kind of directed graph that have no cycles.
@inscapist
inscapist / flake.nix
Created May 28, 2024 16:01
Flutter nix flake for android
{
description = "Flutter on NixOS.";
inputs = {
# We disable this to use indirect nixpkgs from android-nixpkgs
# nixpkgs.url = "github:NixOS/nixpkgs/nixpkgs-unstable";
flake-utils.url = "github:numtide/flake-utils";
android-nixpkgs.url = "github:tadfisher/android-nixpkgs";
};
@inscapist
inscapist / docker-compose.yml
Last active April 10, 2024 11:32
Pi-Hole + unbound + tailnet search domain (Void linux)
#version: "3"
# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/
services:
pihole:
container_name: pihole
image: pihole/pihole:latest
network_mode: "host"
# For DHCP it is recommended to remove these ports and instead add: network_mode: "host"
environment:
@inscapist
inscapist / .xinitrc
Last active September 22, 2024 18:35
Nvidia and Xorg on Void Linux
xset r rate 250 60
setxkbmap -option caps:escape
xbacklight -set 10
# paired with `Xft.dpi: 144`
export GDK_DPI_SCALE=1.4
if [ -z "${XDG_RUNTIME_DIR}" ]; then
export XDG_RUNTIME_DIR=/tmp/${USER}-runtime-dir
if [ ! -d "${XDG_RUNTIME_DIR}" ]; then
@inscapist
inscapist / qrgen.nim
Created July 12, 2023 15:19
QR code generator using Nim
import QRgen
import QRgen/renderer
import pkg/[pixie]
import os
# Create a new QR code
let qr = newQR("https://github.com/aruZeta/QRgen", ecLevel=qrECH)
# Generate the QR code
@inscapist
inscapist / trigger.sql
Created May 2, 2023 08:38
Postgres trigger for all table changes (inserts, updates)
CREATE TABLE audit_log (
id SERIAL PRIMARY KEY,
schema_name TEXT NOT NULL,
table_name TEXT NOT NULL,
operation CHAR(1) NOT NULL,
new_data JSONB,
old_data JSONB,
changed_at TIMESTAMP NOT NULL,
changed_by TEXT
);
@inscapist
inscapist / ANSI.md
Created November 3, 2022 14:46 — forked from fnky/ANSI.md
ANSI Escape Codes

ANSI Escape Sequences

Standard escape codes are prefixed with Escape:

  • Ctrl-Key: ^[
  • Octal: \033
  • Unicode: \u001b
  • Hexadecimal: \x1B
  • Decimal: 27
@inscapist
inscapist / fixpoint.nix
Created October 21, 2022 14:53
Fixpoint
{ lib, ... }:
rec {
# Compute the fixed point of the given function `f`, which is usually an
# attribute set that expects its final, non-recursive representation as an
# argument:
#
# f = self: { foo = "foo"; bar = "bar"; foobar = self.foo + self.bar; }
#
# Nix evaluates this recursion until all references to `self` have been
# resolved. At that point, the final result is returned and `f x = x` holds:
@inscapist
inscapist / openssl.zsh
Last active October 20, 2022 02:28
Openssl helper functions (WIP)
# args:
# $1. server_name assuming SNI (eg. sub.domain.com)
# $2. endpoint (eg. IP_ADDR:8443 or sub.domain.com:443)
function tlscert-check() {
echo | \
openssl s_client -servername $1 -connect $2 2>/dev/null | \
openssl x509 -text -noout
}
function tlscert-list-kube() {