Skip to content

Instantly share code, notes, and snippets.

@richarddunks
richarddunks / idea.md
Created March 7, 2023 03:17 — forked from datapolitan/idea.md
Idea for git-powered distributed dataset management

The Problem:

If you follow the open data scene, you'll often hear about how the "feedback loop" for making corrections, comments, or asking questions about datasets is either fuzzy, disjointed, or nonexistent. If I know for a fact that something in a government dataset is wrong, how do I get that record fixed? Do I call 311? Will the operator even know what I am talking about if I say I want to make a correction to a single record in a public dataset? There's DAT. There's storing your data as a CSV in Github. These approaches work, but are very much developer-centric. (Pull requests and diffs are hard to wrap your head around if you spend your day analyzing data in Exce

@richarddunks
richarddunks / Design_thinking_Outline.md
Created March 7, 2023 03:18 — forked from datapolitan/Design_thinking_Outline.md
Outline for curriculum design using design thinking

Welcome (1 min)

Introductions (10 mins)

  • Name
  • Short background
  • One thing you enjoy about teaching

Student profile (4 mins)

/* Function: ST_Buffer_Meters(geometry, double precision)
DROP FUNCTION ST_Buffer_Meters(geometry, double precision);
Usage: SELECT ST_Buffer_Meters(the_geom, num_meters) FROM sometable; */
CREATE OR REPLACE FUNCTION ST_Buffer_Meters(geometry, double precision)
RETURNS geometry AS
$BODY$
DECLARE
orig_srid int;
/* Function: utmzone(geometry)
DROP FUNCTION utmzone(geometry);
Usage: SELECT ST_Transform(the_geom, utmzone(ST_Centroid(the_geom))) FROM sometable; */
CREATE OR REPLACE FUNCTION utmzone(geometry)
RETURNS integer AS
$BODY$
DECLARE
geomgeog geometry;
zone int;
@richarddunks
richarddunks / legend_snippet.html
Created March 7, 2023 03:20 — forked from datapolitan/legend_snippet.html
Snippet of HTML and CSS for the legend box
<html>
<head>
<style>
#legend {
position:absolute;
bottom:20px;
right: 5px;
background: #D3D3D3;
border-radius: 10px;
display: block;
@richarddunks
richarddunks / map_snippet.js
Created March 7, 2023 03:21 — forked from datapolitan/map_snippet.js
A snippet for creating a map with multiple layers in CartoDB
// the center point of the map on load. Change this to adjust the center point of the map.
var map_centerpoint = [40.712784, -74.005941];
// zoom level of the map on load. Higher number zooms the map in closer
var zoom_level = 11
// your visualization layer from CartoDB
var myVizLayer = 'https://richard-datapolitan.cartodb.com/api/v2/viz/c35e85b2-5370-11e5-b844-0e9d821ea90d/viz.json';
// the name of the CartoDB table you want to query against
var point_table_name = 'map_data_sgr';
var line_table_name = 'nyct_routes_1';
var sublayers=[];
@richarddunks
richarddunks / matplotlib_pandas_ec2.sh
Created March 7, 2023 03:21 — forked from datapolitan/matplotlib_pandas_ec2.sh
Installation of packages to get matplotlib and pandas installed on Amazon EC2 instance
#!/bin/bash
sudo yum install update
sudo yum groupinstall "Development Tools"
sudo yum install python-devel libpng-devel freetype-devel
#the last two are necessary for pip to run without failing with error 'Command "python setup.py egg_info" failed with error code 1'
sudo pip install matplotlib pandas #Finally it works!
@richarddunks
richarddunks / load_dmp_2_cartodb.sh
Created March 7, 2023 03:21 — forked from datapolitan/load_dmp_2_cartodb.sh
Use Postgres dump files to populate CartoDB instance
#!/bin/bash
#------------------------------------------------------------
# We assume the dump files have been generated using pg_dump:
#
# pg_dump -a --column-inserts -x -O -t table_name database_name -f /tmp/dmp_file_name
#
#------------------------------------------------------------
# Provide details of your CartoDB account:
@richarddunks
richarddunks / cartodb_template.html
Created March 7, 2023 03:22 — forked from datapolitan/cartodb_template.html
A template for getting started integrating CartoDB into your interactive web mapping project.
<!DOCTYPE html>
<!-- Based on an example from Chris Whong's class on creating a basic interactive map with JavaScript. See the CartoDB Academy for a step-by-step tutorial: http://docs.cartodb.com/tutorials/create_map_cartodbjs.html -->
<html>
<head>
<title>Your Title Here</title>
<meta name="viewport" content="initial-scale=1.0, user-scalable=no" />
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<link rel="shortcut icon" href="http://cartodb.com/assets/favicon.ico" />
@richarddunks
richarddunks / example_git_remote_alias.sh
Created March 7, 2023 03:23 — forked from datapolitan/example_git_remote_alias.sh
replacing host in git remote command
git remote set-url origin [email protected]:user1/your-repo-name.git