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 / blog.conf
Last active December 10, 2016 00:33
Nginx Config for Static Blog with Let's Encrypt cert
server {
listen 80;
listen [::]:80;
server_name blog.linkleaf.com;
return 301 https://$host$request_uri;
}
server {
listen 443 ssl;
server_name blog.linkleaf.com;
# definitely DON'T use Ctrl+b. lame.
unbind C-b
# ` is a cool prefix
set -g prefix `
set -g default-terminal "screen-256color"
# this should allow for `` to be a literal `
bind-key ` send-prefix
# A simple tripwire utility to trigger breakpoints selectively.
#
# Requires `pry` and provides a pry console at the breakpoints.
#
# Place `binding.trip` anywhere you might want a breakpoint in your code
#
# def some_method(args)
# do_something
# binding.trip # <= breakpoint here
# do_something_else
@carlzulauf
carlzulauf / README.md
Last active May 5, 2016 15:16
The nautilus uri scheme

Add the following line to ~/.local/share/applications/mimeapps.list:

x-scheme-handler/nautilus=nautilus-handler.desktop

Place nautilus-handler.desktop into ~/.local/share/applications.

Place nautilus-hander into a PATH directory. I use ~/bin. Make this executable (chmod +x nautilus-handler).

Now nautilus uri scheme (example: nautilus:/some/path) links should work.

class MyStrings
def dash_heredoc
<<-HEREDOC
This is a multiline string in Ruby using the older indented syntax.
These lines will have a bunch of leading whitespace.
HEREDOC
end
def squiggly_heredoc
<<~HEREDOC
@carlzulauf
carlzulauf / pjson
Created November 14, 2015 00:21
Pretty print json utility
#!/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
setInterval(function(){
var tags = ["iframe", "object"]
for (var n = 0; n < tags.length; n++) {
var elements = document.getElementsByTagName(tags[n])
if (elements.length > 0) console.log(["removed", tags[n], elements.length])
for (var i = 0; i < elements.length; i++) {
elements[i].remove()
}
}
}, 1500);
@carlzulauf
carlzulauf / tmux.conf
Created July 2, 2015 16:49
tmux.conf
# 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 `
# this should allow for `` to be a literal `
require 'pp' # pretty printer
@cities = {}
def add_city(city_name, details = {})
puts "Adding #{city_name}"
raise ArgumentError, "Missing nickname" unless details[:nickname]
@cities[city_name] = details
end
# Intended to run inside this directory:
# https://github.com/gregkh/kernel-history/tree/master/logs/summaries
# sort release in proper ascending order
paths = Dir.glob("results*").sort_by do |path|
m = path.match(/results-(\d)\.(\d+)\.?(\d+)?/)
"#{m[1]}.#{m[2].rjust(2,"0")}.#{m[3].to_s.rjust(2,"0")}"
end
puts "Canonical contributions"