Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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 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 / 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 / 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