Skip to content

Instantly share code, notes, and snippets.

View zanshin's full-sized avatar
💭
Making mistakes so you don't have to since 1961.

Mark Nichols zanshin

💭
Making mistakes so you don't have to since 1961.
View GitHub Profile
@zanshin
zanshin / .vimrc
Created November 15, 2011 16:44
My .vimrc file
" .vimrc
" Author: Mark Nichols
" largely copied from Steve Losh (stevelosh.com)
" addition bits borrowed from https://github.com/nvie/vimrc/blob/master/vimrc
" further bits from http://vimcasts.org
" also, https://github.com/lukaszkorecki/DOtFiles
"
" ---------------------------------------------------------------------------------
" use Vim settings rather than vi settings (must be first)
" ---------------------------------------------------------------------------------
@zanshin
zanshin / gitted.sh
Created June 4, 2012 13:41 — forked from dAnjou/gitted.sh
Script to find Git repos and show their status
#!/bin/bash
echo
find . -type d -name ".git" -execdir bash -c '
if [ ! $(git status | grep -o nothing) ]
then
x=$(basename "$PWD")
y=$(dirname "$PWD")
echo -e "\033[1;32m${x}\033[0m (${y})" >&2
git status -s >&2
@zanshin
zanshin / wp-xml-import.rb
Created August 24, 2012 02:26
WordPress to Octopress conversion script
require 'fileutils'
require 'date'
require 'yaml'
require 'rexml/document'
include REXML
doc = Document.new File.new(ARGV[0])
FileUtils.mkdir_p "_posts"
@zanshin
zanshin / newpost.rb
Created August 24, 2012 02:31
Ruby script to create new Octopress post, isolate it, and open it in an editor
#!/usr/bin/env ruby
#
# newpost.rb new-post-title
#
# Author: Mark Nichols, 8/2011
#
# This script automates the process of creating a new Octopress posting.
# 1. The Octopress rake new_post task is called passing in the posting name
# 2. The Octopress rake isolate taks is called to sequester all other postings in the _stash
# 3. The new file is opened in TextMate
@zanshin
zanshin / gems
Created August 26, 2012 02:28
my gems
± gem list [ruby-1.9.2-p290]
*** LOCAL GEMS ***
albino (1.3.3)
blankslate (2.1.2.4)
bundler (1.1.1)
chunky_png (1.2.6, 1.2.1)
classifier (1.3.3)
compass (0.12.2, 0.11.5)
@zanshin
zanshin / rss-subscribers.sh
Created September 25, 2012 19:07
Bash script to parse Apache log for a count of RSS subscribers and email it to you
#!/bin/bash
# Schedule this to run once a day with cron. Doesn't matter what time since it parses yesterday's hits (by default).
# I only tested this on the Marco.org server, which runs CentOS (RHEL). No idea how it'll work on other distributions, but it's pretty basic.
# Required variables:
RSS_URI="/rss"
MAIL_TO="your@email.com"
LOG_FILE="/var/log/httpd/access_log"
#!/usr/bin/env ruby
# Remove all gems EXCEPT defaults :)
`gem list -d`.split(/\n\n^(?=\w)/).each do |data|
match = data.match(/(?<name>([^\s]+)) \((?<versions>.*)\)/)
name = match[:name]
versions = match[:versions].split(', ')
if match = data.match(/^.*\(([\d\.]*),? ?default\): .*$/)
next if match[1].empty? # it's the only version if this match is empty

Keybase proof

I hereby claim:

  • I am zanshin on github.
  • I am zanshin (https://keybase.io/zanshin) on keybase.
  • I have a public key whose fingerprint is 297F 5FD4 0275 D2E5 48E9 F834 6CCF 1568 5344 5200

To claim this, I am signing this object:

# assign a prompt color by hashing the letters of the hostname
# idea copied from the irssi script 'nickcolor.pl'
# Daniel Kertesz <daniel@spatof.org>
autoload -U colors
colors
setopt prompt_subst
colnames=(
@zanshin
zanshin / Vagrantfile
Created April 30, 2014 18:44
test Vagrant file
1 # -*- mode: ruby -*-¬
2 # vi: set ft=ruby :¬
3 ¬
4 # Vagrantfile API/syntax version. Don't touch unless you know what you're doing!¬
5 VAGRANTFILE_API_VERSION = "2"¬
6 ¬
7 Vagrant.require_version ">= 1.5.0"¬
8 ¬
9 Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|¬
10 config.vm.hostname = "test-cookbook-berkshelf"¬