Skip to content

Instantly share code, notes, and snippets.

View raven-rock's full-sized avatar

Levi Gillette raven-rock

View GitHub Profile
@raven-rock
raven-rock / README.md
Last active April 25, 2021 16:16
My Vimium configuration for Chrome or Firefox

Key mappings

map J nextTab
map K previousTab

map z passNextKey " great for youtube, e.g., zf -> fullscreen

map <c-p> togglePinTab " How often do you really print webpages with c-p anyway?
@raven-rock
raven-rock / say.sh
Created January 27, 2020 22:59
say.sh - a cheap knockoff of macOS say - using flite
#!/usr/bin/env bash
# This is a cheap way to do like macOS say command in Linux
# Put this in /usr/local/bin/say or somewhere on your $PATH
# Install flite ("Festival Lite") with:
# sudo apt install -y flite
# Adjust speaking rate/speed/wpm with --setf duration_stretch=MULTIPLIER_OF_NORMAL_SPEED:
@raven-rock
raven-rock / enhancer_for_youtube_config.json
Last active October 21, 2020 04:32
My Enhancer for Youtube config
{
"version": "2.0.101",
"settings": {
"autofocusevents": "ads,annotations,cinema,size,boost,loop,speed,filters",
"autopausevideos": true,
"backgroundcolor": "#000000",
"backgroundopacity": 85,
"blur": 0,
"brightness": 100,
"cinemamode": false,
@raven-rock
raven-rock / expressvpn_setup_on_debian_based_linux.md
Last active April 17, 2024 05:50
How to set up ExpressVPN on Debian/Ubuntu/Pop!_OS Linux
@raven-rock
raven-rock / .Xmodmap
Created January 27, 2020 02:04
.Xmodmap - space cadet setup for Linux - map caps lock to escape; alt to control; super to alt; control to super
!file ~/.Xmodmap
clear control
clear mod1
clear mod4
keycode 37 = Super_L
! left Ctrl becomes Super
keycode 64 = Control_L
@raven-rock
raven-rock / pure_sql_scd_update.sql
Last active May 11, 2023 00:39
"Pure SQL" algorithm for updating of slowly changing dimension (SCD Type 2) table records with just two DML statements (SQLite example)
-- SQLite
-- Test: sqlite3 -header -echo -column :memory: < %
create table t1 (
bk int
, valid_from datetime default CURRENT_TIMESTAMP
, valid_to datetime default '9999-12-31 23:59:59'
, a1 varchar(20)
, primary key (bk, valid_from)
);
@raven-rock
raven-rock / output.txt
Created August 20, 2019 19:18
Efficiently modifying dataset from stage - proof of concept in SQLite
SQLite version 3.29.0 2019-07-10 17:32:03
Enter ".help" for usage hints.
sqlite> -- SQLite
sqlite> -- Test: sqlite :memory: < %
sqlite>
sqlite> create table t1 (
...> bk int primary key
...> , a1 varchar(20)
...> );
sqlite>
@raven-rock
raven-rock / util-linux.rb
Created August 6, 2019 13:48
(Trying to) Homebrew install `util-linux` with `column`
class UtilLinux < Formula
desc "Collection of Linux utilities"
homepage "https://github.com/karelzak/util-linux"
url "https://www.kernel.org/pub/linux/utils/util-linux/v2.34/util-linux-2.34.tar.xz"
sha256 "743f9d0c7252b6db246b659c1e1ce0bd45d8d4508b4dfa427bbb4a3e9b9f62b5"
bottle do
cellar :any
sha256 "3fb25026099ea42c1c54b80cad6bbdf9bf09b0e0e967ca4690698d0d2d379483" => :mojave
sha256 "7d7e421229cbf8b0ac5fbe1f0ffc7d18a3e0ce9dc09090bd346f676111cc2bb7" => :high_sierra
@raven-rock
raven-rock / ruby-broken-pipe-rescue.rb
Created July 31, 2019 21:34
Rescuing "Broken Pipe" errors in Ruby
# If user pipes to less, or hits Ctrl-C, etc, avoid the annoying
# `Broken pipe @ io_writev - <STDOUT> (Errno::EPIPE)` error.
# Source: https://stackoverflow.com/questions/1807355/broken-pipe-errnoepipe/18082444#18082444
ARGF.each do |line|
line.chomp!
begin
puts line
rescue Errno::EPIPE
exit
@raven-rock
raven-rock / mysql_int_type.rb
Created July 28, 2019 03:07
MySQL integer type from integer range
def mysql_int_type(int_range)
case
when (0..255) .cover?(int_range) then "tinyint unsigned"
when (0..65535) .cover?(int_range) then "smallint unsigned"
when (0..16777215) .cover?(int_range) then "mediumint unsigned"
when (0..4294967295) .cover?(int_range) then "int unsigned"
when (0..18446744073709551615) .cover?(int_range) then "bigint unsigned"
when ( -128..127) .cover?(int_range) then "tinyint"
when ( -32768..32767) .cover?(int_range) then "smallint"
when ( -8388608..8388607) .cover?(int_range) then "mediumint"