Skip to content

Instantly share code, notes, and snippets.

View vidluther's full-sized avatar

Vid Luther vidluther

View GitHub Profile
@vidluther
vidluther / cleanthumb.sh
Created October 17, 2011 16:59
A simple script to clean up (upgrade) timthumb scripts on your servers
#!/bin/bash
cd /tmp
wget http://timthumb.googlecode.com/svn/trunk/timthumb.php
cd /home
sudo find . -name timthumb.php | sudo xargs -i cp /tmp/timthumb.php {}
sudo find . -name thumb.php | sudo xargs -i cp /tmp/timthumb.php {}
sudo find . -name img.php | sudo xargs -i cp /tmp/timthumb.php {}
echo "done replacing Timthumb..pray we didn't mess anyone up"
rm /tmp/timthumb.php
@vidluther
vidluther / error_page.py
Created February 16, 2012 18:57 — forked from warmwaffles/error_page.py
Add / Remove Rackpsace Loadbalancer Error Page
#!/usr/bin/python
#
# Just change the three variables below and you are all set!
# @author Matthew A. Johnston (WarmWaffles)
# your user name
API_USERNAME = "username"
# your api key
API_KEY = "api-key"
# Load balancer Region
@vidluther
vidluther / installrackspacetools.sh
Created February 26, 2012 00:27
Quick and easy way to get the Nova and CLB tools running on os x
#!/bin/zsh
#### This could use some error checking but it's a gist, not a full blown program :)
#### Vid Luther (vid@zippykid.com)
sudo easy_install lockfile
sudo easy_install netaddr
sudo easy_install eventlet
mkdir ~/tmp
@vidluther
vidluther / cssversioner.php
Created June 16, 2012 16:04
Add a query string to the end of the theme's style.css when WordPress is loaded.
<?php
/**
* Add a filter to stylesheet_uri, which appends a query string to it automagically.
*/
add_filter('stylesheet_uri', 'zk_css_versioner');
/**
* the goal of this method is to append a query string to the css url for the site.
* the query string currently is determined by the last time the css file was modified
@vidluther
vidluther / remiphp.rb
Created July 16, 2012 22:58
chef recipe order of operations
bash "setup_remi_repo" do
code <<-EOH
cd /tmp
wget http://dl.fedoraproject.org/pub/epel/beta/6/i386/epel-release-6-5.noarch.rpm
wget http://rpms.famillecollet.com/enterprise/remi-release-6.rpm
rpm -Uvh remi-release-6*.rpm epel-release-6*.rpm
EOH
end
@vidluther
vidluther / default.conf
Created July 29, 2012 15:39
nginx virtualhost config
server {
listen 80;
server_name localhost;
root /var/www/html;
index index.html index.htm index.php;
location ~ \.php$ {
include global/php.defaults;
@vidluther
vidluther / test.php
Created July 29, 2012 15:42
fpm chroot test
<?php
ini_set(display_errors,1);
echo "Hello";
echo "<pre>";
print_r($_SERVER);
echo "</pre> <hr />";
echo date('Y');
phpinfo();
?>
@vidluther
vidluther / test.html
Created July 29, 2012 15:43
fpm chroot output
Hello<pre>Array
(
[USER] => apache
[HOME] => /var/www
[FCGI_ROLE] => RESPONDER
[QUERY_STRING] =>
[REQUEST_METHOD] => GET
[CONTENT_TYPE] =>
[CONTENT_LENGTH] =>
[SCRIPT_NAME] => /test.php
@vidluther
vidluther / php.defaults
Created July 29, 2012 15:49
php.defaults for nginx chrooted
try_files $uri =404;
#fastcgi_split_path_info ^(.+\.php)(/.+)$;
include fastcgi_params;
fastcgi_index index.php;
#fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_param SCRIPT_FILENAME $fastcgi_script_name;
@vidluther
vidluther / s-maintenance-mode.php
Created August 16, 2012 21:49 — forked from mjangda/s-maintenance-mode.php
Custom WordPress maintenance mode that allows super admins access to the Dashboard
<?php
add_action( 'init', 'x_maintenance_mode' );
function x_maintenance_mode() {
if ( defined( 'X_MAINTENANCE_MODE' ) && true === X_MAINTENANCE_MODE ) {
if ( is_super_admin() && is_admin() )
return;
die( 'Site is currently under maintenance' );