Skip to content

Instantly share code, notes, and snippets.

@yonchu
yonchu / color16.sh
Created October 18, 2012 19:28
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
@yonchu
yonchu / tmux-pbcopy.sh
Created October 23, 2012 00:51
Macのクリップボード対応tmuxコマンド(tmuxx)とtmuxの自動起動設定
#!/bin/bash
#
# 1. このスクリプトをPATHの通った所(~/bin など)に置き、実行権限を与える(chmod +x tmux-pbcopy)
# 2. ~/.tmux.conf に以下のようにキーバインドを設定して使用
# bind ^y run-shell 'tmux-pbcopy'
#
if ! type pbcopy >/dev/null 2>&1 || ! type reattach-to-user-namespace >/dev/null 2>&1; then
tmux display-message "Error: cannot copy to clipboard."
exit 0
@yonchu
yonchu / hatena_bookmark_fix.user.js
Created May 13, 2012 12:56
はてなブックマークChrome拡張の表示を修正するGreasemonkeyです。ニコニコ動画ランキングのブクマ数表示の改善、Faviconize Googleの表示改善を行います。
// ==UserScript==
// @name hatena bookmark fix
// @namespace http://d.hatena.ne.jp/yonchu
// @version 0.0.1
// @description hatena bookmark for Chrome Extension fix
// @include http://www.google.*/search?*
// @include https://www.google.*/search?*
// @include http://encrypted.google.*/search?*
// @include https://encrypted.google.*/search?*
// @include http://www.google.*/webhp*
@yonchu
yonchu / br.sh
Created October 23, 2012 01:26
MacのHomebrewの詳細情報を表示, Formula指定にて詳細情報表示も可
#!/bin/sh
#
# 引数なし
# - homebrewの情報を色々表示
#
# 第1引数:
# - Formula名指定でFormulaの詳細情報を表示
# - マッチするFormulaがない場合は検索
#
if ! type brew >/dev/null 2>&1; then
@yonchu
yonchu / color256.sh
Created October 18, 2012 19:10
zsh/bashで256色のカラーパレットを表示
#!/bin/sh
#
# 256色のカラーパレットを表示する
# bash と zsh にて実行可能
#
target_shell=$1
if [ -z "$1" ]; then
target_shell=$(basename "$SHELL")
@yonchu
yonchu / chpwd_for_zsh.sh
Created October 23, 2012 00:41
zshにてcd後に自動的にlsを行うchpwd関数。ファイル数が多い場合は省略表示します。(.zshrcに設定して使用します)
chpwd() {
ls_abbrev
}
ls_abbrev() {
# -a : Do not ignore entries starting with ..
# -C : Force multi-column output.
# -F : Append indicator (one of */=>@|) to entries.
local cmd_ls='ls'
local -a opt_ls
opt_ls=('-aCF' '--color=always')
@yonchu
yonchu / _grunt.zsh
Last active December 20, 2015 07:29
解説用 grunt 補完
#compdef grunt
### 変数や関数を使用する場合の注意
# - 変数を使用する場合は、定義が グローバル に漏れないよう、必ず local or typeset(declare) コマンド使って変数宣言を行うこと
# - 関数はグローバルに定義されるため、重複しないよう名前付けには十分配慮すること
# − 短い補完関数であれば、関数を使わずに書くと良い
function __grunt() {
### 必要な変数を定義
# 現在のコンテキスト(curcontext) を保存
@yonchu
yonchu / _httpstatus.zsh
Last active December 14, 2015 01:19
httpstatusコマンド用zsh補完関数
#compdef httpstatus
#
# httpstatus コマンド用zsh補完関数
#
# このファイルfpathの通ったディレクトリに置きzshを再起動して下さい。
# その際ファイル名を必ず _httpstatus として下さい。
#
# $ cp _httpstatus /usr/local/share/zsh/site-functions
# $ exec zsh
#
@yonchu
yonchu / zaw-git-log.zsh
Last active December 10, 2015 00:19
zaw-src-git-log : Select commit hash from git log with zaw.
#
# zaw-src-git-log
#
# zaw source for git log.
# https://gist.github.com/4350604
#
# zaw : https://github.com/nakamuray/zaw
#
# git log pretty format: For detail, refer to "man git-log"
@yonchu
yonchu / zaw.plugin.zsh
Last active December 9, 2015 22:38
zaw for zsh settings
#
# zaw
#
# https://github.com/zsh-users/zaw
# https://github.com/nakamuray/zaw
#
# zsh anything.el-like widget
#
# Execute action by pressing enter key or
# press Meta-enter for alternative action.