Skip to content

Instantly share code, notes, and snippets.


Troy Kruthoff troyk

View GitHub Profile
troyk / hubcode.zsh
Created Feb 10, 2021
zsh must haves
View hubcode.zsh
hubcode () {
local repo=$1
[[ ! $repo =~ "https://*" ]] && repo="${repo}"
local temp="$(mktemp -d)"
git clone --depth 1 "${repo}" "${temp}"
code --wait -n "${temp}"
rm -rf "${temp}"
troyk / hnjobsfilter.js
Last active Aug 1, 2019
filter HN who's hiring to golang, elixir and ruby
View hnjobsfilter.js
var gojobs = 0, elixirjobs = 0, rubyjobs = 0;
var text = el.innerText.toLowerCase();
var show = false;
if (text.indexOf('golang')>0 || text.indexOf(', go ')>0 || text.indexOf(' go,')>0) {
gojobs++; show=true;
if (text.indexOf('elixir')>0) {
elixirjobs++; show=true;
troyk / just_use_fkeys.sql
Created Apr 10, 2019
Polymorphic relationships with triggers in postgresql
View just_use_fkeys.sql
-- saving here for later reference incase I decide to complicate things, decided to just use foreign keys
create table user_groups {
id bigint PRIMARY KEY default id_generator(),
account_id bigint not null references accounts(id) on delete cascade on update cascade,
updated_at timestamptz,
name citext not null
CREATE TYPE notification_level AS ENUM ('change', 'complete', 'digest', 'all');
troyk / desc.txt
Last active Jan 26, 2018
300 char entry for HR startup of the year
View desc.txt
Next generation background screening technology disrupting the industry with mobile first candidate experience, automated compliance, single-sign-on integrations and fastest delivery (98% of reports, less than 27 hours)
troyk / jwt.go
Created Apr 7, 2016
golang jwt example
View jwt.go
package cmd
import (
troyk / db.go
Created Nov 12, 2015
golang sql query abstraction
View db.go
package db
import (
_ "" // required for database/sql
troyk / restart
Created Oct 2, 2015
restart script for blit
View restart
# sudo stop
# rm /var/www/blit/tmp/puma/*
# sudo start
# TODO: figure out how to restart sidekiq
ps auxf | grep "blit"
blit_puma_pid=$(ps -C ruby -F | grep '/puma.*\[blit\]' | awk {'print $2'})
echo "sending SIGUSR1 to pid $blit_puma_pid"
kill -s SIGUSR1 $blit_puma_pid
troyk / cmd
Created Apr 22, 2015
how to compile bootstrap
View cmd
lessc bootstrap.less --clean-css="--s1 --advanced --compatibility=ie8" > ~/Projects/textrocket/public/css/lib/
View limit.maxfiles.plist
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
troyk / activerecord
Created Feb 27, 2015
AR vs Sequel in real world rails scenario
View activerecord
Total: 13.0664 secs.
Slowest: 0.3004 secs.
Fastest: 0.0760 secs.
Average: 0.1303 secs.
Requests/sec: 76.5321
Status code distribution:
[200] 1000 responses