Skip to content

Instantly share code, notes, and snippets.

@hugolpz
hugolpz / Wikidata-API-via-JS.markdown
Last active March 21, 2024 14:49
Wikidata API via JS

Create an AMI using Packer

What is Packer?

Packer is a tool from Hashicorp that allows you to create machine images in a variety of formats from a single spec file. This can be a very powerful thing when you want to automate the deployment of applications to a variety (or even just more than one, really) platforms.

In our case, we want to deploy an application to VMware and AWS, and soon to Docker. Doing that with a single spec file gives us

  • platforms that are consistent, even if they're different
@jfreels
jfreels / README.md
Last active May 27, 2021 09:39
d3js: Create an HTML select box using d3.js and create a paragraph referencing the selection.

d3js: Create an HTML select box using d3.js and create a paragraph referencing the selection.

Functions, how do they work?

A good friend asked me how functions work under the covers, so I wrote up this quick explanation. Corners are cut for brevity, but I hope it will convey the general idea.

The three assembly language programs below implement the following (super simple) recursive function:

@geotheory
geotheory / 3d_mapping
Last active July 1, 2021 18:01
Plotting 3D maps using OpenStreetMap and RGL.
# Plotting 3D maps using OpenStreetMap and RGL. For info see:
# http://geotheory.co.uk/blog/2013/04/26/plotting-3d-maps-with-rgl/
map3d <- function(map, ...){
if(length(map$tiles)!=1){stop("multiple tiles not implemented") }
nx = map$tiles[[1]]$xres
ny = map$tiles[[1]]$yres
xmin = map$tiles[[1]]$bbox$p1[1]
xmax = map$tiles[[1]]$bbox$p2[1]
ymin = map$tiles[[1]]$bbox$p1[2]
@jczaplew
jczaplew / README.md
Last active September 14, 2017 23:21
Responsive TopoJSON Sizing with d3.js

States will adjust in size relative to the width of the container div, which allows SVG elements to be appropriately sized regardless of device size or screen resolution, making it a good way to integrate D3 and Bootstrap.

Click "Open in a new window", change the size of your browser window, and the states will scale with it. *Will not work in the standard bl.ocks.org view

Please let me know if there is a better/native way to do this!

@chmille4
chmille4 / gist:4253645
Created December 10, 2012 21:43
Make scribl scrollable and zoomable with jQRangeSlider
<!DOCTYPE>
<html>
<head>
<script src="http://chmille4.github.com/Scribl/js/Scribl.1.0.min.js"></script>
<script src="http://chmille4.github.com/Scribl/js/genbankData.js"></script>
<link rel="stylesheet" id="themeCSS" href="http://chmille4.github.com/Scribl/css/iThing.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.9.2/jquery-ui.min.js"></script>
<script src="http://static.tumblr.com/fcdode8/Giymeu17u/jquery.mousewheel.min.js"></script>
<script src="http://static.tumblr.com/fcdode8/WVbmeu18t/jqallrangesliders-min.js"></script>
@dsparks
dsparks / pokePlot.R
Created October 13, 2012 06:13
Ridiculous Pokemon plot
# Truly the most ridiculous thing I could think of.
doInstall <- TRUE # Change to FALSE if you don't want packages installed.
toInstall <- c("XML", "png", "devtools", "RCurl")
if(doInstall){install.packages(toInstall, repos = "http://cran.r-project.org")}
lapply(toInstall, library, character.only = TRUE)
# Some helper functions, lineFinder and makeTable
source_gist("818983")
source_gist("818986")
@brwnj
brwnj / joinreads.py
Last active August 15, 2016 21:09
join paired-end or print unique single-end reads
#!/usr/bin/env python
# encoding: utf-8
"""
Join R1 and R2, or print unpaired reads of R1 or R2
This script assumes there is whitespace separating the readname from the pair number:
> <
@HW-ST997:140:D0UA5ACXX:8:1101:1497:2138 1:N:0:ATCACG
@HW-ST997:140:D0UA5ACXX:8:1101:1497:2138 2:N:0:ATCACG
@ummels
ummels / mydiss.cls
Last active March 27, 2024 14:56
Class file for my PhD thesis
% Copyright (c) 2010 Michael Ummels <michael@ummels.de>
%
% Permission to use, copy, modify, and/or distribute this software for any
% purpose with or without fee is hereby granted, provided that the above
% copyright notice and this permission notice appear in all copies.
%
% THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
% WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
% MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
% ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES