Skip to content

Instantly share code, notes, and snippets.

@mpetroff
mpetroff / index.html
Created October 30, 2021 20:41
Implementation of "A Square Equal-Area Map Projection with Low Angular Distortion, Minimal Cusps, and Closed-Form Solutions": https://doi.org/10.1145/3460521
<!DOCTYPE html>
<html lang="en">
<meta charset="utf-8">
<title>New Projection</title>
<style>
.stroke {
fill: none;
stroke: #000;
stroke-width: 2px;
}
@mpetroff
mpetroff / planck-ml-map.fits
Last active April 28, 2020 17:33
Foreground-cleaned CMB map from Planck data and "Full-sky Cosmic Microwave Background Foreground Cleaning Using Machine Learning"
This file has been truncated, but you can view the full file.
@mpetroff
mpetroff / index.html
Created October 24, 2017 13:05
Pannellum NEAREST interpolation test
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>NEAREST interpolation test</title>
<link rel="stylesheet" href="pannellum.css"/>
<script type="text/javascript" src="pannellum.js"></script>
<style>
html, body, #panorama {
height: 100%;
@mpetroff
mpetroff / configuration-file-decoder.py
Created August 28, 2016 17:35
Ricoh Theta desktop application configuration file decoder
#!/usr/bin/env python
'''
Decodes encrypted configuration file for Ricoh Theta desktop application.
I'm not sure what the point of double AES encryption is when the key is
embedded right in the executable.
Requires pycryto
Matthew Petroff <https://mpetroff.net/>, 2016
@mpetroff
mpetroff / jail.local
Last active December 19, 2023 12:06
JupyterHub PAM Authentication Fail2ban Configuration
# /etc/fail2ban/jail.local
[jupyterhub]
enabled = true
port = 443
filter = jupyterhub
backend = systemd
maxretry = 6
@mpetroff
mpetroff / find-subarray.js
Created January 21, 2016 22:44
Find subarray in JavaScript
function findSubarray(arr, subarr) {
for (var i = 0; i < 1 + (arr.length - subarr.length); i++) {
var j = 0;
for (; j < subarr.length; j++)
if (arr[i + j] !== subarr[j])
break;
if (j == subarr.length)
return i;
}
return -1;
@mpetroff
mpetroff / index.html
Created March 28, 2015 02:29
Bootstrap Navbar without jQuery
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags -->
<title>Navbar Template for Bootstrap</title>
@mpetroff
mpetroff / tms_to_xyz.py
Created October 4, 2014 17:53
Convert between tms and xyz map tile structures
#!/usr/bin/python
# Converts between tms and xyz map tile structures
# October 2014, Matthew Petroff <http://mpetroff.net>
# Released into the public domain using the CC0 Public Domain Dedication
# See <http://creativecommons.org/publicdomain/zero/1.0/>
import os
import subprocess
@mpetroff
mpetroff / process.sh
Created October 4, 2014 17:25
Convert marine gravity anomaly map to GeoTIFF
# Convert to NetCDF
img2grd grav.img.23.1 -Ggrav.nc -Rg
# Reencode since gdal didn't like NetCDF file
cdo -f nc4c -k lines copy grav.nc grav2.nc
# Create GeoTIFF
gdal_translate -a_srs EPSG:4326 grav2.nc grav.tif
# Reproject as EPSG:3857
@mpetroff
mpetroff / navspark-gps-library-c-files.txt
Created May 31, 2014 01:56
NavSpark GPS Library C Files
allocator.c
almanac.c
asic_gtc_latch.c
asic_noise_channel.c
asic_pse_share.c
asic_rtc.c
asic.c
batch_predict_orbit.c
binmsg.c
bitcount_handler.c