Skip to content

Instantly share code, notes, and snippets.

@amccartney
amccartney / row_count.sql
Created April 4, 2017 22:19
Row count for all tables in a postgres database
SELECT schemaname,relname,n_live_tup
FROM pg_stat_user_tables
ORDER BY n_live_tup DESC;
@amccartney
amccartney / Contract_text.txt
Last active May 10, 2016 22:06
Slow indexing, elasticsearch/django/haystack
{{ object.productorservicecode }}
{{ object.descriptionofcontractrequirement }}
{{ object.placeofperformancezipcode }}
{{ object.pop_state_code }}
{{ object.pop_cd }}
{{ object.countryoforigin }}
{{ object.nationalinterestactioncode }}
@amccartney
amccartney / 1-HOUSEKEEPING.md
Last active April 14, 2016 02:35
Deploying a static site with s3

Housekeeping

(Sorry guys! This isn't as hard as it looks)

(Basically go down and copy and paste all these commands in your Terminal. That's it.)

If you already have Xcode, Homebrew and rbenv installed, go ahead and skip down to part 2.

A little housekeeping before we jump in. Because some people have had some trouble installing ruby gems, go through and install all this before you get going. This is all going to look a little strange, but you don’t need to understand what’s going on in order to make the website. A lot of this is just the base on which programming projects are done.

First, install Xcode -- the native command line tools for Mac.

@amccartney
amccartney / 1-problem.md
Last active March 22, 2016 22:00
Resolving multiple objects to one detail view

So given a bunch of Django objects -- as in the objects represented in the JSON -- how can i create a summary detail view that will resolve all of the different objects into one, like the sample page below?

New and easier scraper!

Ok, all those functionalities are now rolled into one script! Get 15 years of contract data by running this on the command line. Returns a separate file for each year.

Takes the name of a company as an argument. If you want Hewlett-Packard data, for instance, run

$ bash scraper.sh Hewlett-Packard

@amccartney
amccartney / README.md
Last active September 9, 2015 03:13
fresh block

hello markdown