Skip to content

Instantly share code, notes, and snippets.

View bokwoon95's full-sized avatar
💭
effective. Power لُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗

bokwoon95

💭
effective. Power لُلُصّبُلُلصّبُررً ॣ ॣh ॣ ॣ 冗
View GitHub Profile
@bokwoon95
bokwoon95 / imgresize.sh
Last active July 1, 2024 06:19
imgresize.sh
#!/usr/bin/env bash
set -e
set -u
set -o pipefail
INPUT_PATH="$1"
OUTPUT_PATH="$2"
if test ! -f "$INPUT_PATH"; then
echo "INPUT_PATH $INPUT_PATH does not exist"
exit 1
fi
@bokwoon95
bokwoon95 / goinstall-linux.sh
Last active July 1, 2024 12:45
Short few-liner commands to install Go on a new server
#!/usr/bin/env bash
sudo apt-get update -y
sudo apt-get install -y git tmux libvips libvips-tools sqlite3
sudo apt-get upgrade -y
curl --location --output go.tgz "https://dl.google.com/go/$(curl https://go.dev/dl/?mode=json | grep -o '"version": "go.*"' | head -n 1 | xargs | cut -d ' ' -f 2).linux-$(dpkg --print-architecture).tar.gz"
sudo tar -xzf go.tgz --directory /usr/local
rm go.tgz
sudo ln -sf /usr/local/go/bin/go /usr/local/bin/go
sudo ln -sf /usr/local/go/bin/gofmt /usr/local/bin/gofmt
sudo ln -sf "$HOME/go/bin/notebrew" /usr/local/bin/notebrew
@bokwoon95
bokwoon95 / 01_xargs_parallel_commands.sh
Last active April 30, 2024 07:43
How to pass multiple arguments to arbitrary commands to run in parallel with xargs
#!/bin/sh
echo 'linux amd64 "Intel Linux"
linux arm64 "ARM Linux"
darwin amd64 "Intel macOS"
darwin arm64 "Apple Silicon macOS"
windows amd64 "Intel Windows"' | tr '\n' '\0' | xargs -0 -I{} -P4 sh -c 'f() {
echo "os=$1 arch=$2 desc=$3";
}; f {}'
nmap <buffer> <expr> <Plug>(fern-my-open-expand-collapse)
\ fern#smart#leaf(
\ "<Plug>(fern-action-open)",
\ "<Plug>(fern-action-expand)",
\ "<Plug>(fern-action-collapse)",
\ )
nmap <buffer> <CR> <Plug>(fern-my-open-expand-collapse)
nmap <buffer> <2-LeftMouse> <Plug>(fern-my-open-expand-collapse)
@bokwoon95
bokwoon95 / key.md
Created February 3, 2023 05:53
Twitter (un)official Consumer Key

Twitter Official Consumer Key

Twitter for Android

type:            PIN
Consumer key:    3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPhone

type:            PIN

Consumer key: IQKbtAYlXLripLGPWd0HUA

@bokwoon95
bokwoon95 / shellquote.go
Created January 28, 2023 12:06
program to compare escaping between "github.com/frioux/shellquote" and "github.com/kballard/go-shellquote"
package main
import (
"fmt"
"os"
"github.com/frioux/shellquote"
gsq "github.com/kballard/go-shellquote"
)
@bokwoon95
bokwoon95 / sakila-exercises.sql
Created July 20, 2022 17:08
Sakila Exercises
------------
-- SELECT --
------------
-- TODO: need a formalized structure for testing the following queries. Results
-- must always be the same, no matter the dialect. Only for
-- insert/update/delete are there some dialect-specific queries.
-- TODO: also need OLTP queries where you scan into a nested structure. Either
-- aggregate manually in the application or aggregate into json and unmarshal
DROP TABLE comment;
CREATE TABLE comment (
comment_id INTEGER PRIMARY KEY
,body TEXT
,parent_id INT REFERENCES comment (comment_id)
);
DELETE FROM comment;
@bokwoon95
bokwoon95 / vim-update-plugins.sh
Last active March 13, 2023 11:35
bash script to automatically download and update vim plugins (lightweight alternative to a plugin manager using native vim 8 packages)
#!/bin/bash
# == USAGE ==
# Put Github URLs inside a file called `plugins.start.txt` inside your vim
# directory (either `$HOME/.vim/plugins.start.txt` or
# `$HOME/.config/nvim/plugins.start.txt`). Then, run this script which will
# clone or update the plugins accordingly.
#
# == EXAMPLE ==
# $ cat "$HOME/.config/nvim/plugins.start.txt"
func (v V_APPLICATIONS) View(dialect string) sq.Query {
USERS := sq.New[USERS]("u")
USER_ROLES := sq.New[USER_ROLES]("ur")
USER_ROLES_APPLICANTS := sq.New[USER_ROLES_APPLICANTS]("ura")
PERIODS := sq.New[PERIODS]("p")
FORMS := sq.New[FORMS]("f")
APPLICATIONS := sq.New[APPLICATIONS]("a")
applicants := NewCTE("applicants", nil, Postgres.
Select(