Skip to content

Instantly share code, notes, and snippets.

@ivey
ivey / blog.pl
Created November 23, 2022 00:37
#!/usr/bin/perl
# blog: a utility to run a weblog
#
# Copyright (C) 1999 Michael D. Ivey <ivey@gweezlebur.com>
#
# 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 2 of the License, or
# (at your option) any later version.
require 'fileutils'
class Jekyll < Thor
include FileUtils
method_options :format => :optional
def draft(name)
format = options[:format] || "markdown"
slug = name.downcase.gsub(/ +/,'-').gsub(/[^-\w]/,'').sub(/-+$/,'')
filename = slug + ".#{format}"
@ivey
ivey / .slate.js
Created October 15, 2013 01:31
flexiglass-style bindings for slate (https://github.com/jigish/slate)
// other window
slate.bind('p:ctrl,cmd,alt', function(win) {
var current = slate.screen().id();
var count = slate.screenCount() - 1;
var target = current + 1;
if (target > count) {
target = 0;
}
win.doOperation(slate.operation("throw", {
"screen": target,
from math import floor
from datetime import datetime, timedelta
from time import mktime
import plugins
def _initialise(bot):
plugins.register_handler(_handle_cp_action)
config_path = File.expand_path("~/.nexus_cli")
config = File.exists?(config_path) ? YAML::load_file(config_path) : {}
(defun intelligent-close ()
"quit a frame the same way no matter what kind of frame you are on"
(interactive)
(if (eq (car (visible-frame-list)) (selected-frame))
;;for parent/master frame...
(if (> (length (visible-frame-list)) 1)
;;close a parent with children present
(delete-frame (selected-frame))
namenode = search(:node, "chef_environment:#{node.chef_environment} AND role:hadoop_namenode_server").first
vars = { :options => node[:hadoop][:core_site] }
vars[:namenode_ip] = namenode[:ipaddress] if namenode
template "/etc/hadoop-#{node[:hadoop][:version]}/conf.chef/core-site.xml" do
mode 0750
owner "hdfs"
group "hdfs"
action :create
# Paul Rudd isn't a douchebag
#
# load up celery man please
# can i get a printout of oyster smiling?
# do we have any new sequences?
# can i see a flarhgunnstow?
module.exports = (robot) ->
robot.respond /load up celery man please/i, (msg) ->
msg.send "http://www.simpleindustries.com/wp-content/uploads/2010/05/paul_sequence1.png"
# http://twistedmind.com/bundle-exec-bash-shortcut
bundle_commands=( rake spec rspec cucumber cap watchr rails rackup )
function run_bundler_cmd () {
if [ -e ./Gemfile ]; then
echo "bundle exec $@"
bundle exec $@
else
echo "$@"
$@
fi
@ivey
ivey / whats_so_cool_about_mlkshk.txt
Created July 5, 2011 14:11
What's so cool about mlkshk?
<ivey> it's a nice photo sharing site, but has just enough community
stuff (stars, re-posting) and lightweight groups that it's
hitting the sweet spot
<ivey> and there's no sense of "only post your own stuff" like flickr
<ivey> so when you see something funny or pretty or awesome or weird,
you can toss it up on mlkshk