Skip to content

Instantly share code, notes, and snippets.

View enjalot's full-sized avatar

Ian Johnson enjalot

View GitHub Profile
@enjalot
enjalot / cors_server.py
Created June 10, 2012 06:19
Allow CORS with python simple http server
import SimpleHTTPServer
class CORSHTTPRequestHandler(SimpleHTTPServer.SimpleHTTPRequestHandler):
def send_head(self):
"""Common code for GET and HEAD commands.
This sends the response code and MIME headers.
Return value is either a file object (which has to be copied
to the outputfile by the caller unless the command was HEAD,
and must be closed by the caller under all circumstances), or
@enjalot
enjalot / bar.js
Created December 27, 2011 22:21
Basic CSV Parsing
//Simple d3.js barchart example to illustrate d3 selections
//other good related tutorials
//http://www.recursion.org/d3-for-mere-mortals/
//http://mbostock.github.com/d3/tutorial/bar-1.html
var w = 850
var h = 400
var bars = function(data)
@enjalot
enjalot / README.md
Last active October 9, 2024 12:17
aframe + d3 test

Testing out aframe.io with d3.js.

Since AFrame works with DOM elements, you can use d3's selection API to generate and modify 3D elements, as well as handle "mouse" events (including the VR friendly "fuse cursor") as if it was SVG.

Built with blockbuilder.org

@enjalot
enjalot / embedding.py
Created June 5, 2024 22:00
trying to parallelize embedding on modal
import os
import json
import time
import asyncio
import subprocess
from modal import App, Image, Secret, Volume, build, enter, exit, gpu, method
# We first set out configuration variables for our script.
## Embedding Containers Configuration
@enjalot
enjalot / index.html
Created September 8, 2011 15:15
Simple Pie Chart example with D3.js
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=utf-8">
<title>Testing Pie Chart</title>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.geom.js?2.1.3"></script>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.layout.js?2.1.3"></script>
<style type="text/css">
@enjalot
enjalot / clone.js
Created February 8, 2021 17:53
a set of scripts to pull the git history from the d3 git repositories
let fs = require("fs")
let {exec} = require("child_process")
// read package.json
let packageText = fs.readFileSync("./d3/package.json").toString()
let packageJson = JSON.parse(packageText)
// loop through dependencies
let depends = Object.keys(packageJson.dependencies)
console.log("dependencies", depends)
// clone each repo
@enjalot
enjalot / README.md
Last active December 5, 2023 00:14
slave voyages - embarking

Slave Voyages - Embarking

This is an attempt at visualizing the relative scale of the slave trade by country. The data comes from slavevoyages.org.

The visualization is inpsired by the Mountains-out-of-molehills visualization. The focus is to communicate the relative scale over time, giving us a sense of activity over time of this attrocious part of our history.

@enjalot
enjalot / README.md
Last active November 27, 2023 00:28
Bookmarklet
@enjalot
enjalot / README.md
Last active November 16, 2023 05:10
Stacked-to-Grouped Police Killings
@enjalot
enjalot / README.md
Last active November 14, 2023 23:06
mapping police violence: data

I wanted to explore the data collected by Mapping Police Violence
Using Tabletop.js to get data from the public spreadsheet URL.

Unfortunately each month of data has a slightly different set of column headers and values. I've attempted to normalize all entries to have the same schema:

{
    "name": "Donald Lewis Matkins",
    "race": "Unknown race",
    "gender": "Male",
 "state": "MS",