Skip to content

Instantly share code, notes, and snippets.

View stith's full-sized avatar

Anna Stith stith

View GitHub Profile
@stith
stith / .htaccess
Created May 6, 2011 03:41
The ultimate Magento SEO .htaccess rewrite rule set
# Grab the protocol being used
RewriteCond %{HTTPS} =on
RewriteRule ^(.+)$ - [env=ps:https]
RewriteCond %{HTTPS} !=on
RewriteRule ^(.+)$ - [env=ps:http]
# Force WWW
RewriteCond %{HTTP_HOST} !^www\.
@stith
stith / AOD.patch
Created May 19, 2011 07:04
Magento 1.4.1.1 Memory Leak Patch
*** lib/Varien/Db/Select.php 2010-07-26 16:09:28.000000000 -0400
--- lib/Varien/Db/Select.php 2010-12-28 15:42:19.000000000 -0500
***************
*** 33,38 ****
--- 33,40 ----
*/
class Varien_Db_Select extends Zend_Db_Select
{
+ const TYPE_CONDITION = 'TYPE_CONDITION';
+
@stith
stith / ess2sc.py
Created September 20, 2011 08:49
Convert Essentials homes to SpawnControl
#!/usr/bin/env python
import sys
import sqlite3
import yaml
import os
import time
from os import path
# Make sure paths exist
@stith
stith / ess2cbwarp.py
Created September 20, 2011 11:49
Convert Essentials warps to CommandBook's CSV
#!/usr/bin/env python
import sys
import yaml
import os
import time
from os import path
# Make sure paths exist
if len(sys.argv) != 2:
NSString *filename = [NSString stringWithFormat:@"%0.0f.png", [[NSDate date] timeIntervalSince1970]];
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) objectAtIndex:0];
MSLogTo(@"info", @"documentsPath = %@",documentsPath);
NSURL *newUrl = [NSURL fileURLWithPath:documentsPath isDirectory:YES];
NSString *saveTo = [[newUrl absoluteString] stringByReplacingPercentEscapesUsingEncoding:NSUTF8StringEncoding];
MSLogTo(@"info", @"Saving image to %@",saveTo);
NSError *error;
if (![UIImagePNGRepresentation(image) writeToFile:saveTo options:NSDataWritingAtomic error:&error]) {
@stith
stith / strace.sh
Created February 25, 2012 08:28
strace all processes
strace $(pidof httpd |sed 's/\([0-9]*\)/\-p \1/g')
// Type this into your address bar at simple.com:
// It just messes with the background, don't worry about your cookies :D
javascript:void(function(){disPage.guilloche.guillocheKey=0;setInterval(function(){disPage.guilloche.guillocheKey++; disPage.guilloche.drawNiceGuilloche();},100)}());
@implementation Observer
-(id)init {
// ...
[_preferences addObserver:self forKeyPath:@"apiKey" options:NSKeyValueObservingOptionNew context:nil];
[_preferences addObserver:self forKeyPath:@"apiSecret" options:NSKeyValueObservingOptionNew context:nil];
}
// ...
@stith
stith / stuff.js
Last active August 29, 2015 13:57
doStuff().then(function(things) {
if (!things) {
throw new Error("Here I want to skip everything else, including the 'then's after the next catch..");
}
if (canMakeNewThing) {
// This should continue to the next 'then'
return someNewThing.save();
}
@stith
stith / ssltest.py
Last active October 9, 2024 10:28
#!/usr/bin/python
# Quick and dirty demonstration of CVE-2014-0160 by Jared Stafford ([email protected])
# The author disclaims copyright to this source code.
# Mirror from http://s3.jspenguin.org/ssltest.py
import sys
import struct
import socket
import time