Skip to content

Instantly share code, notes, and snippets.

Avatar
😺

Edd Turtle eddturtle

😺
View GitHub Profile
View gist:7c0a5f8c1d23c104ac6eac9db3732889
<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 Jun 10, 2016
Backup a MySql database, with download speeds and hipchat notification (more info @ http://bit.ly/1RZ1the)
View mysql-backup-script.sh
#!/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 Jun 14, 2017
uk + ireland postal counties list (in json, csv, xml)
View counties.csv
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 Apr 25, 2014
PHP Split ClearDB Heroku ENV
View cleardb-split.php
<?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 Jun 10, 2016
PHP Execution Timing
View timing.php
<?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 Oct 15, 2012
Take a Screenshot with Java
View screenshot.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 {
You can’t perform that action at this time.