Skip to content

Instantly share code, notes, and snippets.

View leighghunt's full-sized avatar

Leigh Hunt leighghunt

View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
def convert_json(items):
import json
return json.dumps({ "type": "FeatureCollection",
"features": [
{"type": "Feature",
"geometry": { "type": "Point",
"coordinates": [
float(feature['store_geocode'].split(',')[0]),
float(feature['store_geocode'].split(',')[1])
]},
  • Per server:
sudo apt-get install apache2 mysql-server php5 php5-gd php5-mysql php5-curl php5-tidy
curl -s https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
sudo composer self-update
sudo vim /etc/php5/apache2/php.ini
  date.timezone = Pacific/Auckland
sudo a2enmod rewrite
@leighghunt
leighghunt / del_temp_files.py
Last active February 2, 2016 21:39
Delete windows temp files
#!/usr/bin/python
# run by crontab
# removes any files and folders in /tmp/ older than 1 day
# modified from http://pp19dd.com/2013/10/python-script-to-remove-tmp-files-older-than-7-days/
import os, sys, time, shutil
from subprocess import call
@leighghunt
leighghunt / osrm-ec2-install.md
Last active February 18, 2019 20:49
OSRM EC2 install
  • Mount data volume
lsblk 
sudo file -s /dev/xvdb
sudo mkfs -t ext4 /dev/xvdb
sudo mkdir /mnt/data
sudo mount /dev/xvdb /mnt/data
sudo chmod gou+wrx /mnt/data
sudo vim /etc/fstab
@leighghunt
leighghunt / aws-grant-access.sh
Created March 23, 2016 19:48
aws-grant-access
#!/bin/bash
# By Ed Wiget
# This is run via cron whenever my ip address changes in order to update aws security group
# 20131120 - original script
# Copied from http://www.edwiget.name/2013/11/automatically-changing-dynamic-ips-in-aws-security-group/#codesyntax_7
############################################################################################################################################

Keybase proof

I hereby claim:

  • I am leighghunt on github.
  • I am leighghunt (https://keybase.io/leighghunt) on keybase.
  • I have a public key ASC8Zo8mGRJMo1Yw-DNxGBQSrrx6WnzAOKiPnLJUrvpX-go

To claim this, I am signing this object:

@leighghunt
leighghunt / multiple-deploy-keys.md
Created November 7, 2016 01:49
Multiple github deploy keys on one server

vim ~/.ssh/config

Host <site-prefix-1>.github.com
  HostName github.com
  User git
  IdentityFile /c/Users/Administrator/.ssh/<site-prefix-1>.id_rsa
  IdentitiesOnly yes
@leighghunt
leighghunt / index.html
Created February 9, 2017 01:16 — forked from anonymous/index.html
Vector tiles - 4.2 [Vector tiles - 4.2] // source https://jsbin.com/ruvisab
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=Edge" />
<meta name="viewport" content="initial-scale=1,maximum-scale=1,user-scalable=no"
/>
<meta name="description" content="[Vector tiles - 4.2]">
<!--
ArcGIS API for JavaScript, https://js.arcgis.com
# List wireless networks
sudo iw dev wlan0 scan
# Pipe ascii - Alt 124
# /etc/network/interfaces
allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-ssid "<SSID>"