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
#!/bin/bash | |
USAGE="Usage: git_bulk.sh [pull|push|status]" | |
if [[ $# -lt 1 ]] ; then | |
echo $USAGE 1>&2 | |
exit 1 | |
fi | |
base_dir=$(pwd) |
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
#!/bin/bash | |
USAGE="Usage: check.sh [pull|push|status]" | |
if [[ $# -lt 1 ]] ; then | |
echo $USAGE 1>&2 | |
exit 1 | |
fi | |
base_dir=$(pwd) |
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
#!/usr/bin/env ruby | |
filepath = ENV["HOME"] + "/git/dotfiles/Brewfile" | |
lines = [] | |
open(filepath).each do |line| | |
next if line.strip == "" | |
next if line =~ /^tap/ | |
lines << line.split(" ") | |
end |
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
#!/usr/bin/env ruby | |
CHECK_DIRS = %w(dotfiles dot.emacs.d dot.zsh) | |
COMMANDS = { | |
push: "git push -u origin master", | |
pull: "git pull --stat --rebase origin master", | |
status: "git status -s" | |
} | |
type = ARGV.shift |
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
{"status":true,"tree":{"name":"body","class":"","id":"","children":[{"name":"div","class":"container","id":"","children":[{"name":"div","class":"jumbotron","id":"","children":[{"name":"div","class":"container","id":"","children":[{"name":"h1","class":"","id":"","children":[]},{"name":"p","class":"","id":"","children":[]},{"name":"form","class":"form-inline","id":"","children":[{"name":"div","class":"form-group","id":"","children":[{"name":"label","class":"sr-only","id":"","children":[]},{"name":"input","class":"form-control","id":"","children":[]}]},{"name":"button","class":"btn btn-default","id":"","children":[]}]}]}]}]},{"name":"script","class":"","id":"","children":[]}]}} |
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
#!/usr/bin/env ruby | |
require "nokogiri" | |
html = <<-EOS | |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>hoge</title> | |
</head> |
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
text = <<-EOS.strip | |
このあと | |
滅茶苦茶 | |
サックスした | |
EOS | |
text.lines.map{|line|line.strip.ljust(text.lines.map(&:size).max).chars} | |
.transpose.map(&:join).map(&:reverse).join("\n") | |
=begin |
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 "slim" | |
Slim::Template.new { "h1 hoge" }.render #=> <h1>hoge</h1> |
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
#!/usr/bin/env ruby | |
root = Dir.pwd | |
Dir.glob("*").map { |d| File.expand_path(d, root) }.each do |dir| | |
next unless File.ftype(dir) == "directory" | |
Dir.chdir(dir) | |
unpushed = `git rev-list origin/master..master 2>/dev/null | wc -l | tr -d ' '`.to_i | |
puts "#{dir} [#{unpushed}]" if unpushed > 0 | |
end |
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
#!/usr/bin/env ruby | |
# -*- coding: utf-8 -*- | |
require "thor" | |
require "term/ansicolor" | |
DAILY_MEMO_DIR = ENV["HOME"] + "/Dropbox/memo/daily/" | |
class DailyCli < Thor | |
desc "edit [NAME]", "Edit memo in Emacs", aliases: "e" |