Skip to content

Instantly share code, notes, and snippets.

var chinaAirports = db.airports.find({countryName:"China"}).map(x=>x._id)
var USAirports = db.airports.find({countryName:"United States"}).map(x=>x._id)
var mapFunction = function() {
var monthPtr = new Date(this.effectiveDate);
monthPtr.setDate(1);
while(monthPtr <= this.discontinuedDate) {
var dayPtr = new Date(monthPtr);
var nextMontStart = new Date(monthPtr);
nextMontStart.setMonth(monthPtr.getMonth() + 1);
@nathanathan
nathanathan / leafletSnippet.js
Created January 21, 2016 13:57
Generating raster maps in Python for use in Leaflet
// This covers the full web-mercator range
imageBounds = [[-85.051129, -180], [85.051129, 180]]
L.imageOverlay('/test.png', imageBounds).addTo(map)
@nathanathan
nathanathan / setup-development-env.sh
Last active February 18, 2020 10:02
How I setup my IPython/c9 development environment
# I like to set up a c9.io ssh workspace for terminal access and editing files.
# In order to do that it's necessairy to install a recent version of node.js
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install -y gcc g++ make nodejs git
# This is the c9 set-up script. I'm not positive it will remain valid forever.
curl https://raw.github.com/c9/install/master/install.sh | bash
# You will also need to add your c9 key to .ssh/authorized_keys
# Python setup

FLOSS Weekly

A talk show about open source software. Every week a different open source project is featured along with a guest who is somehow involved in it.

Clarksworld Magazine

SciFi short stories. These are some of my favorites:

walk = document.createTreeWalker(document, NodeFilter.SHOW_TEXT, null, false);
prevSentence = "";
sentences = [''];
while(n=walk.nextNode()) {
nextSentences = n.nodeValue.split('.');
sentences[sentences.length - 1] += nextSentences.pop();
sentences = sentences.concat(nextSentences);
}
sentences.forEach(function(sentence){
if(/test/gi.test(sentence)) console.log(sentence);
@nathanathan
nathanathan / filter.js
Created December 13, 2013 20:37
Spectrum noise filter
//Implementation of Fastie's macro for identifying emission or absorption lines
//see: https://github.com/jywarren/spectral-workbench/issues/184
/*
Description:
To objectively determine the wavelengths of emission or absorption lines,
you have to separate signal from noise in a graph of wavelength intensities.
Especially when looking for peaks or valleys that disrupt a continuous (black body radiation) spectrum,
the low frequency (maybe > 20 nm) information becomes noise.
To eliminate it, fit a cubic spline or other easily adjustable curve to each color channel separately.
Compute the deviations of each channel from its curve and average the three new curves into a single curve,
@nathanathan
nathanathan / download.js
Last active December 28, 2015 16:49
Macro for downloading [spectral workbench](http://spectralworkbench.org/) curves as csvs
setup: function() {
$('#myModal').remove();
$('body').append('<div class="modal fade" id="myModal" role="dialog"><div class="modal-content dl-btns"></div></div>');
$.each($W.data, function(idx, data){
var $dlBtn = $('<a class="btn btn-success dl-btn">Download ' + (data.label || "") + ' csv<a>');
$dlBtn.css('margin', 5);
$('.dl-btns').append($dlBtn);
var csv = $.map(data.data, function(row, idx){
return row.join(',');
}).join('\n');
@nathanathan
nathanathan / FastieEmissionAbsorbtion.js
Last active December 28, 2015 07:18 — forked from jywarren/smooth.js
Implementation of Fastie's macro for identifying emission or absorption lines. see: https://github.com/jywarren/spectral-workbench/issues/184
//Implementation of Fastie's macro for identifying emission or absorption lines
//see: https://github.com/jywarren/spectral-workbench/issues/184
/*
Description:
To objectively determine the wavelengths of emission or absorption lines,
you have to separate signal from noise in a graph of wavelength intensities.
Especially when looking for peaks or valleys that disrupt a continuous (black body radiation) spectrum,
the low frequency (maybe > 20 nm) information becomes noise.
To eliminate it, fit a cubic spline or other easily adjustable curve to each color channel separately.
Compute the deviations of each channel from its curve and average the three new curves into a single curve,

zoho mail Webmail provider that supports custom domains (see also: mail.live.com)

mx domain lookup Used it to debug issues when setting up custom email domains.

image proxy Caches and resizes images for websites

picozu web image editor I like this one because there is no sign-up and you can drag and drop onto it.