Skip to content

Instantly share code, notes, and snippets.

View carlzulauf's full-sized avatar

Carl Zulauf carlzulauf

  • Unabridged Software
  • Denver, CO
View GitHub Profile
@carlzulauf
carlzulauf / phoronix-dark.js
Last active January 28, 2020 01:30
A Dark Mode script for Phoronix.com
if (/:\/\/(www\.)?phoronix\.com/.test(window.location.href)) {
let bgH = "#333333";
let bgL = "#222222";
let text = "#e0e0e0";
let textH = "#e0e0e0";
let textL = "#aeaeae";
let accent = "#666666";
let css = `
body {
background: ${bgH};
#!/usr/bin/env ruby
# Tool to convert Google motion JPGs (MVIMG) to MP4 video files.
#
# requires exiftool utility (ie: `apt install exiftool`)
# requires exiftool gem (ie: `gem install exiftool`)
#
require 'exiftool'
files = Dir['*.jpg']
@carlzulauf
carlzulauf / openvpn_resolved_wrapper
Last active April 1, 2019 16:06
Script to wrap openvpn, detect DNS settings, and tell systemd-resolved about them
#!/usr/bin/env ruby
OVPN_CONFIG_PATH = "~/path/to/your.ovpn"
require 'open3'
class VpnWrapper
attr_reader :buffer, :local_interface, :local_dns, :pid
def initialize
@carlzulauf
carlzulauf / app
Last active March 14, 2019 18:15
Core .bin files
#!/usr/bin/env ruby
require_relative "lib.rb"
dc "run app #{ARGV.join(' ')}"
@carlzulauf
carlzulauf / pjson
Created June 23, 2018 01:02
Pretty Print JSON
#!/usr/bin/env ruby
# Pretty print json
#
# Reads JSON from file(s) or from STDIN
#
# Usage:
#
# cat my_json.json | pjson
# pjson my_json.json
@carlzulauf
carlzulauf / git-clean-local
Created June 6, 2018 20:01
Clean stale local git branches
#!/usr/bin/env ruby
require 'time'
require 'optparse'
class Cleaner
attr_accessor :whitelist, :blacklist, :cutoff_days, :confirm, :dry_run, :keep, :skip, :remove
def initialize(options = {})
@whitelist = %W(master develop #{local_branch}).uniq
@carlzulauf
carlzulauf / .tmux.conf
Last active May 19, 2017 16:09
Tmux Config and Startup Script
# definitely DON'T use Ctrl+b. lame.
unbind C-b
# I never use the Insert key on the console, but it is a bit of a stretch
# set -g prefix IC
# ` is a cool prefix
set -g prefix `
set -g default-terminal "screen-256color"
@carlzulauf
carlzulauf / switch_or_launch.rb
Created April 16, 2017 08:51
use wmctrl and gtk-launch to bring an existing window to the front or launch the app
#!/usr/bin/ruby
base_cmd = ARGV[0]
cmd_pattern = Regexp.new(base_cmd)
running = `wmctrl -lx`.lines.grep(cmd_pattern)
if running.any?
window_id = running.first.match(/0x[0-9a-f]{8}/)[0]
exec "wmctrl -ia #{window_id}"
else
@carlzulauf
carlzulauf / Capfile
Last active December 10, 2016 01:59
Jekyll Capistrano Config
require "capistrano/setup"
require "capistrano/deploy"
require 'capistrano/chruby'
require 'capistrano/bundler'