Skip to content

Instantly share code, notes, and snippets.

View philgyford's full-sized avatar

Phil Gyford philgyford

View GitHub Profile
@philgyford
philgyford / artists_map_photos.html
Last active October 15, 2015 14:31
Quick demo of using APIs from The Echo Nest, Google Maps, and Flickr photos.
<!--
A form for a place.
When submitted, displays a list of music artists from that place.
And looks up the location with Google Geocoder and displays a map.
And displays Flickr photos from within that location.
REQUIRES:
* Echo Nest API Key.
* Google API Key (with access to JavaScript API and Geocoding API)
* Flickr API key
-->
@philgyford
philgyford / giphy_map_forecast.html
Last active April 15, 2020 23:06
Enter a location name, get a map, a weather forecast, and a Giphy image for each day's weather.
<!--
Enter a location name, submit the form.
Get a map, a weather forecast, and a Giphy image for each day's weather.
Requires API Keys for:
* Giphy: https://github.com/Giphy/GiphyAPI
* Forecast: https://developer.forecast.io/
* Google Maps JavaScript API Key
https://developers.google.com/maps/documentation/javascript/
-->
@philgyford
philgyford / apple-cinema-display.md
Created May 4, 2016 09:25
Apple Cinema Display
{{#post}}
{{#get "posts" limit="1" order="published_at desc" filter=“tag:getting-started+published_at:<{{published_at}}"}}
{{#foreach posts}}
<a href="{{url}}">{{title}}</a>
{{/foreach}}
{{/get}}
{{/post}}
@philgyford
philgyford / .block
Last active December 12, 2017 04:14
D3.js v4 Ladder Graph
license: cc-by-sa-4.0
height: 570
scrolling: no
border: yes
@philgyford
philgyford / resource_usage.py
Created July 22, 2017 13:56
File for displaying %CPU and RAM usage on a system. Not sure where I got this from originally.
#!/usr/bin/env python2.7
import subprocess
import sys
import re
import os,pwd
from pprint import pprint
class TerminalController:
"""
@philgyford
philgyford / .block
Last active December 12, 2017 04:14
Book series years chart
license: cc-by-sa-4.0
height: 1200
scrolling: no
border: yes
@philgyford
philgyford / .gitignore
Last active March 1, 2023 09:18
A script for importing images, and data about them in a CSV file, into WordPress
images/*
*.csv
@philgyford
philgyford / README.md
Created January 5, 2018 11:56
Find and replace text in Django objects' fields

Django Find and Replace

This was used to replace all the instances of old Media URLs with new ones, but could be used for any kind of text search/replace across Django objects.

  1. Change the model import to whatever your app and model is.
  2. Set the to_find and to_replace strings to whatever you need.
  3. Change Post to your model name, and the fields to whatever field(s) you want to search and replace across.
@philgyford
philgyford / postgres_migrate_to_sqlite3.md
Last active March 10, 2018 13:15
Migrating a Django postgresql database to sqlite3

Migrating a Django postgresql database to sqlite3

I wanted to export data from a few Django apps, held in a postgres database, and import that data into an sqlite3 database to run locally.

This worked for me, but I'm sure there are other wrinkles, depending on your use of postgres-specific features, etc.

  1. Export the data from postgres