Skip to content

Instantly share code, notes, and snippets.

View flozano's full-sized avatar

Francisco A. Lozano flozano

View GitHub Profile
@TerryE
TerryE / ftpserver.lua
Last active March 21, 2025 17:25
FTP Server Example
--[[ A simple ftp server
This is my implementation of a FTP server using Github user Neronix's
example as inspriration, but as a cleaner Lua implementation that has been
optimised for use in LFS. The coding style adopted here is more similar to
best practice for normal (PC) module implementations, as using LFS enables
me to bias towards clarity of coding over brevity. It includes extra logic
to handle some of the edge case issues more robustly. It also uses a
standard forward reference coding pattern to allow the code to be laid out
in main routine, subroutine order.
@rbreaves
rbreaves / macOS keyboard layout for Linux
Last active March 31, 2024 10:35
Universal macOS keyboard layout for Linux - Applies to All Windows and Apple Keyboards
# permanent apple keyboard keyswap
echo "options hid_apple swap_opt_cmd=1" | sudo tee -a /etc/modprobe.d/hid_apple.conf
update-initramfs -u -k all
# Temporary & instant apple keyboard keyswap
echo '1' | sudo tee -a /sys/module/hid_apple/parameters/swap_opt_cmd
# Windows and Mac keyboards - GUI (Physical Alt is Ctrl, Physical Super is Alt, Physical Ctrl is Super)
setxkbmap -option;setxkbmap -option altwin:ctrl_alt_win
@chrismaes87
chrismaes87 / create-relative-virtualenv
Created September 25, 2019 06:57
bash script to create a relative virtualenv that can be packaged in an rpm
#!/bin/bash
me=$(basename $0)
set -e # exit on error
function print_help {
echo
echo $me - create a virtualenv with relative paths in a certain buildroot and fix the relative path to make it work after install
echo
echo OPTIONS
echo " -h / --help"
@porsager
porsager / housekeeping.sql
Last active November 8, 2021 14:55
Remove all but the latest n rows with group by
-- Simply set the offset to the amount of rows you want to keep. An index of (id, date desc) will make this fast.
delete from some_table st
using (
select distinct
x.id,
x.date
from some_table st1
join lateral (
@jolivares
jolivares / gist:87e68c048e4ed5d78b0c081b97eb1d1f
Created September 12, 2022 13:24
Get ID token thru OpenID Connect
package main
import (
"crypto/rand"
"encoding/base64"
"io"
"log"
"net/http"
"time"
@ak4zh
ak4zh / migration.sql
Created September 22, 2022 08:48
Double Entry Book Keeping with Journals and Voucher
CREATE TABLE public.vouchers (
id serial PRIMARY KEY,
name text NOT NULL
);
INSERT INTO vouchers
(name)
VALUES
('Sales'),
('Purchase'),