Skip to content

Instantly share code, notes, and snippets.

@shapeshed
shapeshed / publish_jekyll.sh
Created November 18, 2009 13:02
Compiles Jekyll Website and publishes via rsync
#!/bin/bash
# File: publish_jekyll.sh
# Description: Compiles Jekyll Website and publishes via rsync
#
# Copyright 2009 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@shapeshed
shapeshed / generate_redirects.sh
Created November 30, 2009 10:48
Generates redirect rules from a folder structure
#!/bin/bash
# File: generate_redirects.sh
# Description: Generates redirect rules based on a folder structure
#
# Copyright 2009 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
@shapeshed
shapeshed / monitor_df.sh
Created November 30, 2009 14:14
Monitors disk usage and sends an email when nearing limit
#!/bin/bash
# File: monitor_df.sh
# Description: Monitors disk usage and sends an email if limit reached
#
# Adapted from http://www.cyberciti.biz/tips/shell-script-to-watch-the-disk-space.html
#
# Copyright 2009 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
@shapeshed
shapeshed / ee2_permissions.sh
Created December 5, 2009 15:27
Sets permssions on a ExpressionEngine Version 2 install
#!/bin/bash
# File: ee2_permissions.sh
# Description: Sets permssions on a ExpressionEngine Version 2 install
#
# Copyright 2009 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#!/bin/bash
#
# File: iptables_firewall.sh
# Description: Sets iptables firewall rules (run as root)
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# Provides a category link with a count of the number of posts in
<ul>
{% for category in site.categories %}
<li id="{{ category[0] | downcase | replace:' ', '-' }}"><a href="/{{ category[0] }}/">{{category[0] | capitalize }}</a> <span>{{ category[1] | size }}</span></li>
{% endfor %}
</ul>
# .. and the same for tags
<dl>
{% for tag in site.tags %}
#!/usr/bin/env ruby
require 'rubygems'
require 'GCal4Ruby'
# Instantiate the service
service = GCal4Ruby::Service.new
# Authentication - your google username and password
service.authenticate("USERNAME", "PASSWORD")
#!/bin/bash
# File: batch_pngcrush.sh
# Description: Batch processes PNG files using the pngcrush
# http://pmt.sourceforge.net/pngcrush/
#
# Copyright 2010 George Ornbo (Shape Shed)
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
gifts = ['Smelly cheese', 'Pot of Gold', 'Worm in a jar', '$1.32', 'A small goat']
people = ['Willy Wonka', 'Stevie Wonder', 'Winston Churchill']
def give_gifts(gifts,people)
result = Hash.new { |h,k| h[k] = [] }
gifts = gifts.shuffle
people = people.shuffle
people_cycle = people.cycle
@shapeshed
shapeshed / ee_rename_db_prefix.rb
Created July 5, 2010 10:11
Changes the prefix of ExpressionEngine tables
#!/usr/bin/env ruby
# Changes the prefix of ExpressionEngine tables
require 'rubygems'
require 'mysql'
# Connect to db
db = Mysql.real_connect("localhost", "username", "password", "db_name")
# Get list of tables