Skip to content

Instantly share code, notes, and snippets.

View benbalter's full-sized avatar
Verified

Ben Balter benbalter

Verified
View GitHub Profile
@benbalter
benbalter / sam.coffee
Last active August 29, 2015 14:04
Hubot script to interact with the SAM.gov API
# Description:
# Displays our current DUNS number or SAM.gov registration
#
# Configuration:
# You'll need to set HUBOT_GOV_API_TOKEN as an environmental variable.
# To get an token, head over to https://api.data.gov/signup/.
# You just need a name/email combo as it's solely used for rate limiting.
#
# Commands:
# hubot samdotgov me - display's your current Sam.gov registration
We can make this file beautiful and searchable if this error is corrected: It looks like row 4 should actually have 30 columns, instead of 13. in line 3.
domain,uri,government,live,ssl,enforce_https,non_www,redirect,ip,hostname,ipv6,dnssec,cdn,google_apps,could_provider,server,cms,analytics,javascript,advertising,slash_data,slash_developer,data_dot_json,click_jacking_protection,content_security_policy,xss_protection,secure_cookies,strict_transport_security,agency,last_checked
acus.gov,http://acus.gov,true,true,false,false,true,,184.94.216.66,ip-184-94-216-66.name-host.com,false,false,false,false,false,Apache/2.2.27 (Unix) PHP/5.3.28,drupal,google_analytics,jquery,"",false,false,false,false,false,false,,false,Administrative Conference of the United States,2014-07-06 10:44:17 -0400
achp.gov,http://achp.gov,true,true,false,false,true,,69.164.158.8,parked.peakcolo.com,false,false,false,false,false,Apache/2.2.10 (Linux/SUSE),"","","","",false,false,false,false,false,false,,false,Advisory Council on Historic Preservation,2014-07-06 10:44:18 -0400
preserveamerica.gov,http://preserveamerica.gov,true,true,false,false,true,,69.164.158.9,parked.peakcolo.com,false,false,f
@benbalter
benbalter / transparency-is-so-08.md
Last active August 29, 2015 14:02
Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov (Notes from Transparency Camp 2014, http://transparencycamp.org/schedule/2014/transparency-is-so-08-why-treating-data-as-code-co/)

Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov

Question: Open government is a great first step, but how can we push towards collaborative government, the world's largest and longest-running open source project

Background

  • What differentiates open source from transparency is collaboration: the essential promise that you can see the underlying source code and make things better.
  • PDF of excel spreadsheets are technically transparency, but that's really not good enough.
  • A central promise of open source is not just to see the process, but participate and be able to modify source
  • Nothing -> FOIA -> Open Gov -> (Collaborative Gov?)
@benbalter
benbalter / jekyll-csv.rb
Created May 27, 2014 22:06
Converts `.csv` files in a `_csvs` directory of a Jekyll site to `site.data` content
require 'csv'
module JekyllCsv
class Generator < Jekyll::Generator
def generate(site)
dir = File.expand_path "_csvs", site.source
return if site.safe && File.symlink?(dir)
entries = Dir.chdir(dir) do
Dir['*.csv']

Keybase proof

I hereby claim:

  • I am benbalter on github.
  • I am benbalter (https://keybase.io/benbalter) on keybase.
  • I have a public key whose fingerprint is 07C6 73FB F30E 01C0 C342 7AB8 DBB6 7C24 6AD3 56C4

To claim this, I am signing this object:

@benbalter
benbalter / what-is-github.md
Created November 2, 2013 03:40
What is GitHub?

What's a GitHub?

GitHub is a social network for software developers. Similar to how networks like Facebook and Twitter allow people to connect, organize, and comment on updates, GitHub allows you to share source code and other technical materials you're working on and benefit from the input and contributions of others.

GitHub is a social layer built on top of a long-standing open source project called Git. At its most basic level, Git simply tracks who made what change when. While it was originally used for collaborative software development, and still is, the workflow is equally applicable to countless applications including modern open data and open government efforts.

GitHub hosts projects, commonly referred to as repositories, which belong to and are managed by organizations, typically tracking to government agencies. While you can always control who has access to your content, if your project is publicly accessible, as is most common within government, at any time, anyone can submit a proposed impro

@benbalter
benbalter / parse-go-to-webinar-report.rb
Created August 29, 2013 19:35
Ruby script to parse Go To Webinar reports for actually usefully analytics
require 'csv'
require 'gman'
data = CSV.read("data.csv", {:headers => true, :return_headers => false, :header_converters => :symbol, :converters => :all} )
# attended
attended = data.select {|row| row[:attended] == "Yes" }
percent = 100 * attended.count / data.count
puts "Attended: #{attended.count} (#{percent}% of those registered)"
@benbalter
benbalter / contributors.rb
Created August 25, 2013 16:37
Builds list of contributors
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
output = ""
contributors = JSON.parse(open("https://api.github.com/repos/project-open-data/project-open-data.github.io/contributors").read)
contributors.each do |contributor|
output += "- [ ] @#{contributor['login']} ([#{contributor['contributions']} contributions](https://github.com/project-open-data/project-open-data.github.io/commits?author=#{contributor['login']}))\n"
@benbalter
benbalter / github-for-government-office-hours.md
Last active December 21, 2015 01:58
Got questions about using GitHub within government? Join us Thursday August 29th at 1:00 EST to talk all things GitHub for open source, open data, and open government.

GitHub for Government Office Hours

Got questions about using GitHub within government? Join us Thursday August 29th at 1:00 EST to talk all things GitHub for open source, open data, and open government.

Free and open to the public, if you're a federal, state, local, or municipal employee, or just a civic hacker interested in governmenty things, we're here to answer your questions.

question-about-github

The Details

@benbalter
benbalter / Gemfile
Last active December 20, 2015 21:59
Detects if a given page is running on GitHub Pages. Usage: `./pages? [hostname]`
gem "net/dns"
gem "colored"