Skip to content

Instantly share code, notes, and snippets.

View kennethkalmer's full-sized avatar

Kenneth Kalmer kennethkalmer

View GitHub Profile
alias webshare='python -c "import SimpleHTTPServer;SimpleHTTPServer.test()"'
@kennethkalmer
kennethkalmer / grep-postfix-message-ids-osx.sh
Created October 23, 2008 13:41
Grep for a pattern through a Postfix mail log, collect the message ids into a temporary file and then grep for all occurrences of the ID's in the maillog.
#!/bin/sh
# OSX friendly version by jeff donovan
#
# Grep for a pattern through a Postfix mail log, collect the message ids into a temporary
# file and then grep for all occurrences of the ID's in the maillog.
# This is a very intensive operation since it requires 1+N greps through the entire log file,
# where N is the number of unique ID's returned from the first grep.
#
# Usage sample:
<style type="text/css">
#left {
float: left;
width: 200px;
}
#right {
margin-left: 200px;
}
</style>
<div>
#!/bin/bash
#
# Find all the rails projects from this directory down and clear their log
# files to save some space.
#
base=`pwd`
for path in `find $base -type f -path '*/config/environment.rb'`
do
#!/usr/bin/env ruby
require 'rubygems'
require 'daemons'
require 'rufus/scheduler'
scheduler = File.join(File.dirname(__FILE__), 'scheduler.rb')
options = {
:app_name => 'scheduler',
:ARGV => ARGV,
after "deploy:update_code", "deploy:write_sha1"
namespace :deploy do
desc "write sha1 to file"
task :write_sha1 do
run "cd #{latest_release} && git show-ref --hash -- refs/heads/master > #{latest_release}/config/HEAD"
end
end
#!/bin/bash
#
# Set our bash prompt according to the branch/status of the current git
# repository.
#
# Forked from http://gist.github.com/31934
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
@kennethkalmer
kennethkalmer / gist:74844
Created March 6, 2009 09:43
Brainstorming
ruote-kit ramblings
Intro:
A rewrite of the existing ruote-rest project that aims to provide an easy to deploy and maintain ruote instance, accessible using a RESTful interface. Should be a breeze to use for non-Ruby projects and developers (apart from Ruby process definitions).
Architecture:
* Rack based, utilizing rack-mount
* Daemon-kit file system layout, keep ruote & co away from local libs, participants, configuration
# Environment
export RAILS_ENV=test
cp ../database.yml config/
# Re-create
mysql -u root -e "DROP DATABASE powerdns_cruise"
mysql -u root -e "CREATE DATABASE powerdns_cruise"
COMMANDS=(
"rake db:migrate"
#--
# Copyright (c) 2009, Kenneth Kalmer, kenneth.kalmer@gmail.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#