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 / example.js
Created June 29, 2012 17:25
Highlight words in an element
// Highlight words containing github.
$("#content p").highlight("github");
@sirlancelot
sirlancelot / SetIfDefault.vim
Created January 21, 2012 04:03
A Vim function to set an option only if it is currently at its default value.
" ===============================================
" _ __(_)__ _ ________
" _| |/ / // ' \/ __/ __/
" (_)___/_//_/_/_/_/ \__/
"
" Maintainer: Matthew Pietz
"
" ===============================================
" Put your overrides in here
@sirlancelot
sirlancelot / extern.js
Created December 30, 2011 19:50
Creates a jQuery selector that matches all external links
jQuery.expr[':'].external = function(obj) {
return !obj.href.match(/^mailto\:/) && (obj.hostname != location.hostname);
};
// Add class to all external links
$('a:external').addClass('external');
@sirlancelot
sirlancelot / waves.txt
Created July 19, 2011 21:47
Shortwave Descriptor
#kill-defaults
> Each command is defined on a single line comprised of:
>
> 1. a case-insensitive, alpha-numeric trigger followed
> by whitespace
> 2. a url followed by whitespace (if the url contains
> spaces they must be encoded as `%20`)
> 3. a short description
>
> Urls may contain the following replacement tokens:
@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
@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 / 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 / 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 / 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 / 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