Skip to content

Instantly share code, notes, and snippets.

View mapkyca's full-sized avatar
💭
Always out numbered, Never out gunned

Marcus Povey mapkyca

💭
Always out numbered, Never out gunned
View GitHub Profile
@mapkyca
mapkyca / ssltest.py
Created April 8, 2014 13:42
Mirror of Jared Stafford's ssltest.py (http://s3.jspenguin.org/ssltest.py)
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford (jspenguin@jspenguin.org)
# The author disclaims copyright to this source code.
import sys
import struct
import socket
import time
import select
@mapkyca
mapkyca / iso8601.php
Created June 1, 2014 13:50
Regex to find ISO8601 date and time in text using PHP
<?php
preg_match('/([0-9]{4}-?[0-9]{2}-?[0-9]{2}T[0-9]{2}:?[0-9]{2}:?[0-9]{2}[+-Z]?([0-9]{2,4}:?([0-9]{2})?)?)/',$text, $matches);
@mapkyca
mapkyca / filesonlypatch.md
Created October 2, 2014 09:57
Git files only patch

To create a patch to upload to a server via ftp/scp, containing modified files rather than a diff patch.

  • Create your work on a new branch
  • Create a patch containing full modified files, while in your git repo

git diff --name-only master | xargs -i{} cp --parents {} /tmp/mypatch/

@mapkyca
mapkyca / autoloader.php
Created January 8, 2015 12:52
Plugin autoloader for Known plugin repos
/**
* Support loading of direct checkout.
*/
spl_autoload_register(function($class) {
$class = str_replace('\\', DIRECTORY_SEPARATOR, $class);
$segments = explode(DIRECTORY_SEPARATOR, $class);
$PLUGIN_NAME = $segments[1];
$basedir = dirname(dirname(dirname(__FILE__))) . '/';
@mapkyca
mapkyca / gist:55a4b935718111d4e099
Created March 12, 2015 18:25
Test a mail server supports TLS
swaks -a -tls -q HELO -s <SERVER> -au <USER> -ap '<>'
@mapkyca
mapkyca / .htaccess
Created January 26, 2012 10:49
Apache mod_rewrite rule to pass requests to a PHP page handler, but only if the file or folder doesn't physically exist.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ path/to/pagehandler.php?page=$1 [QSA]
</IfModule>
@mapkyca
mapkyca / gist:1919586
Created February 26, 2012 23:14
Etch -> Lenny
Notes from upgrade:
Prep:
1) Make sure up to date, aptitude update && aptitude upgrade
2) Reboot
Upgrade:
1) Change sources (etch->lenny)
2) aptitude safe-upgrade & resolve issues
@mapkyca
mapkyca / gist:1922850
Created February 27, 2012 09:50
Lenny -> Squeeze
Prep:
- apt-get update && apt-get upgrade && apt-get dist-upgrade
- Check for holds
dpkg --audit
dpkg --get-selections | grep hold
aptitude & press "g"
- Edit sources.list s/lenny/squeeze
- apt-get update NOTE: Debian docs say don't use aptitude to upgrade.
- apt-get upgrade to to a safe-upgrade
@mapkyca
mapkyca / gist:2008119
Created March 9, 2012 19:04
Excel / Open Office timestamp conversions.
DATE -> SECONDS
---------------
(CELL - DATE (1970,1,1))*86400
TIME -> SECONDS
---------------
@mapkyca
mapkyca / gist:2299663
Created April 4, 2012 08:16
Note To Self: Change the OSX dock title within Java
/*
* To correctly set the doc name of a java App in OSX, use....
*/
System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Foo");