Skip to content

Instantly share code, notes, and snippets.

View davekonopka's full-sized avatar
🔊

Dave Konopka davekonopka

🔊
View GitHub Profile
@davekonopka
davekonopka / git.sh
Created February 17, 2023 17:20
macOS stale local branches for github squash and merge
function git_list_remote_branches() {
git ls-remote --heads -q | awk '{ gsub("refs/heads/",""); print $2 }' | sort
}
function git_list_local_branches() {
git branch --format='%(refname:short)' | sort
}
function git_local_stale_branches() {
comm -13 <(git_list_remote_branches) <(git_list_local_branches)
@davekonopka
davekonopka / reader-import.py
Last active January 3, 2023 16:01
Readwise Reader CVS Import
import csv
import requests
import time
filename = 'PathToYourExportFile.csv'
with open(filename, 'r') as csvfile:
datareader = csv.reader(csvfile)
line = 1
entries = list(datareader)

Keybase proof

I hereby claim:

  • I am davekonopka on github.
  • I am davekonopka (https://keybase.io/davekonopka) on keybase.
  • I have a public key ASBU58_F6GWpF5W6AzeCtNU0ruWy5W8AoYYbfwkTAehvpAo

To claim this, I am signing this object:

### Keybase proof
I hereby claim:
* I am davekonopka on github.
* I am davekonopka (https://keybase.io/davekonopka) on keybase.
* I have a public key whose fingerprint is 2697 F572 63A5 78C9 9846 544F 8227 A831 228A 4D2D
To claim this, I am signing this object:
@davekonopka
davekonopka / 0_reuse_code.js
Created May 2, 2016 15:14
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@davekonopka
davekonopka / pew-pew-pew.json
Created September 14, 2015 17:03
JSON or Missile Command?
]
]
}
]
}
]
}
}
]
}
input = "If you are self-motivated, wow, this world is tailored for you. The boundaries are all gone. But if you're not self-motivated, this world will be a challenge because the walls, ceilings and floors that protected people are also disappearing. That is what I mean when I say \"it is a 401(k) world.\" Government will do less for you. Companies will do less for you. Unions can do less for you. There will be fewer limits, but also fewer guarantees. Your specific contribution will define your specific benefits much more. Just showing up will not cut it. - T. Friedman".downcase
pair = "ou"
third = "r"
pairs = (0..input.length-2).inject({}) do |h,i|
key, val = input[i,2], input[i + 2]
h[key] = {} unless h[key]
h[key][val] = (h[key][val] || 0) + 1 if val
h
end
[18:48:01][Step 3/6] To replicate the order on your machine:
[18:48:01][Step 3/6] rake spec SPEC_OPTS=“–order random:84847”
@davekonopka
davekonopka / teamcity_rspec_order.sh
Created March 23, 2013 02:50
TeamCity RSpec Order
echo "##teamcity[setParameter name='env.SEED_NUMBER' value='$(git rev-parse HEAD | tr -d 'a-z' | cut -b 1-5)']"
echo "To replicate the order on your machine:"
echo "rake spec SPEC_OPTS=\"--order random:$(git rev-parse HEAD | tr -d 'a-z' | cut -b 1-5)\""
if defined?(RUBY_ENGINE) && RUBY_ENGINE == "ruby" && RUBY_VERSION >= "1.9"
module Kernel
alias :__at_exit :at_exit
def at_exit(&block)
__at_exit do
exit_status = $!.status if $!.is_a?(SystemExit)
block.call
exit exit_status if exit_status
end
end