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 / 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,
*
@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",
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
@MiniCodeMonkey
MiniCodeMonkey / bootswatch-picker.js
Last active February 1, 2016 18:02
Paste this in your JavaScript console to easily switch between Bootswatch styles to help pick the right one for your site
var themes = [
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/cerulean/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/cosmo/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/cyborg/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/darkly/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/flatly/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/journal/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/lumen/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/paper/bootstrap.min.css',
'//netdna.bootstrapcdn.com/bootswatch/3.3.6/readable/bootstrap.min.css',
<?php
$aws_key = '<key>';
$s3_secret = '<secret>';
$bucket_name = '<bucket>';
// Duration before request expires
$duration = (60 * 5); // 5 minutes
$objectName = $_GET['name'];
@MiniCodeMonkey
MiniCodeMonkey / gist:5729249
Last active December 18, 2015 04:59
.io not responding with name servers
mini@codemonkey:~$ nslookup filepicker.io
Server: 8.8.4.4
Address: 8.8.4.4#53
** server can't find filepicker.io: NXDOMAIN
mini@codemonkey:~$ nslookup www.filepicker.io
Server: 8.8.4.4
Address: 8.8.4.4#53
@MiniCodeMonkey
MiniCodeMonkey / fdsafds
Created January 23, 2013 14:46
fdsafdsaf
fdsa