Skip to content

Instantly share code, notes, and snippets.

@mpetroff
mpetroff / photo-sphere.txt
Created November 5, 2012 21:24
Exiv2 Google Photo Sphere command file
# Exiv2 Google Photo Sphere command file
# -------------------------
#
# $ exiv2 -m photo-sphere.txt file ...
reg GPano http://ns.google.com/photos/1.0/panorama/
set Xmp.GPano.UsePanoramaViewer XmpText True
set Xmp.GPano.ProjectionType XmpText equirectangular
set Xmp.GPano.CroppedAreaImageWidthPixels XmpText 4096
-- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
--
-- $Id: cleanGeometry.sql 2008-04-24 10:30Z Dr. Horst Duester $
--
-- cleanGeometry - remove self- and ring-selfintersections from
-- input Polygon geometries
-- http://www.kappasys.ch
-- Copyright 2008 Dr. Horst Duester
-- Version 1.0
-- contact: horst dot duester at kappasys dot ch
@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
@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 / 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 / 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 / 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 / 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 / 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 / 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%;