Skip to content

Instantly share code, notes, and snippets.

@ykubota
ykubota / run.sh
Last active August 29, 2015 14:15
Specify JVM options (-XX) by file.
java -XX:Flags=vm.option.txt XXX
@ykubota
ykubota / psg.sh
Created June 8, 2014 13:31
ps and grep
#!/bin/bash
# custom favorite ps option(s)
ps='ps auxww'
this=$0
$ps | head --lines=1
for i in $*
do
# set [c]mmand to avoid grep
@ykubota
ykubota / GCLimit.java
Last active October 18, 2016 09:50
reproduce sample: java.lang.OutOfMemoryError: GC overhead limit exceeded
import java.util.ArrayList;
import java.util.List;
import java.util.Random;
public class GCLimit {
static public void main(String[] args) {
Random random = new Random();
List<String> interned = new ArrayList<>();
while(true) {
int length = random.nextInt(100);
@ykubota
ykubota / result of tree.sh
Last active August 29, 2015 13:57
tree heapstats-analyzer-1.1.0
heapstats-analyzer-1.1.0
├── filterDefine.xsd
├── heapstats.jar
├── heapstats.properties
├── howtouse_ja.txt
├── howtouse.txt
└── lib
├── jcommon-1.0.18.jar
├── jfreechart-1.0.15.jar
├── jgraphx.jar
@ykubota
ykubota / ClassHistrogram.groovy
Created December 9, 2013 18:38
ClassHistrogram集計用クラス。 クラスヒストグラムを1回以上出力させたログを読み込ませると、[クラス名][クラスヒストグラムインデックス] = [ランク, インスタンス, バイト数] となる二次元配列を取得する。
def static calc(filename){
def sheet = [:];
def h=[:];
def time = 0;
def seek = false
// ファイル読み込み
new File(filename).eachLine {
// 正規表現
if (it ==~ /^num\s+#instances\s+#bytes\s+class\sname/){
// Start of ClassHistogram
@ykubota
ykubota / new_gist_file
Created June 21, 2013 02:33
glassfish redmine
$ jruby -v
jruby 1.7.4 (1.9.3p392) 2013-05-16 2390d3b on OpenJDK 64-Bit Server VM 1.7.0_25-mockbuild_2013_06_19_07_21-b00 [linux-amd64]
org.jruby.exceptions.RaiseException: (LoadError) load error: openssl -- java.lang.NoClassDefFoundError: Could not initialize class org.jruby.ext.openssl.ASN1
|A')?
$ vim Gemfile
32 # jruby-openssl is bundled with JRuby 1.7.0
33 gem "jruby-openssl" if Object.const_defined?(:JRUBY_VERSION) && JRUBY_VERS ION < '1.7.0'
|A')<usotuki-
@ykubota
ykubota / setup.sh
Created June 19, 2013 02:23
GlassFish for Redmine
sudo yum install jruby
gem install warbler
cd redmine
gem install activerecord-jdbc-adapter -v '1.2.5'
warble config
vim config/warble.rb
warble war
@ykubota
ykubota / mysql.sh
Created June 18, 2013 07:12
Setup MySQL@Fedora18 for redmine
#sudo yum install -y gcc ruby-devel libxml2 libxml2-devel libxslt libxslt-devel
sudo yum install -y mysql mysql-server
sudo vim /etc/my.cnf
---
# nihongo mojibake taisaku
character-set-server = utf8
---