Skip to content

Instantly share code, notes, and snippets.

View ajturner's full-sized avatar
🗺️
Considering WhereCamps

Andrew Turner ajturner

🗺️
Considering WhereCamps
View GitHub Profile
import base64 as b64
import numpy as np
import cv2
import matplotlib.pyplot as plt
from ipywidgets import interact, interactive, fixed
from IPython.display import Image, display
import ipywidgets as widgets
from itertools import tee, izip
WINDOW_SIZE = 41 # size of window to use when computing averages. Endpoint images outside
@phpmaps
phpmaps / portal-test-leaflet
Created September 14, 2015 16:52
Portal test leaflet
<!DOCTYPE html>
<html lang="en">
<head>
<title>Portal Pagnation</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.3.5/js/bootstrap.min.js"></script>
@domenic
domenic / 0-github-actions.md
Last active April 8, 2024 23:35
Auto-deploying built products to gh-pages with Travis

Auto-deploying built products to gh-pages with GitHub Actions

This is a set up for projects which want to check in only their source files, but have their gh-pages branch automatically updated with some compiled output every time they push.

A file below this one contains the steps for doing this with Travis CI. However, these days I recommend GitHub Actions, for the following reasons:

  • It is much easier and requires less steps, because you are already authenticated with GitHub, so you don't need to share secret keys across services like you do when coordinate Travis CI and GitHub.
  • It is free, with no quotas.
  • Anecdotally, builds are much faster with GitHub Actions than with Travis CI, especially in terms of time spent waiting for a builder.
@lelandbatey
lelandbatey / whiteboardCleaner.md
Last active April 25, 2024 02:01
Whiteboard Picture Cleaner - Shell one-liner/script to clean up and beautify photos of whiteboards!

Description

This simple script will take a picture of a whiteboard and use parts of the ImageMagick library with sane defaults to clean it up tremendously.

The script is here:

#!/bin/bash
convert "$1" -morphology Convolve DoG:15,100,0 -negate -normalize -blur 0x1 -channel RBG -level 60%,91%,0.1 "$2"

Results

#!/bin/bash
#### SETUP
# 1.) Create a simple point layer
curl -X POST -d '{"layer":"geom","lat":"lat","lon":"lon"}' --header "Content-Type:application/json" http://localhost:7474/db/data/ext/SpatialPlugin/graphdb/addSimplePointLayer
# 2.) Add a spatial index
curl -X POST -d '{"name":"geom","config":{"provider":"spatial","geometry_type":"point","lat":"lat","lon":"lon"}}' --header "Content-Type:application/json" http://localhost:7474/db/data/index/node/
@oevans
oevans / AGO_PullHostedFeatures.py
Last active April 16, 2024 18:37
Python script to pull hosted features with attachments into a local file geodatabase. See ReadMe below.
import os, urllib, urllib2, datetime, arcpy, json
## ============================================================================== ##
## function to update a field - basically converts longs to dates for date fields ##
## since json has dates as a long (milliseconds since unix epoch) and geodb wants ##
## a proper date, not a long.
## ============================================================================== ##
def updateValue(row,field_to_update,value):
outputfield=next((f for f in fields if f.name ==field_to_update),None) #find the output field

The command I used to estimate the size once gzipped is gzip -c filename.min.js | wc -c. Every library except open layers includes it CSS in the total size. Esri Standard includes the Claro widget theme but compact does not.

@max-mapper
max-mapper / blink-led.js
Last active April 13, 2022 20:30
raspberry pi scripts
@tmcw
tmcw / README.md
Created September 21, 2012 03:45
OSM Growth

What is this? It's about 7 years of OpenStreetMap growth. Each step in the animation is 72 days, and the colors alternate between red and blue. The data is from Latest Weekly Changesets from planet.openstreetmap.org, processed into an SQLite database with sometimemachine. The points being drawn are the centers of the bounding boxes of changesets. There are 13,098,655 changesets in the database. The script to generate the visualization is below, and the rest of the make steps are

gm mogrify -format gif *.png
gifsicle --loop -d20 *.gif > ../animation.gif

Requiring gifsicle and graphicsmagick.

Fast growth in rectangular areas (like the DRC) is typically because of imports to the OSM data from other open datasources. The d

@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this: