Skip to content

Instantly share code, notes, and snippets.

View sirlancelot's full-sized avatar
🍕
Is life without pizza really living?

Matthew Pietz sirlancelot

🍕
Is life without pizza really living?
View GitHub Profile
@sirlancelot
sirlancelot / date-utility_RFC-to-ISO.xsl
Created April 8, 2009 21:34 — forked from bzerangue/date-utility_RFC-to-ISO.xsl
made template match 'pubDate' so it can be called by 'apply-templates', removed redundant substring()s
<?xml version="1.0" encoding="UTF-8" ?>
<!--
XSL Utility for Symphony 2
Convert RSS feed date format to Symphony date format
Convert RFC 2822 timestamp format to ISO date format minus the time info (Symphony CMS date format)
RFC 2822 format: Sun, 7 Jan 2007 12:00:00 GMT
ISO 8601 format (minus the time info): 2007-01-07
-->
<xsl:stylesheet version="1.0"
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- Properly base URLs so they work -->
<xsl:template name="GetUrl" match="@href | @src" mode="html">
<xsl:param name="Url" select="." />
<xsl:variable name="AbsoluteUrl">
<xsl:choose>
<xsl:when test="contains($Url,'://') or starts-with($Url,'/')"><xsl:value-of select="$Url" /></xsl:when>
<xsl:when test="starts-with($Url,'~/')"><xsl:value-of select="concat($root,substring($Url,1))" /></xsl:when>
<?php
function GetDocumentData() {
$Database = $this->modx->db;
$DocIDs = $this->modx->getChildIds($this->Configuration['StartID'], $this->Configuration['Level']);
$Select = array(
'ID' => 'sc.id',
'Parent' => 'sc.parent',
'Hidden' => 'sc.hidemenu',
@sirlancelot
sirlancelot / attach-disk-image.sh
Created January 25, 2010 23:13
Script that can be used during Mac OS X startup to mount a disk image to any path on the filesystem.
#!/bin/sh
##
# Mount my development websites folder
#
# NOTE: Because this uses Mac OS X mounting techniques, all mac format
# images are supported and many other UNIX filesystem formats.
# (My Development Sites image is stored encrypted.)
# Location of the image to be mounted
IMAGE="$HOME/Documents/Development Sites.sparsebundle"
@sirlancelot
sirlancelot / INSTALL.txt
Created March 5, 2010 21:34
This is a launchd script that will watch my "Downloads" folder and automatically trash files that are over 14 days old. A log of the trashed files is kept in the Console Messages. NOTE: Files are moved to the trash and can be recovered from there.
1. Edit the `EnvironmentVariables` and `WatchPaths` to point to your profile. (NOTE: unless you change
the `ProgramArguments`, you MUST keep the "Downloads" folder the same.
2. Move the file in to your `~/Library/LaunchAgents` folder.
3. Log out and back in.
If you want, open up Console.app and watch "Console Messages" for files that were trashed. an example
message looks like:
3/5/10 1:30:43 PM me.mpietz.Trash-Old-Downloads[9828] /Users/mpietz/Downloads/test -> /Users/mpietz/.Trash/test
@sirlancelot
sirlancelot / PinDistrictApps.cmd
Created April 16, 2010 20:17
Windows 7 script to pin items to the taskbar. Can be placed in the default user's startup folder. Self-terminating.
@echo off
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Mozilla Firefox\Mozilla Firefox.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Word 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office Excel 2007.lnk"
cscript PinItem.vbs /taskbar /item:"%ProgramData%\Microsoft\Windows\Start Menu\Programs\Microsoft Office\Microsoft Office PowerPoint 2007.lnk"
@sirlancelot
sirlancelot / delete-old-backups.vim
Created September 29, 2010 05:43
Portable Vim function to delete old backup files.
" I used to run call system('find ~/.vimbackup -mtime +14 -exec gvfs-trash "{}" \;')
" but now have created a more portable version since I work on Windows, Mac, & Linux.
set backup
set nowritebackup
set backupcopy=yes
set backupdir=$HOME/.vimbackup
set directory=$HOME/.vimswap,./
" Timestamp the backups
@sirlancelot
sirlancelot / fix-window-buttons.sh
Created October 4, 2010 05:02
I got sick of having to go in and fix this every time I installed Ubuntu or changed the theme, so here's a one-liner to put the buttons back where they belong.
#!/bin/bash
##
# @see http://lifehacker.com/5500577/move-ubuntus-window-buttons-back-to-the-right
gconftool --type string --set /apps/metacity/general/button_layout ":minimize,maximize,close"
@sirlancelot
sirlancelot / Registry Tweaks.reg
Created February 18, 2011 22:28
Turn off auto-update on select apps and disable startup programs
Windows Registry Editor Version 5.00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Disable Adobe Reader Update Check
[HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Adobe ARM\1.0\ARM]
"iCheck"=dword:00000000
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;; Disable CCleaner Update Check
[HKEY_CURRENT_USER\Software\Piriform\CCleaner]
@sirlancelot
sirlancelot / migrate-credentials.sh
Created March 20, 2011 23:45
migrade user credentials
#!/bin/bash
#############################
# Migrate User Credentials
#
# @author Matthew Pietz
Mode=0
BackupPath="/tmp/user-mig.$$"
StorageFile="user-migrate.tar.gz"
StartID=1000