Skip to content

Instantly share code, notes, and snippets.

View eddturtle's full-sized avatar
😺

Edd Turtle eddturtle

😺
View GitHub Profile
@eddturtle
eddturtle / gist:7c0a5f8c1d23c104ac6eac9db3732889
Last active September 28, 2017 20:09
Hugo ld+json example
<script type="application/ld+json">
{{ if .IsPage }}{
"@context": "http://schema.org",
"@type": "BlogPosting",
"headline": "{{ .Title }}",
"genre": "{{ range .Params.categories }}{{ . }}{{ end }}",
"url": "{{ .Permalink }}",
"datePublished": "{{ (time .Date).Format "2006-01-02T15:04:05-0700" | safeHTML }}",
"description": "{{ .Summary }}",
"author": {
@eddturtle
eddturtle / mysql-backup-script.sh
Last active June 10, 2016 09:59
Backup a MySql database, with download speeds and hipchat notification (more info @ http://bit.ly/1RZ1the)
#!/bin/bash
# DB Backup Script
# Backup a MySql Database Script using mysqldump, pv, gzip and curl.
# Will dump the entire contents of a database into a gzipped file.
# Options:
# Database credentials
DBUSER=""
@eddturtle
eddturtle / counties.csv
Last active June 14, 2017 08:32
uk + ireland postal counties list (in json, csv, xml)
1 Aberdeenshire
2 Angus
3 Argyll and Bute
4 Bath and North East Somerset
5 Bedfordshire
6 Berkshire
7 Blaenau Gwent
8 Bridgend
9 Buckinghamshire
10 Caerphilly
@eddturtle
eddturtle / cleardb-split.php
Created April 25, 2014 14:08
PHP Split ClearDB Heroku ENV
<?php
// https://devcenter.heroku.com/articles/cleardb#using-cleardb-with-python-django
$url=parse_url(getenv("CLEARDB_DATABASE_URL"));
$server = $url["host"];
$username = $url["user"];
$password = $url["pass"];
$db = substr($url["path"],1);
@eddturtle
eddturtle / timing.php
Last active June 10, 2016 09:30
PHP Execution Timing
<?php
// http://stackoverflow.com/questions/17035859/how-to-find-php-execution-time
sleep(1);
$time = microtime(true) - $_SERVER["REQUEST_TIME_FLOAT"];
echo "Process Time: {$time}";
// Process Time: 1.0061590671539
@eddturtle
eddturtle / screenshot.java
Created October 15, 2012 21:41
Take a Screenshot with Java
import java.awt.Rectangle;
import java.awt.Robot;
import java.awt.Toolkit;
import java.awt.image.BufferedImage;
import java.awt.Desktop;
import java.io.File;
import javax.imageio.ImageIO;
public class Main {