Skip to content

Instantly share code, notes, and snippets.

View tkfm-yamaguchi's full-sized avatar

Takafumi Yamaguchi tkfm-yamaguchi

View GitHub Profile
## build vmware's kernel modules
## execute this if linux kernel is updated
$ sudo vmware-modconfig --console --install-all
## To upgrade it self, just donwload *.bundle
## and execute it.
# coding: utf-8
=begin
## Haml
http://haml.info/docs/yardoc/frames.html#!http%3A//haml.info/docs/yardoc/
http://haml.info/docs/yardoc/file.REFERENCE.html#options
=end
require 'haml'
# coding: utf-8
require 'nokogiri'
require 'active_support/core_ext'
module MakeBlankXML
class << self
def execute
org_doc = Nokogiri::XML(DAMMY_XML)
#!/usr/bin/env ruby
# coding: utf-8
require 'date'
module DateTimeStringer
def to_sdate
strftime("%Y-%m-%d")
end
class Integer
def prime?
!2.upto(self/2).any?{|i| n % i == 0 }
end
def prime_factors
return [1] if self == 1
n = self
i = 2
# coding: utf-8
require 'pathname'
require 'fileutils'
class Pathname
def basename_without_ext
Pathname(basename.to_s.gsub(/#{extname}$/, ""))
end
* PRE : ubuntu 12.04 distributed jwhois.conf
* POST: download from gnu prjct page, add the costomization for japanese servers
* > downloaded from : http://cvs.savannah.gnu.org/viewvc/*checkout*/jwhois/jwhois/example/jwhois.conf?revision=1.143
* NOTE: Japanese encoding is "ISO-2022-JP"
--- jwhois.conf.bk 2010-11-25 00:39:15.000000000 +0900
+++ jwhois.conf 2013-01-23 14:26:57.966240523 +0900
@@ -17,6 +17,11 @@
type = regex;
# make empty element
echo '<hoge></hoge>\n' | sed -E 's/<([^>]+)>\s*\n*<\/\1>/<\1\/>/'
@tkfm-yamaguchi
tkfm-yamaguchi / custom_prettyprint.rb
Created November 22, 2012 02:32
Customize pp output
require 'pp'
class PP
module PPMethods
def seplist(list, sep=nil, iter_method=:each) # :yield: element
sep ||= lambda { comma_breakable }
first = true
nest(1) {
breakable
# Combine below files:
# https://github.com/github/gitignore/blob/master/Global/VisualStudio.gitignore
# https://github.com/github/gitignore/blob/master/CSharp.gitignore
# Build Folders (you can keep bin if you'd like, to store dlls and pdbs)
[Bb]in/
[Oo]bj/
# mstest test results
TestResults