Skip to content

Instantly share code, notes, and snippets.

View kuroda's full-sized avatar

Tsutomu Kuroda kuroda

  • Oiax Inc.
  • Tokyo, Japan
View GitHub Profile
@kuroda
kuroda / views.rake
Created June 21, 2012 11:30
Renames all .rhtml views to .html.erb
namespace 'views' do
desc 'Renames all .rhtml views to .html.erb'
task 'rename' do
Dir.glob('app/views/**/*.rhtml').each do |file|
puts `git mv #{file} #{file.gsub(/\.rhtml$/, '.html.erb')}`
end
end
end
# Prompts
# 30 31 32 33 34 35 36 37
# BK RE GR YE BL MA CY WH
if [ $UID = "0" ]; then
PROMPT="%{%}%n@%m%#%{%} "
else
PROMPT="%{%}%n@%m%#%{%} "
fi
RPROMPT="%{%}[%~]%{%}"
alias a=alias
a ls="/bin/ls $LS_OPTIONS"
a ll="/bin/ls -l $LS_OPTIONS"
a la="/bin/ls -a $LS_OPTIONS"
a lla="/bin/ls -la $LS_OPTIONS"
a rm='rm -i'
a cp='cp -i'
a mv='mv -i'
a less='less -I'
@kuroda
kuroda / check_replication.rb
Last active December 14, 2015 04:18
A simple script to check if MySQL replication is working normally.
#!/usr/bin/ruby
password = `cat /root/mysql_root_password`
password.strip!
result = `mysql -u root -p#{password} -E -e "show slave status"`
values = {}
result.split(/\n/).each do |line|
if md = line.match(/:/)
key = md.pre_match.strip.to_sym
[user]
name = Tsutomu Kuroda
email = t-kuroda@oiax.jp
[alias]
ci = commit
cia = commit --amend
co = checkout
cop = checkout @{-1}
cp = cherry-pick
mf = merge --ff-only
@kuroda
kuroda / init.coffee
Last active September 6, 2018 12:35
My keymap.cson for Atom Editor
add_line_markers = (marker) ->
editor = atom.workspace.getActiveTextEditor()
range = editor.getSelectedBufferRange()
editor.moveToBeginningOfLine()
s = range.start.row
e = range.end.row
if e > s && range.end.column == 0
e = e - 1
editor.moveUp()
editor.transact ->