Skip to content

Instantly share code, notes, and snippets.

View Sonophoto's full-sized avatar
🥧
On vacation

Brig Young Sonophoto

🥧
On vacation
View GitHub Profile
@Sonophoto
Sonophoto / city.json
Last active December 20, 2017 06:25
Example of using python to perform simple ETL on JSON data to a flat Sqlite3 table
[
{
"name": "Chicago, IL",
"id": 1,
"scores": {
"walkability": 1.7,
"job_growth": 2.32,
"green_space": 0.9,
"taxes": 0.6
}
@Sonophoto
Sonophoto / get_post_example.py
Created December 12, 2017 22:57
Simple example of GET and POST with Cherrypy
import cherrypy
html_header = \
"""
<html>
<head>
<title>Example of GET and POST</title>
</head>
<body>
"""
@Sonophoto
Sonophoto / Makefile
Created November 30, 2016 04:30
Demonstrate templating with Makefile target and /bin/echo
#****************************************************************************
#
# GNU/ __ __ _ __ _ _
# /gmake | \/ | __ _| | _____ / _(_) | ___
# / | |\/| |/ _` | |/ / _ \ |_| | |/ _ \
# /BSD-2c | | | | (_| | < __/ _| | | __/
# |_| |_|\__,_|_|\_\___|_| |_|_|\___|
#
# HEREDOC
#
@Sonophoto
Sonophoto / gist:461d35f7e1d5d1873d59b58c32be56ad
Last active November 30, 2016 04:17
A Virtual Environment Trick using virtualenv
#A Virtual Environment Trick using virtualenv
***Full Disclosure (YMMV):***
_virtualenv_
--version: 15.0.2
_Mint 17.1 MATE_
uname: Linux [hostname] 3.13.0-37-generic #64-Ubuntu SMP [datetime] i686 athlon i686 GNU/Linux
_Python 2.7 Package Installed_
--version: Python 2.7.6
@Sonophoto
Sonophoto / gist:602a923274a900fd5d49de69756e2c43
Last active June 20, 2016 01:50
The infamous python comma
so a C programmer sees:
a, b=b, a
and thinks:
(a), (b=b), (a)
and wonders WTF?
but python thinks:
(a,b) = (b,a)
and swaps a and b with no more effort and no intermediate...