Skip to content

Instantly share code, notes, and snippets.

View yasuyk's full-sized avatar

Yasuyuki Oka yasuyk

  • Chiba, Japan
  • 23:43 (UTC +09:00)
View GitHub Profile
@yasuyk
yasuyk / webrick_oneliner.sh
Created January 13, 2013 20:14
webrick oneliner
ruby -rwebrick -e "server=WEBrick::HTTPServer.new(:DocumentRoot => './', :Port => 8080);['INT', 'TERM'].each {|signal| trap(signal){ server.shutdown }};server.start;"
@yasuyk
yasuyk / utf8-mac_2_utf-8.rb
Last active December 11, 2015 02:19
EncodingをUTF8-MacからUTF-8に変換する。Preview.appで開いたPDFの内容をコピペすると、濁点、半濁点が別々の文字になってしまう問題を解決。
#!/usr/bin/env ruby
# http://sssslide.com/speakerdeck.com/a_matsuda/rails3-recipe-book-gaiden#114
ARGV.each do |file|
File.open(file,'r+:UTF8-MAC') do |f|
str = f.read
f.rewind
f.truncate(0)
f.set_encoding('UTF-8')
@yasuyk
yasuyk / open Emacs.app with --debug-init.sh
Created January 15, 2013 02:05
open Emacs.app installed by Homebrew with --debug-init
`brew --prefix emacs`/Emacs.app/Contents/MacOS/emacs --debug-init
@yasuyk
yasuyk / color256.sh
Created January 15, 2013 04:54 — forked from yonchu/color256.sh
zsh/bashで256色のカラーパレットを表示
#!/bin/sh
#
# 256色のカラーパレットを表示する
# bash と zsh にて実行可能
#
target_shell=$1
if [ -z "$1" ]; then
target_shell=$(basename "$SHELL")
@yasuyk
yasuyk / color16.sh
Created January 15, 2013 04:54 — forked from yonchu/color16.sh
bashでANSI カラーコード(16色)のカラーパレットを表示
#!/bin/bash
#
# ANSI Color code (16colors)
#
# http://ascii-table.com/ansi-escape-sequences.php
# http://archive.linux.or.jp/JF/JFdocs/Bash-Prompt-HOWTO-5.html
# Escape sequence
@yasuyk
yasuyk / marked.el
Created January 16, 2013 09:45
emacsで編集中のmarkdownをmarkedでプレビューする
;; from http://support.markedapp.com/kb/how-to-tips-and-tricks/marked-bonus-pack-scripts-commands-and-bundles
(defun markdown-preview-file ()
"run Marked on the current file and revert the buffer"
(interactive)
(shell-command
(format "open -a /Applications/Marked.app %s"
(shell-quote-argument (buffer-file-name))))
)
(global-set-key "\C-cm" 'markdown-preview-file)
@yasuyk
yasuyk / dash.el
Created January 16, 2013 17:45
emacsのカーソル位置にある単語をDashで調べる
(defun dash ()
(interactive)
(shell-command
(format "open dash://%s"
(or (thing-at-point 'symbol) ""))))
@yasuyk
yasuyk / install-info-emacs24.3.sh
Created March 29, 2013 00:32
install info files from emacs 24.3 tarball
#!/usr/bin/env bash
EMACS=emacs-24.3
TARBALL=$EMACS.tar.xz
wget http://core.ring.gr.jp/pub/GNU/emacs/$TARBALL
tar xzf $TARBALL
cd $EMACS
./configure --infodir=~/.info
make install-info
// http://ejohn.org/blog/simple-javascript-inheritance/
function Class() {}
Class.extend = function extend(props) {
var SuperClass = this;
function Class() {
if (typeof this.init === 'function') {
this.init.apply(this, arguments);
#!/usr/bin/env sh
wget https://raw.github.com/gitbits/git-ls-branches/master/git-ls-branches
chmod u+x git-ls-branches
wget https://raw.github.com/gitbits/git-info/master/git-info
chmod u+x git-info
wget https://raw.github.com/gitbits/git-info/master/git-pager
chmod u+x git-pager