Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

#!/bin/bash
latest_date_file=.last-statement-date
while [[ $# -gt 1 ]]
do
key="$1"
case $key in
-s|--since)
@ghing
ghing / capture_id.sh
Last active June 24, 2017 19:35
Filter tweets stored by https://github.com/ghing/congressional-tweets to predefined list of screen names
#!/bin/bash
# Read one line of ndjson from stdin
read -r line
last_id_file=$1
if [ -z "$last_id_file" ]; then
last_id_file=.last-tweet-id
fi
@ghing
ghing / adding_agcl_coating_to_reference_electrode_wire.jpg
Last active May 5, 2017 03:36
Testing vitamin C with an opensource potentiostat
adding_agcl_coating_to_reference_electrode_wire.jpg
@ghing
ghing / cases.json
Last active June 3, 2016 19:25
portal.iprachicago.org in one JSON file, as of 2016-06-03T13:45:00
[{"incident_datetime": "2016-01-31T04:25:00", "url": "http://portal.iprachicago.org/1079080-2/", "media": [{"url": "https://player.vimeo.com/video/165083122", "id": "165083122", "title": "Video Clip"}, {"url": "https://player.vimeo.com/video/165083123", "id": "165083123", "title": "Video Clip"}, {"url": "https://player.vimeo.com/video/165083121", "id": "165083121", "title": "Video Clip"}, {"url": "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/262611603&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true", "id": "262611603", "title": "Audio Clip"}, {"url": "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/262611600&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false&visual=true", "id": "262611600", "title": "Audio Clip"}, {"url": "https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/262464114&auto_play=fals
@ghing
ghing / check_site.sh
Created June 3, 2016 16:18
Script I ran to notify me when the IPRA portal, http://portal.iprachicago.org came out from behind basic auth on Friday, June 3, 2016
#!/bin/bash
while true; do
wget http://portal.iprachicago.org/ 2>/dev/null
if [ $? -ne 0 ]; then
echo "Portal is not live"
else
osascript -e 'display notification "Live!"'
break
@ghing
ghing / keybase.md
Created March 8, 2016 16:36
Keybase.io GitHub verification

Keybase proof

I hereby claim:

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

To claim this, I am signing this object:

@ghing
ghing / truncate_floats.py
Created February 29, 2016 21:42
Truncating floats and formatting
import decimal
'{:.1f}'.format(decimal.Decimal(99.955).quantize(decimal.Decimal('.1'), rounding=decimal.ROUND_DOWN))
@ghing
ghing / iframe.html
Last active October 12, 2015 18:40
Iframe event test
<html>
<body>
<h1>This is an iframe</h1>
<script>
console.log("Iframe loaded")l;
window.addEventListener('resize', function() {
console.log('resize');
});
</script>
</body>
@ghing
ghing / README.md
Last active August 29, 2015 14:24
Reshaping data

Reshaping data

My colleague had a set of temperature readings with one row per date. Another colleague needed to visualize the data in a tool that required one row per day of the month with columns for each year value. He was working with the data in a SQL database, but neither of us knew off the top of our heads the best way to do this. This gist is a number of examples of how to approach the problem.

@ghing
ghing / BaseView.js
Created February 4, 2015 00:08
Template rendering views in Backbone
var BaseView = Backbone.View.extend({
children: {},
checkId: null,
shown: false,
events: {
'click .back-to-top': 'backToTop',
'click h2 a': 'jumpTo'
},