Skip to content

Instantly share code, notes, and snippets.

View treffynnon's full-sized avatar
🧟

Simon Holywell treffynnon

🧟
View GitHub Profile
@treffynnon
treffynnon / manifest.xml
Created April 14, 2016 01:24 — forked from hugowan/manifest.xml
auspost maninfest xml
<?xml version="1.0" encoding="UTF-8"?>
<PCMS xmlns="http://www.auspost.com.au/xml/pcms">
<SendPCMSManifest>
<header>
<TransactionDateTime>2010>01-13T16:30:00.0Z</TransactionDateTime>
<TransactionId>1</TransactionId>
<TransactionSequence>1</TransactionSequence>
<ApplicationId>MERCHANT</ApplicationId>
</header>
<body>
@treffynnon
treffynnon / SassMeister-input.scss
Created May 11, 2015 12:58
Generated by SassMeister.com.
// ----
// Sass (v3.3.14)
// Compass (v1.0.1)
// ----
.search-doctors-box {
position:relative;
z-index:999;
margin: 0px;
&--at-map {
@treffynnon
treffynnon / convert.php
Last active December 21, 2019 12:28
Pelican to Hugo reStructuredText post converter (Python static site generator to Go static site generator)
<?php
/**
* Requires pandoc to be installed and in your path
*
* It will look for .rst files in __DIR__/content/* where it will expect to find
* category folders. Inside these category folders your posts should be available.
*
* So
*
@treffynnon
treffynnon / ip_based_auth.php
Last active December 16, 2015 09:29
A simple PHP snippet to verify authorisation via IP address. Supports wildcard/partial IP addresses.
<?php
$allowable_ips = array(
'192.168.0.',
'8.8.8.8',
);
$is_allowed = (bool) array_filter($allowable_ips, function($value) {
return (substr($_SERVER['REMOTE_ADDR'], 0, strlen($value)) == $value);
});
<!-- In the HTML of your posts: Replace ID number with ID of your gist -->
<p class="embed_gist"><a href="http://gist.github.com/367154">http://gist.github.com/367154</a></p>
@treffynnon
treffynnon / install.sh
Created June 6, 2012 11:40 — forked from derek-watson/tumblr.rb
Tumblr to Hakyll (Markdown and reStructuredText) migration
#!/usr/bin/env bash
echo "This script will download and install the tumblr migration script"
echo "script and its dependencies on Debian systems."
echo " "
read -p "Install dependencies from apt-get? [Yn] "
if [ "$REPLY" == "" -o "$REPLY" == "y" -o "$REPLY" == "Y" ]; then
echo "Installing the dependencies..."
echo " "
sudo apt-get install libxslt-dev libxml2-dev ruby rubygems pandoc
@treffynnon
treffynnon / server.js
Created October 21, 2011 13:53
Connect to an IrisCouch database from Node.js, save a new document and retrieve it back again.
var http = require('http');
http.createServer(function (req, http_res) {
http_res.writeHead(200, {'Content-Type': 'text/plain'});
var response = '';
var cradle = require('cradle');
var connection = new(cradle.Connection)('https://subdomain.iriscouch.com', 443, {
auth: { username: 'username', password: 'password' }
});
@treffynnon
treffynnon / gist:1295904
Created October 18, 2011 16:45
My current tumblr theme - http://blog.simonholywell.com
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<!--
Vacant Modified - 1.7
Designed by Sam Stefan samstefan.co.uk
Modified by Simon Holywell simonholywell.com
-->
@treffynnon
treffynnon / ExampleUsage.php
Created July 11, 2011 13:05
A prototype/alpha pure PHP wrapper for the ssdeep binary (tested with version 2.4).
<?php
/**
* Some examples of how to use this prototype. I highly recommend that you use
* the PHP PECL extension I wrote instead though. It is better in every way.
* For more information see http://php.net/ssdeep and http://pecl.php.net/ssdeep
*/
// Get a hash via a supplied file path
$SsDeep = new SsDeep();
$hash_string = $SsDeep->getHash($file);
@treffynnon
treffynnon / xorg.conf
Created June 22, 2011 20:19
X11 config for Dell Inspiron on Ubuntu and Linux Mint where maximum screen resolution is only 800x600 you can add 1024x768 by using this configuration file.
# Install:
#
# On Mint 6 Fluxbox edition this file goes in /etc/X11/xorg.conf
# On Mint 10 LXDE edition this file goes in /usr/share/X11/xorg.conf.d/20-screen.conf
# This config will also work for versions of Ubuntu of course in /etc/X11/xorg.conf
#
# Don't forget to back up your original xorg.conf file before adding this one.
#
# You'll need to restart your machine to see the effect.