This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
dbpath = /var/mongo/data | |
logpath = /var/mongo/logs/mongod.log |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Emacs 23.3 building procedure for MacOSX | |
# thanks to http://masutaka.net/chalow/2011-07-31-2.html | |
# | |
# | |
# settings | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'open-uri' | |
require 'nokogiri' | |
require 'growl' | |
doc = Nokogiri::HTML(open("http://shop.github.com/products/octodex-sticker-pack")) | |
if doc.css('#puchase-form .sold-out').empty? | |
Growl.notify do |n| | |
n.message = 'Octodex Sticker Packs are back!' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
class String | |
def &(other) | |
self.unpack("U*").zip(other.to_s.unpack("U*")).map{|pair| pair.first & pair.last }.pack("U*") | |
end | |
end | |
puts "生" & "死" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
intToRoman :: Int -> String | |
intToRoman = concat . reverse . (zipWith (\f d -> f d) fs) . split | |
where | |
split = unfoldr (\n -> if n > 0 then Just ((mod n 10), (div n 10)) else Nothing) | |
fs = map roman [('i', 'v', 'x'), ('x', 'l', 'c'), ('c', 'd', 'm'), ('m', '$', '#')] | |
roman (one, five, ten) n | |
| n >= 0 && n <= 3 = replicate n one | |
| n == 4 = [one, five] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
srcdir="${HOME}/src/pjproject-2.0-rc" | |
cd ${srcdir} | |
( | |
cat <<END | |
#define PJ_CONFIG_IPHONE 1 | |
#include <pj/config_site_sample.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# | |
# Nabeatsu | |
# returns "hoge" if given value is a multiple of 3, or contains '3' in it; otherwise just the value itself (in String). | |
# | |
# Restriction of coding: | |
# DO NOT use conditional branching syntax, such as "if", "unless", "case ... when". | |
# | |
module Nabeatsu | |
class << self | |
def say(n) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Data.List | |
data Suit = Spade | Diamond | Club | Heart | |
deriving (Eq, Show, Ord) | |
data Card = Card Suit Int | |
deriving (Eq, Show, Ord) | |
suit (Card s _) = s | |
rank (Card _ r) = r |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Directory | |
include Enumerable | |
def initialize(dirname) | |
@dirname = dirname | |
@files = Dir.open(dirname) {|dir| | |
dir.reject {|name| name == "." || name == ".." } | |
} | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
mysql_libdir='/usr/local/mysql/lib' | |
dylib_name='libmysqlclient.18.dylib' | |
dylib_path="${mysql_libdir}/${dylib_name}" | |
install_name_tool -change ${dylib_name} ${dylib_path} $1 |