Skip to content

Instantly share code, notes, and snippets.

@imaizume
imaizume / post-checkout
Last active June 6, 2017 02:35
新規にブランチを作成したら自動で空コミットを作成するgit hook
#!/usr/bin/env ruby
before, after, switch = ARGV
exit 0 unless before == after
exit 0 unless switch.to_i == 1
branch = `git rev-parse --abbrev-ref HEAD`
msg = "Created new branch #{branch}"
system(%(git commit --allow-empty -m "#{msg}"))
@imaizume
imaizume / izm.svg
Created May 2, 2017 05:32
source of my icon
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@imaizume
imaizume / replace-commas-and-periods.rb
Created February 5, 2017 06:18
.git/hooks以下に"pre-commit"で置いておくとcommit時に「、」と「。」を「,」と「.」に変換してくれるスクリプト
#!/usr/bin/env ruby
# Tex files to be committed
tex_files_changed = `git diff --cached --name-only HEAD | grep -E '.*\.tex$'`
# Replace into commas and periods
THE_ENCODING = 'utf-8'
tex_files_changed.each_line do |texname|
puts "Replace into commas and periods in #{texname}"
texname.chomp!
@imaizume
imaizume / azusa_colors.scss
Last active March 21, 2023 13:24
Color codes with scss variables for Azusa Colors (http://sanographix.github.io/azusa-colors/)
/* hex */
$blue_hex: #02a8f4;
$red_hex: #ff5152;
$purple_hex: #b867c6;
$orange_hex: #ff9000;
$turquoiz_hex: #01bbd4;
$pink_hex: #ff3f80;
$green_hex: #33b490;
$navy_hex: #464e70;
$ivory_hex: #fff5e3;
@imaizume
imaizume / local_convert.rb
Created January 13, 2017 09:12
tex-boxでゲストからホストにtexディレクトリをrsyncして指定したtexファイルをPDF変換し返却するRubyスクリプト
#! /bin/sh
exec ruby -S -x "$0" "$@"
#! ruby
require 'fileutils'
src_path = ARGV[0]
unless File.exist?(src_path)
puts 'Specified file path does not exist.'
exit(0)
@imaizume
imaizume / runcommand.init.bat
Last active August 6, 2016 05:28
ホームディレクトリ以下に好きな名前でショートカットを配置するディレクトリを作りそこへのパスを持つ環境変数を設定する。その後手動でこれらの環境変数をPathに含めると「プログラム名を指定して実行」からショートカットが起動できる。
@echo off
set BASE=C:%HOMEPATH%\runcommand
setx SHORTCUT_HOME %BASE%\shortcuts
setx URL_HOME %BASE%\urls
setx DIR_HOME %BASE%\dirs
mkdir %BASE%
mkdir %SHORTCUTS_HOME%
mkdir %URL_HOME%
@imaizume
imaizume / tonton-count.rb
Last active July 26, 2016 08:02
トントンから日時ごとに集まれる人の数を表示する
require 'nokogiri'
require 'open-uri'
require 'pp'
require 'matrix'
unless ARGV.length > 0
puts "Please pass tonton's URL to the argument."
exit
end
@imaizume
imaizume / .gitignore
Last active September 22, 2021 11:59
TrelloのカードをSpreadSheetで記録するGoogle Apps Script
# Created by https://www.gitignore.io/api/webstorm
### WebStorm ###
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
# User-specific stuff:
.idea
@imaizume
imaizume / ping-logging.sh
Created February 3, 2016 12:29
Concurrently ping given IP and log the results with time stamp.
#!/bin/bash
cd `dirname $0`
if [ $# -le 0 ]; then
echo "Please set more than 1 arguments" 1>&2
exit 1
fi
args=("$@")
argn=$#