Skip to content

Instantly share code, notes, and snippets.

// type Test = ReturnType<supabaseClient.from('a_table').select('*, a_foreign_row:a_foreign_table!a_foreign_row_id (*)')>;
type Test = GetResult<
Database['public'],
Database['public']['Tables']['a_table']['Row'],
'*, a_foreign_row:a_foreign_table!a_foreign_row_id (*)'
>;
type F = Test['a_foreign_row'];
#/bin/bash
# timedatectl set-timezone America/Chicago
sudo timedatectl set-timezone America/Los_Angeles
@selbyk
selbyk / cta_buff_macro.py
Last active November 13, 2021 04:59
cta buff macro
#!/bin/python
# Run with python script_name.py or ./script_name.py if executable
# F9 activates buff macro, - toggles whether F9 activates macro or not
import time
from pynput import keyboard
from pynput.mouse import Button, Controller as MouseController
from pynput.keyboard import Key, Controller as KeyboardController
mouseControl = MouseController()
keyboardControl = KeyboardController()
@selbyk
selbyk / first_run.log
Last active November 25, 2020 19:12
Lutris LoL Failure
wine: cannot find L"C:\\windows\\system32\\winemenubuilder.exe"
LeagueClient.exe(00000009): ALWAYS| Application Version:8.18.245.4647 - CL:2454647 - Build Date:Sep 12 2018 - Build Time:23:38:23
@selbyk
selbyk / get-npm-package-version
Created September 20, 2017 22:02 — forked from DarrenN/get-npm-package-version
Extract version from package.json (NPM) using bash / shell
# Version key/value should be on his own line
PACKAGE_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo $PACKAGE_VERSION
@selbyk
selbyk / gist:9fec0e69e50f38e02ebd40792fb87cb6
Created January 18, 2017 00:06
log all node.js http/https requests
let reqCount = 0;
function requestLogger(httpModule) {
var original = httpModule.request;
httpModule.request = function(options, callback) {
console.log(reqCount++, options.method, options.href || options.proto + "://" + options.host + options.path);
console.log(options.uri);
console.log(options.headers);
return original(options, callback);
}
[
{rabbit, [
{tcp_listeners, [{"::", 5672}]}
]}
].
@selbyk
selbyk / digit-sums.js
Created June 29, 2016 18:22
Find the amount of numbers between two positive integers whose digits sum equals another given positive integer
/**
* Find the amount of numbers between 10 and 1000 whose digits sum equals 9
*/
// lodash gives us lots of useful magic functions for arrays, objects, etc
const _ = require('lodash');
// set up our variables
let start = 10, end = 1000;
let digitTotal = 9;
@selbyk
selbyk / rand_hex.sh
Last active June 8, 2016 04:06
Generate random hex
#!/bin/bash
length=12
if [[ $1 =~ ^[0-9]+$ ]]; then
length=$1
fi
cat /dev/urandom | tr -dc 'a-fA-F0-9' | fold -w $length | head -n 1
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDIt2/zMbtwdBsdWPH7obrfPk2GH/k9S5KcQbBzIqi8rTbelwFdpViD59cRUltq+KybP3NwPZN87Aazc59C2u6T+1vRq4sonAVEIpYAGmI+lnImb9VGiMqMh3YYgBfMcV3i7/HMR6SuDs1ZrVd3P8fv/ioZ5zd7QI67YxzrCgcDx7V2LBT0YN/OX/bMTImplHMdw4ykJmNaov8PuhLqa4jXfxXEI8izQVCt+bWfjunQbF1flquPqZMfp+iutw6Ol35kWDJYmEiQUrc2DFsrPLqsblfwnGLUDp3+u+KGXfapaDGgZehJ7cxT9+p4AB9FvEA+r5TgAcQUDYH1CVPBxogd selby@daenerys.local