Skip to content

Instantly share code, notes, and snippets.

View jmatsu's full-sized avatar
🏠
Working from home

Jumpei Matsuda jmatsu

🏠
Working from home
  • Tokyo, Japan
  • 01:17 (UTC +09:00)
View GitHub Profile
function main()
{
Object::class.new Test object1
object1.test_echo
}
function Object::class.new() {
local class=$1
local self=$2
file=$0
output="output.file"
from_b=`tail -r ${file}|grep -n .|grep "#### template"|head -1|grep -o "[0-9]*"`
cat ${file}|tail -${from_b} > "${output}"
eval echo "\"$(cat ${output})\"" > "${output}"
// do something
exit 0
#!/usr/bin/env bash
set -x
### for opt-parse
_MY_NAME=$(basename $0)
_MY_LOCATION="$(\cd "$(dirname "${BASH_SOURCE:-${(%):-%N}}")"; _pwd=`pwd`/${_MY_NAME};
\cd "$(dirname `readlink -f ${_pwd} 2> /dev/null||readlink ${_pwd} 2> /dev/null` 2> /dev/null)" ; pwd)"
_MY_VERSION='0.1'
_DEFAULT_ARGS="$@"
@jmatsu
jmatsu / brew_extensions.sh
Last active August 29, 2015 14:28
Homebrew extensions. E.g) To check the frequency of brew-update. To export installed formulas for other machines which have installed Homebrew.
brew::logger() {
local history_file="${BREW_LOGGER_LOCATION:-$HOME}/.brew_history"
echo "$(date +%s) brew $@" >> "${history_file}"
command brew "$@"
# Compress each of sequences which are continuous executed commands
cat "${history_file}"|tail -r|uniq -f1|tail -r > "${history_file}.backup"
mv -f "${history_file}.backup" "${history_file}"
}
preexec_on_bash() {
[ -z "$COMP_LINE" ] && [ ! "$BASH_COMMAND" = "$PROMPT_COMMAND" ] && {
# $BASH_COMMAND is input commands which are separated by '|', ';' etc..
if [[ $BASH_COMMAND =~ ^\\?git\ ]]; then
:
fi
}
}
trap 'preexec_on_bash' DEBUG
git::logger() {
:
if [ "$1" = "subtree" ]; then
if [ "$2" = "add" ]; then
# --: git subtree add --prefix=<prefix> <commit>
# or: git subtree add --prefix=<prefix> <repository> <ref>
# or: git subtree merge --prefix=<prefix> <commit>
# or: git subtree pull --prefix=<prefix> <repository> <ref>
# or: git subtree push --prefix=<prefix> <repository> <ref>
# or: git subtree split --prefix=<prefix> <commit...>

things to build when setting up new machine

Working in progress.

  • Install all
  • Sublime Text
  • Google Chrome
  • iTerm2
@jmatsu
jmatsu / retrieve_plan.coffee
Created August 27, 2015 15:51
One of my lab's Hubot script
# Description:
# Retrieve the plans which are on weekdays from specified Google Calendar.
#
# Commands:
# hubot #{Words to run this}
#
# Notes:
# Displayed plan is found first.
# PLEASE FIX ME!!!

ARC022 B

ABC005 C

Code Fes Quad B