This file contains hidden or 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
require 'open-uri' | |
require 'rexml/document' | |
def follow_list(name) | |
xml = nil | |
list = Array.new | |
url = "http://twitter.com/statuses/friends/#{name}.xml" | |
open(url) {|f| xml = REXML::Document.new f.read} | |
xml.elements.each("/users/user/screen_name"){|element| | |
list.push element.text |
This file contains hidden or 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
rails g rspec:install | |
spork --bootstrap | |
guard init spork | |
guard init rspec |
This file contains hidden or 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 sample.rb 1 2 8 8 8 | |
# ((((1) + 8) / 2) + 8) * 8 | |
# ((((8) + 1) / 2) + 8) * 8 | |
require 'rational' | |
numbers = ARGV.map(&:to_r) | |
operators = ["+", "-", "*", "/"] |
This file contains hidden or 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
mkdir -p ~/.emacs.d/drill-instructor | |
wget https://raw.githubusercontent.com/knishioka/emacs-drill-instructor/master/drill-instructor.el -P ~/.emacs.d/drill-instructor/ | |
wget https://gist.githubusercontent.com/knishioka/d49cd72d7fa39b41440e0ed9e8e4b579/raw/70637d26d332d127a100f1aa53fdd57b0fbc1c9c/.emacs -P ~/ |
This file contains hidden or 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
; Package | |
(setq package-archives '(("gnu" . "https://elpa.gnu.org/packages/") | |
("melpa" . "https://melpa.org/packages/"))) | |
(package-initialize) | |
; highlight brackets | |
(show-paren-mode 1) | |
; highlight region | |
(transient-mark-mode t) |
This file contains hidden or 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
# install ohmyzsh | |
sh -c "$(wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh -O -)" | |
sed -i -e "s/robbyrussell/simple/" ~/.zshrc | |
# install pyenv | |
git clone https://github.com/pyenv/pyenv.git ~/.pyenv | |
echo '# pyenv' >> ~/.zshrc | |
echo 'export PYENV_ROOT=\"\$HOME/.pyenv\"' >> ~/.zshrc | |
echo 'export PATH=\"\$PYENV_ROOT/bin:\$PATH\"' >> ~/.zshrc | |
echo -e 'if command -v pyenv 1>/dev/null 2>&1; then\n eval \"\$(pyenv init -)\"\nfi' >> ~/.zshrc |
This file contains hidden or 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
unbind-key C-b | |
set-option -g prefix C-t | |
bind-key C-t send-prefix | |
set-option -g history-limit 2000 | |
set-option -g status-fg white | |
set-option -g status-bg black | |
setw -g window-status-current-style "bg=blue,fg=white" |
This file contains hidden or 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
emacs --batch --eval "(require 'package)" \ | |
--eval "(add-to-list 'package-archives '(\"melpa\" . \"https://melpa.org/packages/\") t)" \ | |
--eval "(package-refresh-contents)" \ | |
--eval "(package-initialize)" \ | |
--eval "(package-install 'flymake-python-pyflakes))" \ | |
--eval "(package-install 'guru-mode))" \ | |
--eval "(package-install 'helm))" |
This file contains hidden or 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
TMPDIR=/private$TMPDIR SERVICES=lambda:4574,s3:4572 localstack start --docker |
This file contains hidden or 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 https://gist.githubusercontent.com/knishioka/86df4725105bd28d910fb67613c81b76/raw/create_new_aws_credential.sh | bash -s username | |
# usernameに対象となるユーザを指定 | |
# linuxのユーザ名とiamのユーザ名同じ場合を想定 | |
username=$1 | |
echo $username | |
# 古いキーを取得。一つのアカウントに付き一つのキーで管理しているとする | |
old_key=$(aws iam list-access-keys --user-name $username | jq -r '.AccessKeyMetadata[0].AccessKeyId') |
OlderNewer