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
  • 20:46 (UTC +09:00)
View GitHub Profile
@jmatsu
jmatsu / CurrentInformation.md
Last active August 29, 2015 14:15
Useful Git command with options when creating automation scripts.

Get current information of XXX

simple log

git log -n 1 This equals to the following command. (Default) git log -n 1 --format="commit %H%x0A\ Author: %an %ae%x0A\ Date: %ad"

commit id

git log -n 1 --format=%h collapsed

@jmatsu
jmatsu / GitPlaceHolder.txt
Created February 11, 2015 17:08
git place holder of format
The placeholders are:
%H: commit hash
%h: abbreviated commit hash
%T: tree hash
%t: abbreviated tree hash
@jmatsu
jmatsu / install_ruby_on_cent.sh
Last active August 29, 2015 14:15
Install Ruby x.y.z
#!/bin/sh
# Returns TRUE if $1 doesn't exist. $1 is command name, package name, or the fragment of them.
check_no_cmd()
{
# Does $PATH include $1?
which $1
if [ $? -eq 0 ]; then
return 1
fi
@jmatsu
jmatsu / ADF2015.Short-coding.txt
Last active August 29, 2015 14:18
Application Developer Festival 2015. Short coding. Java部門1位. 提出物と最短(多分)
adf2015 = {
:Session => "Short coding",
:Language => "Java",
:System => "AtCoder",
:Limitation => {
:jdk => "openjdk-1.7",
:class => "Main",
:stderr => "Compilation error",
:bytes => {
:LineBreak => 2,
import android.app.Activity;
import android.app.ActivityManager;
import android.app.ActivityManager.RunningServiceInfo;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.view.View;
/*
* Copyright {2014} {Matsuda Jumpei}
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
/**
* Created by amyu- on 2015/04/19.
*/
public class GeneralViewGroup extends ViewGroup {
@jmatsu
jmatsu / RunningOptionalJavascriptSnippets.txt
Last active August 29, 2015 14:21
For running a optional javascript on the javascript console of Google Chrome.
// This is a sample. jQuery will work fine on your console.
(script = document.createElement('script')).src = 'http://code.jquery.com/jquery-latest.min.js';
document.getElementsByTagName('head')[0].appendChild(script);
// Optional javascript works on your console too.
// Please modify next line to fit your infomation.
var username="jmatsu"; var gist_id="e5800eda726722decbda"; var filename="default_optional_mine.js";
(script2 = document.createElement('script')).src = 'https://rawgithub.com/'+username+'/'+gist_id+'/raw/'+filename;
document.getElementsByTagName('head')[0].appendChild(script2);
@jmatsu
jmatsu / taconv.sh
Last active August 29, 2015 14:22
Converts report files, which are non-text format although "txt", into text format or into correct format. For MacOSX.
#!/usr/bin/env bash
set -ue
function judge(){ echo "$1" | grep -e "$2" &> /dev/null; return $?; }
function judge_ms(){ unzip -Z "$1" | grep "$2" &> /dev/null; return $?; }
_FUCK_U=""
for txt in `find . -type f -iname \*.txt`; do
@jmatsu
jmatsu / commons_for_me.sh
Last active August 29, 2015 14:23
便利系
# 解凍
for tgz in `find . -maxdepth 1 -type f -iname \*.tgz`; do
tar -xvf $tgz
done
# ゴミ処理
for garbage in `find -E . -type f -iregex '^(\._.*|.*\~|#.*|.*\.DS_Store)$'`; do
rm $garbage
done
# -q stops to output error and temporal logs anywhere, -O be like '>' and -O - tells to output to stdout
wget -q -O - ${URL} | sh -
# -s doesn't output error and temporal logs anywhere, -L allows to track redirect transitions.
curl -sL ${URL} | sh