Skip to content

Instantly share code, notes, and snippets.

Avatar

Carl Zulauf carlzulauf

  • Unabridged Software
  • Denver, CO
View GitHub Profile
@carlzulauf
carlzulauf / git-clean-local
Last active May 11, 2022
git clean-local
View git-clean-local
#!/usr/bin/env ruby
# git clean-local
# ---------------
# Clean out your local branches. Defaults to branches you haven't touched in 30+ days.
#
# More info: git clean-local -h
#
# Asks for confirmation by default, so safe to run with no options.
View git-pushu
#!/usr/bin/env ruby
# git pushu
# ---------
#
# Push upstream every time
#
# * If the current branch tracks a remote, push to it.
#
# * If there is no tracking branch, point to a branch of the same name,
View git-pullf
#!/usr/bin/env ruby
# git pullf
# ---------
# Force pull without needing to be verbose
current = `git for-each-ref --format='%(upstream:short)' $(git symbolic-ref -q HEAD)`
remote, remote_branch = current.strip.split("/", 2)
branch = `git branch | grep \\* | cut -d ' ' -f2`
@carlzulauf
carlzulauf / console_saver.rb
Created Mar 22, 2022
A pry session that remembers
View console_saver.rb
#!/usr/bin/env ruby
# Console script with saved data serialized into script body at bottom
#
# `Console#db` is serialized via YAML whenever the `save` method is called
# * YAML is placed after special `__END__` keyword
# * Script can access data after `__END__` via `DATA` constant
# Useful as a skeleton for one-off console scripts needing limited data storage
View keybase.md

Keybase proof

I hereby claim:

  • I am carlzulauf on github.
  • I am carlzulauf (https://keybase.io/carlzulauf) on keybase.
  • I have a public key ASBdd9PaBV4nzitPvyoXMfFKb4jFJ-5w8xzBV81Qc-LDywo

To claim this, I am signing this object:

View thought_slime.md

In the real world, genius is usually the product of obsession rather than some innate superiority. The best people in their fields aren't just super humans with superior minds, they just care about one specific thing in such a way that they are able to develop a level of mastery over it that few could hope to achieve. People might be born with aptitudes. Nobody is born a genius.

Being a genius doesn't mean that you're smarter than everybody else on every subject. It just means that you have one specific field where you're King Shit of Fuck Mountain.

View forecast.json
{
"latitude": 39.675707,
"longitude": -104.938809,
"timezone": "America/Denver",
"currently": {
"time": 1581616800,
"summary": "Partly Cloudy",
"icon": "partly-cloudy-day",
"nearestStormDistance": 8,
"nearestStormBearing": 98,
View predictions.md
time cur high low
2020-02-13 11:00 24.96 45.5 17.53
2020-02-13 12:00 28.57 45.38 15.33
2020-02-13 13:00 28.96 45.58 18.24
2020-02-13 14:00 29.51 45.58 18.85
2020-02-13 15:00 29.29 45.58 18.18
2020-02-13 16:00 30.29 45.58 17.88
2020-02-13 17:00 28.51 45.58 17.66
2020-02-13 18:00 24.8 45.43 18.06
@carlzulauf
carlzulauf / .irbrc
Created Feb 9, 2020
IRB/Pry customizations
View .irbrc
require 'pp'
# Enable mapping an array of hashes by key: hashes.map[:key]
Enumerator.send(:define_method, :[]) { |key| map { |obj| obj[key] } }
def r
begin
require 'redis' unless defined?(Redis)
begin
Redis.current.tap(&:info) # needed to know if connection failed
@carlzulauf
carlzulauf / phoronix-dark.js
Last active Jan 28, 2020
A Dark Mode script for Phoronix.com
View phoronix-dark.js
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};