Skip to content

Instantly share code, notes, and snippets.

View xnuk's full-sized avatar
🏳️‍🌈
pride

즈눅 xnuk

🏳️‍🌈
pride
View GitHub Profile
#!/bin/sh
# shellcheck shell=dash
set -euf
hook_name="$(basename "$0")"
check_hooks() {
project="$1"
#!/bin/sh
set -euf
install_dir=$1
if [ -e "$install_dir" ]; then
printf 'Install path `%s` already exists; use different path.\n' \
"$install_dir" \
1>&2
exit 1
fi
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anyhow"
version = "1.0.41"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15af2628f6890fe2609a3b91bef4c83450512802e59489f9c1cb1fa5df064a61"
const N = 1_000_000
const M_MAX = 2_000_000_000
const treeHeight = () => (Math.random() * (M_MAX - N) | 0) + N
const testCase = () => {
const trees = Array.from({ length: N }, treeHeight)
return N + ' ' + treeHeight() + '\n' + trees.join(' ') + '\n'
}
@xnuk
xnuk / full-disk-access.applescript
Created February 16, 2021 01:44
Full Disk Access for your favourite terminal
tell application "System Preferences"
activate
reveal anchor "Privacy_AllFiles" of pane id "com.apple.preference.security"
display dialog "Mark your favourite terminal app to give Full Disk Access." buttons {"Got it"} default button 1
end tell
#!/usr/bin/env ruby
[].filter_map {} # filter_map support check
require 'net/http'
MIRRORLIST = Net::HTTP.get(URI('https://www.archlinux.org/mirrorlist/?country=KR&country=JP&country=SG&country=TW&country=HK&protocol=https'))
ARCH = `uname -m`.strip
REPO = 'core'
@xnuk
xnuk / kakrc
Created December 27, 2020 23:17
try %{ require-module plug } catch %{ eval %sh{
if not [ -d "$kak_config/autoload/plugins/plug" ]; then
git clone -q --depth=1 \
https://github.com/alexherbo2/plug.kak \
"$kak_config/autoload/plugins/plug" \
2>&1 >/dev/null
cat <<- EOF
source "%{$kak_config/autoload/plugins/plug/rc/plug.kak}"
require-module plug
hook -once global KakBegin .* plug-upgrade
@xnuk
xnuk / kakrc
Created November 26, 2020 09:28
# plug.kak
declare-option -hidden str plug_kak_path "%val{config}/plugins/plug.kak"
nop %sh{
if [ ! -f "$kak_opt_plug_kak_path/rc/plug.kak" ]; then
mkdir -p $kak_opt_plug_kak_path
git clone https://github.com/robertmeta/plug.kak $kak_opt_plug_kak_path
fi
}
source "%opt{plug_kak_path}/rc/plug.kak"
verbosity = 2
[language.typescript]
filetypes = ["typescript"]
roots = ["tsconfig.json"]
command = "typescript-language-server"
args = ["--stdio"]
// TypeScript Playground: https://www.typescriptlang.org/play?target=99&jsx=0&ts=4.0.2#code/C4TwDgpgBAogjgVwIYBsDOAeA+lCAPYCAOwBM0oAhAGktwOLKgEEamA+KAXiiIgDcIAJwBQw0JCgBJImATAuwqEqgAfKAG8o4iAC4oAciT6aRJAFtdUNMEEBLIgHMoAX0XK1m7Xv0AjY1CQHSyIEMx8hFzclDy1wS30AY38+WzRbHxRLTQS9AEYaMHsIJDAwTO9CgC9KoxdI5VUNWMhvEmTU9PKmkj0AJgKikrL4hIALWwSAa2J9OtcxONg8SATCEgUGmK8DIxNzS2s7RxplQMsEUggAMyKSGhS0jPPLm951102m7d9-Uws9C4ka63GhnPQhMJCE5KB6dZ5A14Qd5RRqeOLeJJ7f5QQHAt6goIAl4gqCwp56bJ5Gg9HHE-FQQq8IZdfRVGqzZz1dxfdEGNpY+F4pEEwWIu6kjrkpo5WkIkk0-oMwalFljCbTIgcyILCRMVbIFBcZhENAAdyEGGksmAbB10AAShA0AgUPJuPADZgYMsIKthcx9agaN6VmtbXbjWaLQAVDjcaNAA
type Equals<_ extends B, B extends A, A> = never
type Input =
| { type: 'a', name: string }
| { type: 'b', age: number }
| { type: 'c', visible: { c: 1, pineapple: 'pizza' } }
| { type: 'd', visible: { d: 2, pineapple: 'chicken' } }