Skip to content

Instantly share code, notes, and snippets.

View mmasashi's full-sized avatar

Masashi mmasashi

View GitHub Profile
@mmasashi
mmasashi / osx_yosemite_initial_settings.md
Created November 30, 2014 09:20
OSX Yosemite Initial Settings

Prepare for OS update (事前準備)

  • Backup data to Time machine drive
  • Backup some important data to HDD drive manually
  • Make a list which directory should be copied into the new OS

Clean Install Yosemite (Yosemiteのクリーンインストール)

Create YOSEMITE Boot USB Drive (Yosemiteのブートドライブを作成)

@mmasashi
mmasashi / gzsplit.rb
Created November 28, 2014 06:23
split gz file into multiple gz files
# gzsplit.rb
# split gz files into pieces
# usage: ruby gzsplit [file-name] [lines-per-file]
require 'zlib'
require 'fileutils'
OUTPUT_DIR = "splited_files"
file_name = ARGV[0] || "20130910-03_01_00.gz"
lines_per_file = ARGV[1] ? ARGV[1].to_i : 5
@mmasashi
mmasashi / tcpdumpcmd.sh
Created November 28, 2014 06:19
tcpdump command
#!/bin/bash
tcpdump -s0 -i eth0 -X port 44567 -w test.cap
@mmasashi
mmasashi / gist:8952ce4520a030775948
Created November 27, 2014 05:35
Circleci boost lib install error
ubuntu@box432:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 12.04.5 LTS
Release: 12.04
Codename: precise
ubuntu@box432:~$ sudo apt-get install libboost-all-dev
Reading package lists... Done
Building dependency tree
@mmasashi
mmasashi / gist:003adc1c9a1e6bf90f6e
Created November 12, 2014 00:28
keep git merge message
We're using git's Merge commit history to list features&bug fixes in a release tag. But I found cases where no merge commit was made as a result of `git merge`. According to this article (http://arjanvandergaag.nl/blog/clarify-git-history-with-merge-commits.html) it's due to fast-forward merge. To prevent it from happening, use `--no-ff` option when you merge. e.g. `git merge --no-ff feature/u483-asdf-asdf` This create a merge commit even if fast-forward merge is possible. Or, you can make it default with `git config --add merge.ff false`
Omit them needless merge commits. Add them to convey information.
@mmasashi
mmasashi / exit_code_matches.rb
Last active May 26, 2020 19:43 — forked from stevenharman/exit_code_matches.rb
Exit code matcher for rspec 3
RSpec::Matchers.define :terminate do |code|
actual = nil
def supports_block_expectations?
true
end
match do |block|
begin
block.call
@mmasashi
mmasashi / rvm-installer-with-comment.sh
Created August 7, 2014 14:52
RVM install script with explanation comment.
## rvm bash install script reading memo
## Based on https://github.com/wayneeseguin/rvm/blob/1.25.28/binscripts/rvm-installer
#!/usr/bin/env bash
# enable extended pattern matching
# shopt command changes the shell optional behavior
# extglob option enables you to write like `ls !(b*)`
# http://stackoverflow.com/questions/216995/how-can-i-use-inverse-or-negative-wildcards-when-pattern-matching-in-a-unix-linu
shopt -s extglob
cat /dev/urandom | LC_CTYPE=C tr -dc '[:alnum:]' | head -c 40 && echo
@mmasashi
mmasashi / downgrade_rubygems.sh
Created January 3, 2014 19:48
Downgrade rubygems version.
$ gem -v
2.0.3
$ gem list rubygems-update
$ gem uninstall -v 2.0.3 rubygems-update
$ gem install -v 1.8.24 rubygems-update
$ update_rubygems
$ gem -v
1.8.24
@mmasashi
mmasashi / absolute_dir_path.sh
Created December 9, 2013 21:13
How to get the absolute directory path in the shell file.
dir_path=$(cd $(dirname $0);pwd)