Skip to content

Instantly share code, notes, and snippets.

View whoward's full-sized avatar

William Howard whoward

  • Toronto, Canada
View GitHub Profile
@whoward
whoward / cpf.sh
Created May 11, 2020 19:41
bash function to apply a diff on a single file from another commit
# example: cpf c0fbe4 path/to/file.txt
function cpf() {
git diff -R $1 $2 | git apply
}
@whoward
whoward / make-null.sh
Created July 24, 2018 13:55
Make a "Null" branch in git to enable a full code walkthrough via a pull request
#!/bin/sh
git checkout --orphan null
git rm --cached -r .
git commit --allow-empty -m 'null'
git push origin null
@whoward
whoward / export2ical.rb
Created July 11, 2018 15:58
exports the time tracker data from https://github.com/whoward/time-tracker into ical format
#!/usr/bin/env ruby
require 'bundler/inline'
gemfile "https://rubygems.org" do
gem 'icalendar', '2.4.1'
gem 'sqlite3', '1.3.13'
end
db = SQLite3::Database.new File.join(ENV['HOME'], ".time-tracker.db")
@whoward
whoward / pom
Last active July 11, 2018 15:57
simple slack + sqlite pomodoro tracker. Meant to be used in conjunction with https://github.com/whoward/time-tracker. Requires the slack-cli from https://github.com/rockymadden/slack-cli to be on the PATH.
#!/bin/bash
set -e
DURATION=${1:-1800}
START=$(date "+%Y-%m-%d %H:%M:%S.000")
START_SECONDS=$(date "+%s")
UNTIL=$(gdate "+%I:%M%p" --date "+ $DURATION seconds")