Skip to content

Instantly share code, notes, and snippets.


Chris Keller chrislkeller

View GitHub Profile
chrislkeller / import_json_appsscript.js
Last active Apr 12, 2021
Adds what amounts to an =ImportJSON() function to a Google spreadsheet... To use go to Tools --> Script Editor and add the script and save.
View import_json_appsscript.js
* Retrieves all the rows in the active spreadsheet that contain data and logs the
* values for each row.
* For more information on using the Spreadsheet API, see
function readRows() {
var sheet = SpreadsheetApp.getActiveSheet();
var rows = sheet.getDataRange();
var numRows = rows.getNumRows();
chrislkeller /
Last active Apr 12, 2021
A couple quick bash scripts so I can keep virtualenvs somewhat consistent across machines. exports requirements files for each virtualenv, names the files for the virtualenv and sends them to a date-versioned directory. loops through a directory of requirements files and checks to see if a virtualen…
# grab the virtualenvwrapper settings
export WORKON_HOME=$HOME/.virtualenvs
# the location of your virtualenv wrapper shell script may differ
source /usr/local/share/python/
View new-mexico-county-tiers.json
"name": "Bernalillo",
"endDate": "2020-09-01",
"positivityRate": 2.1,
"casesPer100k": 4.8
}, {
"name": "Catron",
"endDate": "2020-09-01",
"positivityRate": 0,
"casesPer100k": 0
chrislkeller / gist:6016345
Last active Mar 5, 2021
Query the KPCC article API
View gist:6016345

Function to query API

    class kpcc_api_article():
        def __init__(self, permalink, image_asset, publish_date, short_title):
            self.user = permalink
            self.text = image_asset
            self.graphic = publish_date
            self.time = short_title
    # search kpcc api for related articles to display on detail pages
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import urllib.request
import json
import datetime
timestamp ="%Y-%m-%d-%H%M%S")
file_output = '{0}-daily-data.json'.format(timestamp)
chrislkeller / google-form-redirect
Created Oct 18, 2013
Example of re-directing a google from away from boilerplate submission page...
View google-form-redirect
<!-- begin form container -->
<div class="ss-form">
<script type="text/javascript">var submitted=false;</script>
<iframe name="hidden_iframe" id="hidden_iframe" style="display:none;" onload="if(submitted) {window.location='***THIS IS THE URL OF THE PAGE TO REDIRECT'; alert('Thank you for your submission. We\'re manually updating submissions and will be adding yours soon.');}"></iframe>
<!-- begin form -->
<form action="***THIS IS THE URL FROM THE LIVE FORM USED TO POST TO" method="POST" target="hidden_iframe" id="commentForm" onsubmit="submitted=true;">
<div class="errorbox-good">
chrislkeller /
Last active Feb 25, 2021
Displaying data from a flat JSON file on a Handlebars.js template file rendered with AJAX.

Demo: ajax-handlebars

This repo's location has changed.

chrislkeller /
Last active Feb 20, 2021
Example of Calibre news download recipe

Recipe for Calibre news download

An example of creating a "news recipe" for Calibre to download news stories and covert to mobi or epub.

chrislkeller /
Last active Jan 22, 2021
Sync data across Google Spreadsheets

Snippets: Sync data across Google Spreadsheets

Added to a Google spreadsheet, this script will take data from a master spreadsheet and sync it to a working spreadsheet.

Variables to change are:

// source doc
var sss = SpreadsheetApp.openById('0An8....');

// source sheet
chrislkeller /
Last active Dec 18, 2020
SpreadSheet To Fusion Tables

Script to sync a Google SpreadSheet to a Fusion Table

Save for a few legacy projects that still use Fusion Tables I don't actively use this script anymore. This update hopefully solves the OAuth issue that cropped up once Google depcricated the Client Login method used by the prior version.

As always, your mileage may vary, and I welcome someone -- Google or otherwise -- to offer a long-term maintained solution.

The following is largely cribbed from a Google example here. I try to explain some of the API settings that must be enabled in the Developer's Console and elsewhere

Create your spr