This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--[[ 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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- 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 ( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package main | |
import ( | |
"crypto/rand" | |
"encoding/base64" | |
"io" | |
"log" | |
"net/http" | |
"time" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CREATE TABLE public.vouchers ( | |
id serial PRIMARY KEY, | |
name text NOT NULL | |
); | |
INSERT INTO vouchers | |
(name) | |
VALUES | |
('Sales'), | |
('Purchase'), |
OlderNewer