This file contains 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/sh | |
# ファイルをゴミ箱に捨てるためのコマンド rmtrash をインストールしておくこと。 | |
# $ brew install rmtrash | |
# Mac の Downloads ディレクトリ | |
downloads_dir="/Users/quanon/Downloads/" | |
# 隠しファイルを除いたファイル数 | |
# grep で隠しファイルを除外する。 |
This file contains 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
## | |
# オープンクラスにインクルードさせるためのモジュール集 | |
# | |
module Extensions | |
module Hash | |
## | |
# Hash の入れ子から値を取り出すためのインスタンスメソッド。 | |
# | |
# (例) |
This file contains 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 'curses' | |
require 'rmagick' | |
require 'pry' | |
require 'pry-debugger' | |
def clear_screen | |
puts "\e[H\e[2J" |
This file contains 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
$ ruby -e 'Y="X / _ / X";S=Y.size;C=`stty size`.scan(/\d+/)[1].to_i/S;a={};c={};puts "\033[2J";loop{r=rand(C);a[r]=0;c[r]=[*30..37].sample;a.each{|x,o|;a[x]+=1;print "\033[#{o};#{x*S+1}H#{" "*S}\033[#{c[x]}m\033[#{a[x]};#{x*S+1}H#{Y}\033[0;0H\033[0m"};$stdout.flush;sleep 0.05}' |
This file contains 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
curl `ruby -r uri -e 'puts URI.escape("http://ajax.googleapis.com/ajax/services/search/images?rsz=8&v=1.0&safe=active&as_filetype=gif&imgsz=large&as_sitesearch=tumblr.com&q=ひだまりスケッチ")'` | jq '.responseData.results[].url' | peco | xargs open |
This file contains 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
# peco | |
function peco-select-history () { | |
local tac | |
if which tac > /dev/null; then | |
tac="tac" | |
else | |
tac="tail -r" | |
fi | |
BUFFER=$(\history -n 1 | \ | |
eval $tac | \ |
This file contains 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
# コマンドのまとまりを記述、hogeがコマンド名になる | |
function hoge () { | |
echo command | |
} | |
# ラインエディタを有効にする。自分が新しいコマンドを作る場合に必要 | |
zle -N hoge | |
# キーバインドを設定 | |
bindkey '^a' hoge |
This file contains 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
# normal with Lo-Dash | |
konami = (handler) -> | |
keys = [] | |
command = [38, 38, 40, 40, 37, 39, 37, 39, 66, 65] | |
$(document).on "keydown", (event) -> | |
keys.push event.which | |
keys.shift() if keys.length > command.length |
This file contains 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
# Usage | |
# ruby rename.rb ~/Downloads/reg_test "homu_(\d+)_homu.(txt)" "sayaka_@1_sayana.@2.backup" | |
require "fileutils" | |
dir = File.expand_path(ARGV[0]) | |
pattern = /#{ARGV[1]}$/ | |
after = ARGV[2] | |
Dir.glob(File.join(dir, "**/*")).each do |filename| |
This file contains 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
lodge: | |
per_size: 30 | |
right_list_size: 10 | |
slack: | |
defaults: &defaults | |
url: https://slack.com | |
channel: #channel | |
# トークンは Slack API のページで発行できます。 | |
token: my_token |
OlderNewer