Skip to content

Instantly share code, notes, and snippets.

View raven-rock's full-sized avatar

Levi Gillette raven-rock

View GitHub Profile
@intrntbrn
intrntbrn / firefox_bookmarks
Created February 26, 2020 09:02
firefox bookmark menu (dmenu, rofi, fzf)
#!/bin/sh
# menu (dmenu, rofi, fzf, etc.)
menu_cmd='dmenu -i -p Bookmark'
# browser
browser_cmd='firefox --new-tab'
# in case the automatic profile detection does not work properly,
# replace <PROFILE> with your profile id (e.g. ik52yqxf.default-1574488801337) and uncomment
@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?
#!/bin/bash
# Recommended steps:
#
# bootstrap before entering chroot
# copy this script into INSTALL_DIR
# rootinit after entering chroot
# x (if installing graphics)
# pkgs
# xpkgs (if installing graphics)
@kenji4569
kenji4569 / ulid_converter.sql
Last active May 7, 2024 21:46
ULID (26 characters in Crockford's base32) conversion for MySQL function
# Define ULID_DECODE and ULID_ENCODE which convert a ulid string to a binary and vice versa.
delimiter //
DROP FUNCTION IF EXISTS ULID_DECODE//
CREATE FUNCTION ULID_DECODE (s CHAR(26)) RETURNS BINARY(16) DETERMINISTIC
BEGIN
DECLARE s_base32 CHAR(26);
SET s_base32 = REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(REPLACE(UPPER(s), 'J', 'I'), 'K', 'J'), 'M', 'K'), 'N', 'L'), 'P', 'M'), 'Q', 'N'), 'R', 'O'), 'S', 'P'), 'T', 'Q'), 'V', 'R'), 'W', 'S'), 'X', 'T'), 'Y', 'U'), 'Z', 'V');
RETURN UNHEX(CONCAT(LPAD(CONV(SUBSTRING(s_base32, 1, 2), 32, 16), 2, '0'), LPAD(CONV(SUBSTRING(s_base32, 3, 12), 32, 16), 15, '0'), LPAD(CONV(SUBSTRING(s_base32, 15, 12), 32, 16), 15, '0')));
END//
@gboudreau
gboudreau / AuthyToOtherAuthenticator.md
Last active May 23, 2024 16:31 — forked from Ingramz/AuthyToOtherAuthenticator.md
Export TOTP tokens from Authy
@valyala
valyala / README.md
Last active April 19, 2024 13:00
Optimizing postgresql table for more than 100K inserts per second

Optimizing postgresql table for more than 100K inserts per second

  • Create UNLOGGED table. This reduces the amount of data written to persistent storage by up to 2x.
  • Set WITH (autovacuum_enabled=false) on the table. This saves CPU time and IO bandwidth on useless vacuuming of the table (since we never DELETE or UPDATE the table).
  • Insert rows with COPY FROM STDIN. This is the fastest possible approach to insert rows into table.
  • Minimize the number of indexes in the table, since they slow down inserts. Usually an index on time timestamp with time zone is enough.
  • Add synchronous_commit = off to postgresql.conf.
  • Use table inheritance for fast removal of old data:
@bostonou
bostonou / line-seq.cljs
Last active October 21, 2018 20:54
line-seq in cljs
;; This is a macro, and must be in clojure. It's name and location is the same as
;; the cljs file, except with a .clj extension.
(ns cljs-made-easy.line-seq
(:refer-clojure :exclude [with-open]))
(defmacro with-open [bindings & body]
(assert (= 2 (count bindings)) "Incorrect with-open bindings")
`(let ~bindings
(try
(do ~@body)