Skip to content

Instantly share code, notes, and snippets.

View MiniCodeMonkey's full-sized avatar

Mathias Hansen MiniCodeMonkey

View GitHub Profile
<?php
require('vendor/autoload.php');
use GuzzleHttp\Client;
use GuzzleHttp\Exception\RequestException;
use GuzzleHttp\Pool;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
$batchSize = 2000; // How many addreses to process per batch geocoding API request
$concurrency = 4; // How many batches to process concurrently
@MiniCodeMonkey
MiniCodeMonkey / .tmux.conf
Created April 13, 2020 01:59
tmux config
# make sure nvim looks normal in tmux
#set -g terminal-overrides ',xterm-256color:Tc'
set -g default-terminal "tmux-256color"
#set -as terminal-overrides ',xterm*:sitm=\E[3m'
set -g history-limit 50000
setw -g mode-keys vi
set -g renumber-windows on
# so that escapes register immidiately in vim
@MiniCodeMonkey
MiniCodeMonkey / geocodio_batch_output.json
Created November 11, 2019 15:53
Geocodio Sample output for a batch of two addresses
{
"results": [
{
"query": "1109 N Highland St, Arlington VA",
"response": {
"input": {
"address_components": {
"number": "1109",
"predirectional": "N",
"street": "Highland",
@MiniCodeMonkey
MiniCodeMonkey / tailwind-1-color-update.js
Created June 3, 2019 16:38
Replaces tailwind 0.x color CSS classes with 1.0 names
const fs = require('fs');
const path = require('path');
/**
* Replaces tailwind 0.x color CSS classes with 1.0 names
* E.g. "bg-grey-light" is replaced with "bg-gray-400"
*
* This is a "dumb" replacement that searches for string patterns across the
* specified files,
*
We can make this file beautiful and searchable if this error is corrected: It looks like row 7 should actually have 15 columns, instead of 1. in line 6.
latitude,longitude,full_address,Latitude,Longitude,"Accuracy Score","Accuracy Type",Number,Street,City,State,County,Zip,Country,Source
35.67077925703927,-78.82521725019633,"108 BOATDOCK DR, HOLLY SPRINGS, NC 27540",35.670773,-78.825206,1,rooftop,108,"Boatdock Dr","Holly Springs",NC,"Wake County",27540,US,Cary
35.86182403271283,-78.53973585742347,"5305 FORSYTH PARK ST, RALEIGH, NC 27616",35.831189,-78.659428,0.6,street_center,,"Forsyth St",Raleigh,NC,"Wake County",27609,US,"TIGER/Line® dataset from the US Census Bureau"
35.760958787507256,-78.88079964780793,"7020 JENKS RD, UNINCORPORATED, NC 27519",35.760953,-78.880796,1,rooftop,7020,"Jenks Rd",Cary,NC,"Wake County",27519,US,Cary
35.93202626254228,-78.5683112135329,"2759 HIDDEN WATERS CIR, RALEIGH, NC 27614",35.932033,-78.568314,1,rooftop,2759,"Hidden Waters Cir",Raleigh,NC,"Wake County",27614,US,Wake
35.90069083020205,-78.66516671549235,"1505 PECORE PL, RALEIGH, NC 27615",35.900698,-78.665169,1,rooftop,1505,"Pecore Pl",Raleigh,NC,"Wake County",27615,US,Wake
3
@MiniCodeMonkey
MiniCodeMonkey / convert.sh
Last active February 11, 2016 01:58
PNG to 3d object for 3d printing
#!/bin/sh
for f in *.png
do
filename=${f%.*}
echo "Processing $filename"
# png -> bmp
convert $filename.png -normalize -fx 'a==0 ? white : u' $filename.bmp
# trace bitmap to eps
curl -X POST \
-H "Content-Type: application/json" \
-d '{"KeyA": "42370 Bob Hope Drive, Rancho Mirage CA", "KeyB": "1290 Northbrook Court Mall, Northbrook IL", "KeyC": "4410 S Highway 17 92, Casselberry FL", "KeyD": "15000 NE 24th Street, Redmond WA", "KeyE": "17015 Walnut Grove Drive, Morgan Hill CA"}' \
https://api.geocod.io/v1/geocode?api_key=YOUR_API_KEY
<?php
if ( !function_exists('wp_rand') ) :
/**
* Generates a random number
*
* @since 2.6.2
*
* @param int $min Lower limit for the generated number
* @param int $max Upper limit for the generated number
* @return int A random number between min and max
<?php
$query = trim($query, " \t\n\r\0\x0B,.:|?!+=()[]{}@#$%^&_-");
{
"name": "Geocodio",
"description": "Ridiculously cheap bulk geocoding",
"image": "http://geocod.io/img/logo_inv_original.png",
"url": "https://geocod.io",
"type": "default",
"version": "1.0",
"apis": [
{