Skip to content

Instantly share code, notes, and snippets.

View sanbornm's full-sized avatar

Mark sanbornm

View GitHub Profile
@sanbornm
sanbornm / gist:177420
Created August 29, 2009 07:14
Simple script to check when your site changes status codes
import pickle, pprint, time, os
import httplib
import smtplib
def emailAlert(alert,subject='You have an alert'):
fromaddr = "youremail@domain.com"
toaddrs = "youremail@domain.com"
# Add the From: and To: headers at the start!
@sanbornm
sanbornm / gist:187815
Created September 16, 2009 02:07 — forked from eriwen/gist:187610
# Sample usage: "checksites.py eriwen.com nixtutor.com ..."
import pickle, os, sys, logging
from httplib import HTTPConnection
from smtplib import SMTP
def email_alert(alert,subject='You have an alert'):
fromaddr = "youremail@domain.com"
toaddrs = "youremail@domain.com"
#!/usr/bin/python
# Add "alias tadd='python /path/to/agile.py'" to your
# .bashrc or .bash_profile. I put my agile.py in dropbox
# so I have access to it on every computer.
"""Agile Task Adder"""
__author__ = 'marcrosoft@gmail.com (Mark Sanborn)'
@sanbornm
sanbornm / magento-customer-balance.php
Last active August 19, 2020 12:31
Get store credit and rewards points balance for all Magento customers, export to csv
<?php
require_once 'app/Mage.php'; umask(0); Mage::app('default');
setlocale(LC_MONETARY, 'en_US');
$customers = Mage::getModel('customer/customer')->getCollection();
$count = 0;
foreach ($customers as $customer) {
@sanbornm
sanbornm / gist:6687666
Created September 24, 2013 16:50
How to create a linux Patch
diff -Naur standard.xml mynewchange.xml > myfile.patch
@sanbornm
sanbornm / table_size.sql
Created November 14, 2013 18:51
Get MySql Table size Desc. Change table_schema to name of your DB.
SELECT table_name AS "Table",
round(((data_length + index_length) / 1024 / 1024), 2) "Size in MB"
FROM information_schema.TABLES
WHERE table_schema = "test" AND table_name like "%"
ORDER BY 2 DESC;
@sanbornm
sanbornm / date_default_timezone.php
Created November 19, 2013 20:57
default timezone and back
$defaultTime = date_default_timezone_get();
date_default_timezone_set('America/Los_Angeles');
$now = date("Y-m-d H:i:s");
date_default_timezone_set($defaultTime);
@sanbornm
sanbornm / gist:8013944
Created December 17, 2013 22:39
Install phpunit globally with Mockery
php -r "eval('?>'.file_get_contents('https://getcomposer.org/installer'));"
php composer.phar global require 'phpunit/phpunit=3.7.*'
sudo pear channel-discover pear.survivethedeepend.com
sudo pear channel-discover hamcrest.googlecode.com/svn/pear
sudo pear install --alldeps deepend/Mockery
@sanbornm
sanbornm / install.sh
Created June 24, 2014 18:19
Install Java 1.7 for Elasticsearch on Debian
wget http://blog.anantshri.info/content/uploads/2010/09/add-apt-repository.sh.txt -O /usr/local/bin/add-apt-repository && sudo chmod +x /usr/local/bin/add-apt-repository
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
@sanbornm
sanbornm / example.go
Created June 2, 2016 15:23 — forked from kavu/example.go
Minimal Golang + Cocoa application using CGO. Build with `CC=clang go build`
package main
/*
#cgo CFLAGS: -x objective-c
#cgo LDFLAGS: -framework Cocoa
#import <Cocoa/Cocoa.h>
int
StartApp(void) {
[NSAutoreleasePool new];