Skip to content

Instantly share code, notes, and snippets.

View tmthyjames's full-sized avatar
🤷‍♂️

Timothy Dobbins tmthyjames

🤷‍♂️
View GitHub Profile
@cfergus
cfergus / index.html
Created October 25, 2012 23:10
Randomly generated sankey data. To show 'lane based' cycle rendering.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://d3js.org/d3.v2.js"></script>
<script type="text/javascript" src="./sankey.js"></script>
<title>Sankey Diagram</title>
<style>
@tmcw
tmcw / README.md
Created October 31, 2012 15:00
GIS with Python, Shapely, and Fiona Example 1 - CSV Files
@robwierzbowski
robwierzbowski / gitcreate.sh
Last active July 2, 2024 15:43
A simple litte script. Create and push to a new github repo from the command line.
#!/bin/bash
# https://gist.github.com/robwierzbowski/5430952/
# Create and push to a new github repo from the command line.
# Grabs sensible defaults from the containing folder and `.gitconfig`.
# Refinements welcome.
# Gather constant vars
CURRENTDIR=${PWD##*/}
GITHUBUSER=$(git config github.user)
@WarrenWeckesser
WarrenWeckesser / wavio.py
Last active January 7, 2023 17:21
**UPDATE** I'm now maintaining this Python module in a regular github repository at https://github.com/WarrenWeckesser/wavio
# wavio.py
# Author: Warren Weckesser
# License: BSD 3-Clause (http://opensource.org/licenses/BSD-3-Clause)
import wave
import numpy as np
def _wav2array(nchannels, sampwidth, data):
"""data must be the string containing the bytes from the wav file."""
@mdml
mdml / README.md
Last active March 30, 2023 16:30
Dendrograms: Convert from Scipy to D3

A dendrogram is a common way to represent hierarchical data. For Python users, Scipy has a hierarchical clustering module that performs hierarchical clustering and outputs the results as dendrogram plots via matplotlib. When it's time to make a prettier, more customized, or web-version of the dendogram, however, it can be tricky to use Scipy's dendrogram to create a suitable visualization. My preferred method of visualizing data -- especially on the web -- is D3. This example includes a script to convert a Scipy dendrogram into JSON format used by D3's cluster method.

In the example, I cluster six genes by their expression values from two experiments. You can easily replace that data with your own, larger data set, to harness the power of both Scipy and D3 for analyzing hierarchical data. The D3 code I used to generate this example is straigh

@jwass
jwass / geojsonio_embed.ipynb
Created August 18, 2014 18:02
Embed geojson.io in a Jupyter / IPython notebook using geojsonio.py
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
/* Kinda like Python's defaultdict, but for JS*/
function defDict(type) {
var dict = {};
return {
get: function (key) {
if (!dict[key]) {
dict[key] = type.constructor();
}
return dict[key];
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@bonzanini
bonzanini / config.py
Last active July 20, 2024 15:06
Twitter Stream Downloader
consumer_key = 'your-consumer-key'
consumer_secret = 'your-consumer-secret'
access_token = 'your-access-token'
access_secret = 'your-access-secret'
@dastergon
dastergon / ec2_info_retriever.py
Last active May 29, 2024 05:17
A basic boto3 based tool for retrieving information from running EC2 instances.
from collections import defaultdict
import boto3
"""
A tool for retrieving basic information from the running EC2 instances.
"""
# Connect to EC2
ec2 = boto3.resource('ec2')