Skip to content

Instantly share code, notes, and snippets.

View kevinmarks's full-sized avatar

Kevin Marks kevinmarks

View GitHub Profile
@simonw
simonw / csv_example.py
Created July 10, 2015 18:24
Here's how to use Python to output an Excel-compatible CSV (actually TSV) file from a command-line script. You can then use this pattern: "python csv_example.py | pbcopy" to copy the output to your clipboard, then just focus on a cell in Excel or Google Sheets and hit "paste" to copy the data into a bunch of cells.
import csv, sys
def fetch_data():
# Returning some example data - hit a JSON API or something here
return [{
"name": "Name 1",
"age": 32,
"description": "Look, we can use commas and\ttabs & stuff in here!",
}, {
"name": "Name 2",
@chan-lee
chan-lee / sample_etag_memcache.py
Last active November 21, 2016 22:17
using etag and memcache with webapp2 in app engine
# -*- coding: utf-8 -*-
import webapp2
from model import *
from google.appengine.api import memcache
import hashlib
import logging
import random
import string
import json