Skip to content

Instantly share code, notes, and snippets.

View mattrude's full-sized avatar

Matt Rude mattrude

View GitHub Profile
@mattrude
mattrude / gist:889424
Created March 27, 2011 18:04
Changes My Computer to actual Computername
'==============================================================================
'LANG : VBScript
'NAME : computername.vbs
'DESCRIPTION: Changes My Computer to actual Computername
'==============================================================================
Option Explicit
Const HKEY_CLASSES_ROOT = &H80000000
Const HKEY_CURRENT_USER = &H80000001
Const HKEY_LOCAL_MACHINE = &H80000002
@mattrude
mattrude / timesince.php
Created April 22, 2011 02:27
WordPress Plugin to display the time since a entered date.
<?php
/*
Matt Rude <matt@mattrude.com> - 1 Nov 2009
This shortcode displays the years since the date provided.
To use this shortcode, add some text to a post or page simmiler to:
[ts date='1983-09-02']
The date format is YYYY-MM-DD
@mattrude
mattrude / wp-backup.sh
Created August 11, 2011 00:26
WordPress Auto Backup Script
# /bin/bash
BKNAME=
DIR=
DBHOST=
DBNAME=
DBUSER=
DBPASS=
# Backup Varibles
BKDIR=
# Copyright 2010 Drew Blas <drew.blas@gmail.com>
# From: http://drewblas.com/2010/07/15/an-analysis-of-gpled-code-in-thesis
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
@mattrude
mattrude / gist:2005151
Created March 9, 2012 05:10 — forked from stran12/gist:1394757
Step-by-step installation of cGit with Nginx

How to install cGit on Nginx (Ubuntu server)

Step-by-step installtion of cGit on nginx without funky rewrite rules.

Pre-requisites

This is for ::

@mattrude
mattrude / post-receive.sh
Created May 13, 2012 15:57
An example git hook script to mail out commit update information.
#!/bin/sh
#
# Copyright (c) 2007 Andy Parkins
#
# An example hook script to mail out commit update information. This hook
# sends emails listing new revisions to the repository introduced by the
# change being reported. The rule is that (for branch updates) each commit
# will appear on one email and one email only.
#
# This hook is stored in the contrib/hooks directory. Your distribution
@mattrude
mattrude / mdr_post_rss.php
Created May 20, 2012 17:57
Adds a small footer to all rss & atom feed posts in WordPress.
/********************************************************************************
* Add Footer to WordPress RSS feeds. Add this snippet to your functions.php
*/
function mdr_postrss($content) {
if(is_feed()){
$site_name = get_bloginfo_rss('name');
$post_title = get_the_title_rss();
$home_url = home_url('/');
$post_url = post_permalink();
@mattrude
mattrude / git-hook-post-receive-email.sh
Last active October 11, 2015 16:37
Example of a post receive email file called by a git hook that sends a color coded formatted html email of the git diff
#!/bin/sh
#
# An example hook script to mail out commit update information. This hook
# sends emails listing new revisions to the repository introduced by the
# change being reported. The rule is that (for branch updates) each commit
# will appear on one email and one email only.
#
# This hook is stored in the contrib/hooks directory. Your distribution
# will have put this somewhere standard. You should make this script
# executable then link to it in the repository you would like to use it in.
@mattrude
mattrude / index.html
Created November 17, 2012 21:07
php/java-script page that keeps the menu bar on the top of the page when it's scrolled down.
<head>
<style type='text/css'>
#menu.docked {
background-color: rgba(150, 150, 150, 0.5);
width: 100%;
}
#menu {
padding: 20px;
}
</style>
@mattrude
mattrude / gist:5159027
Last active December 14, 2015 22:29
Block Bing since they don't know how to play nice
iptables -F
grep "bingbot" /var/log/nginx/access.log |awk '{print $1 }' |sort |uniq > /tmp/killbing && \
egrep "bingbot" /var/log/nginx/archive/access* |awk '{print $1 }' |sort |uniq >> /tmp/killbing && \
for a in `cat /tmp/killbing |sort |uniq`
do
iptables -I INPUT -s $a -j DROP
done