Skip to content

Instantly share code, notes, and snippets.

View corydolphin's full-sized avatar

Cory Dolphin corydolphin

View GitHub Profile
@corydolphin
corydolphin / mailmanToMBox.py
Created February 3, 2012 06:57
Convert Mailman archive to text and mbox formatted archives.
#!/usr/bin/env python
"""
mailmanToMBox.py: Inserts line feeds to create mbox format from Mailman Gzip'd
Text archives
Usage: ./to-mbox.py dir
Where dir is a directory containing .txt.gz files pulled from mailman Gzip'd Text
"""
import sys
import os
def makeMBox(fIn,fOut):
@corydolphin
corydolphin / parseEmail.py
Created February 3, 2012 07:00
Quick script to parse mailbox archives to grab plaintext information
#!/usr/bin/env python
"""
parseEmail.py: Parses mbox-formatted email boxes for the interesting bits
Usage: ./parseEmail.py dir
Where dir is a directory containing mbox files
"""
import mailbox
import os
import sys
@corydolphin
corydolphin / downloadMailmanArchives.py
Created February 16, 2012 02:53
Parses a Mailman Archive site and decodes all of the gzipped text archives in mbox format for reading with most popular
"""
downloadArchives.py: Parses a Mailman Archive site and decodes all of the
gzipped text archives in mbox format for reading with most popular
email services, or mailbox.py
Usage: ./downloadArchives.py [dir] [-f]
Where dir is a directory containing mbox files
If dir is not specified, the output will default to the current working directory
Optionally, the -f flag will overwrite any existing files of the same name as the archives
"""
@corydolphin
corydolphin / Stripe CTF level03 solution
Created February 24, 2012 19:11
Stripe CTF level03 solution
See the source of level02.php, the usage of cookies is unsafe as the content is not validated, but merely evaluated.
Substituting an arbitrary file path for the randomly generated path allows you to access files with the permissions of the user running PHP, i.e. level03:
Alter the cookie content to:"../../home/level03/.password"
password: Or0m4UX***
(password redacted so as to not ruin the game for anyone :-) ).
@corydolphin
corydolphin / QueueConnector.cs
Created November 21, 2012 06:54
Fix .NET Multi-Tier Application Using Service Bus Queues. The original solution incorrectly hard codes the name for the Queue to "OrdersQueue" when creating the messaging client.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Microsoft.ServiceBus.Messaging;
using Microsoft.ServiceBus;
namespace FrontendWebRole
{
@corydolphin
corydolphin / dabblet.css
Created December 13, 2012 14:49
The first commented line is your dabblet’s title
/**
* The first commented line is your dabblet’s title
*/
body {
font-family: Helvetica, Arial, sans-serif;
font-size:90pt;
}
@corydolphin
corydolphin / FixNature.com.js
Last active December 12, 2015 00:28
Reading textbooks on nature.com sucks. They try and force you to open everything in the same window and every link invokes a JS function. This Gist contains the JS I use in a userscript to improve the readability, and can be found in the chrome store: https://chrome.google.com/webstore/detail/naturecom-readability-imr/caehidepagpmhcgajebpggaldjl…
var myFun = function(){
for(var nl = document.querySelectorAll(".nlsInlineLinksGrey.expand"), i=0; i < nl.length; i++){
nl[i].click();
};
for(var nl = document.querySelectorAll(".nlsInlineLinks.toWrapLongWord"), i=0; i < nl.length; i++){
nl[i].href = "http://www.nature.com/principles/ebooks/sci1210-principles-of-modern-biology-15577452/" + nl[i].href.replace(/[^\d]/g, "");
};
window.addEventListener("keydown", function(event) {
if (!event){event = window.event;}
@corydolphin
corydolphin / findVisualStudioVersion.py
Created February 6, 2013 15:48
Find the version of VisualStudio installed on Windows using python
'''
:platform: Windows
:synopsis: Finds the current version of VisualStudio installed, supporting
Visual Studio 2005 to Visual Studio 2012 (and pretend support for 2014,
if versioning conventions continue).
.. moduleauthor:: Cory Dolphin <wcdolphin@gmail.com>
From:http://www.mztools.com/articles/2008/MZ2008003.aspx
To detect which Visual Studio versions (2005, 2008, etc.) are installed on a computer from a setup, you can use the following Windows registry entries (or the ones in the next section):
@corydolphin
corydolphin / msvc9compiler.py
Last active January 12, 2017 03:57
Support compiling Python extensions on Windows.
"""distutils.msvc9compiler
Contains MSVCCompiler, an implementation of the abstract CCompiler class
for the Microsoft Visual Studio 2008.
The module is compatible with VS 2005-2012. You can find legacy support
for older versions of VS in distutils.msvccompiler.
"""
# Written by Perry Stoll hacked by Cory Dolphin to support VS 2012+
@corydolphin
corydolphin / subl.bat
Created February 11, 2013 01:01
Simple batch script to make using sublime text on windows even better, allows opening of sublime text in the current directory, and as a parameter. Save somewhere on your path, or add to your path.
@ECHO OFF
:: Written by Cory Dolphin (@wcdolphin www.corydolphin.com)
:: Simple batch script to make using sublime text on windows even better
:: Usage: subl [file <default=current directory>]
set sublime_path=C:\Program Files\Sublime Text 2\sublime_text.exe
if "%1" =="" ( :: no parameter, open current directory
START "" "%sublime_path%" %CD%