Skip to content

Instantly share code, notes, and snippets.

peterkeen / automatic.txt
Created Apr 8, 2015
Examples from Program Your Finances: Envelope Budgeting
View automatic.txt
= /Income:Salary/ and expr date >= [2015/04/01] && date < [2015/06/01]
* Assets:Funds:Water $50.00
* Liabilities:Funds:Water $-50.00
= /Income:Salary/ and expr date >= [2015/06/01]
* Assets:Funds:Water $55.00
* Liabilities:Funds:Water $-55.00
= /Expenses:Water/
* Liabilities:Funds:Water 1.0
peterkeen / export_tiller.rb
Created Mar 4, 2018
Export a Tiller transaction spreadsheet as a ledger file while checking for duplicates in ledger-web database.
View export_tiller.rb
require 'rubygems'
require 'bundler/setup'
require 'pg'
require 'sequel'
require 'ledger_gen'
require 'google_drive'
SPREADSHEET_ID = 'your-google-sheet-id'
DATABASE_URL = 'postgres://username:password@host/database'

Cora Street Press Individual Contributor License Agreement

Thank you for your interest in contributing to open source software projects (“Projects”) made available by Cora Street Press or its affiliates (“Cora Street Press”). This Individual Contributor License Agreement (“Agreement”) sets out the terms governing any source code, object code, bug fixes, configuration changes, tools, specifications, documentation, data, materials, feedback, information or other works of authorship that you submit or have submitted, in any form and in any manner, to Cora Street Press in respect of any of the Projects (collectively “Contributions”). If you have any questions respecting this Agreement, please contact

You agree that the following terms apply to all of your past, present and future Contributions. Except for the licenses granted in this Agreement, you retain all of your right, title and interest in and to your Contributions.

Copyright License. You hereby grant, and agree to grant

View ztdns.rb
require 'rubydns'
require 'httparty'
require 'lru_redux'
class ZeroTierAPI
include HTTParty
base_uri ""
headers 'Authorization' => "Bearer #{ENV['ZT_API_TOKEN']}"
View serve.rb
require 'rubydns'
[:udp, "", 5300],
[:tcp, "", 5300]
IN = Resolv::DNS::Resource::IN
UPSTREAM =[[:udp, "", 53], [:tcp, "", 53]])
View gist.rake
task :run_gist => :environment do
url = ENV['url']
raise "usage: rake run_gist url=" unless url.present?
dir = Dir.mktmpdir
system("git clone #{url} #{dir}")
Dir.chdir(dir) do
raise "Gist does not have a script.rb file to execute" unless File.exists?('script.rb')
peterkeen / gist:7591428
Created Nov 21, 2013 is down
View gist:7591428
$ dig @
; <<>> DiG 9.7.6-P1 <<>> @
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: SERVFAIL, id: 15309
;; flags: qr rd ra; QUERY: 1, ANSWER: 0, AUTHORITY: 0, ADDITIONAL: 0
View gist:6017752

Hello there! This is a sample post for, a super-lightweight writing soapbox for hackers.

Now look up. Further. Above the post title. See that grey text with the gist ID?

Now back to me. That grey text is a link! Open that sucker in a new tab to see the source for this post. Also, I'm on a horse.

This is a SUPER major heading

If you peek at it with a web inspector, you'll see that it is a second-level heading. You can use first level headings, but they'll look just like the second level ones, and the gods of the HTML5 outlining algorithm will frown upon you.

peterkeen / Dockerfile
Created Jun 27, 2013
My very first Dockerfile! It installs Ruby 2.0 from scratch, installs bundler, and then vendors in my app and installs dependencies.
View Dockerfile
# Use Ubuntu 12.04 as the base image
FROM ubuntu:precise
# Install a bunch of prerequisites
RUN apt-get update
RUN apt-get install -y git-core curl wget libssl1.0.0 python-yaml build-essential libssl-dev
# Install ruby-build
peterkeen / 20121108220000_add_budget_tables.rb
Created Jan 8, 2013
This is how I implement budgets for ledger web
View 20121108220000_add_budget_tables.rb
Sequel.migration do
up do
create_table(:budget_periods) do
String :account
BigDecimal :amount
Date :from_date
Date :to_date
create_or_replace_view :budget_months, "select xtn_month, account, amount from (select distinct xtn_month from accounts_months) x cross join budget_periods where xtn_month between budget_periods.from_date and (coalesce(budget_periods.to_date, now()::date))"