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

Keybase proof

I hereby claim:

  • I am mapkyca on github.
  • I am mapkyca (https://keybase.io/mapkyca) on keybase.
  • I have a public key ASCIDBawC_Ho4zeR5v42rPJrp_ZfMg9Q-lCpE8-InQBScwo

To claim this, I am signing this object:

@mapkyca
mapkyca / gist:7938ee8b19b25d539e41
Created March 26, 2016 13:31
Import a public key from a url
curl -L https://example.com/key.pgp | gpg --import
@mapkyca
mapkyca / gist:dc07d66772cdd5a3b6d0
Created February 5, 2016 12:01
Get a list of unique downloads from an awstats download list
curl http://localhost/~marcus/awstats/domain/month/awstats.localhost.downloads.html | grep 'http://your.domain/you/are/interested/in' | sed -ne 's/.*\(http[^"]*\).*/\1/p' >> /tmp/files.csv
cat /tmp/files.csv | sort | uniq > /tmp/sorted.csv
@mapkyca
mapkyca / gist:264a3877d13dee6ff9ce
Created February 4, 2016 09:36
Find dead links
wget --spider -o wget.log -e robots=off -w 1 -r -p URL
@mapkyca
mapkyca / python_regex.py
Created July 26, 2015 10:46
Quick python regex callback example, for my memory
import re
def callback(match):
return "<a href=\"http://github.com/%s>%s</a>" % (match.group(0), match.group(0))
string = "this is a #test #32345 dfsdf"
print re.sub('#[0-9]+', callback, string)
@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 / 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 / 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 / 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 / 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