Skip to content

Instantly share code, notes, and snippets.

@relax-more
relax-more / AnyController.java
Created February 20, 2013 08:19
[java] [spring] Spring@ResponseBodyを利用して、HeaderとjsonStringを返す  Access-Control-Allow-OriginをresponceHeaderに設定するために利用
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Controller;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
@relax-more
relax-more / gist:5028141
Last active December 14, 2015 04:29
[MySQL] MySQLのMastar fail over に関して調べてみた
発端はDBAさんとのお話。
前略。
Multi-Master Replication Manager を利用したら良いよ。だからDNSの申請はいらないよ。
どういうこっちゃ?と思って調べてみたのでメモ。
それに続いて、一般的なFail Overの方法ってなんだろう?と気になったのでメモ。
結局、FailOverというか、MySQLの更新の仕組みがよくわかってない、みたいな感じになって実に残念w
@relax-more
relax-more / gist:5062022
Created March 1, 2013 02:21
Mac で Eclipse の F3 ジャンプから戻るメモ
command + [
参考
http://d.hatena.ne.jp/hiru926/20090610/1244608057
@relax-more
relax-more / log
Last active March 20, 2018 12:30
[java] GCの調査をしたのでメモ
2013-03-12T17:29:32.875+0900: [GC [ParNew: 105726K->658K(118016K), 0.0036680 secs] 940860K->835893K(1035520K), 0.0038120 secs] [Times: user=0.04 sys=0.00, real=0.01 secs]
2013-03-12T17:29:33.937+0900: [GC [ParNew (promotion failed): 105618K->105610K(118016K), 0.0631610 secs][CMS: 835245K->259864K(917504K), 1.8827850 secs] 940853K->259864K(1035520K), [CMS Perm : 53618K->53373K(83968K)], 1.9461600 secs] [Times: user=1.98 sys=0.02, real=1.94 secs]
2013-03-12T17:29:35.952+0900: [GC [ParNew: 104960K->4540K(118016K), 0.0079190 secs] 364824K->264404K(1035520K), 0.0080600 secs] [Times: user=0.07 sys=0.00, real=0.01 secs]
2013-03-12T17:29:36.076+0900: [GC [ParNew: 109500K->4641K(118016K), 0.0096710 secs] 369364K->264505K(1035520K), 0.0098120 secs] [Times: user=0.03 sys=0.00, real=0.01 secs]
@relax-more
relax-more / gist:5167100
Last active June 8, 2018 01:57
[nginx] 設定変更・適用
[hogehoge@ ~]$ sudo /usr/local/nginx/sbin/nginx -t
nginx: the configuration file /usr/local/nginx/conf/nginx.conf syntax is ok
nginx: configuration file /usr/local/nginx/conf/nginx.conf test is successful
[hogehoge@ ~]$ sudo /usr/local/nginx/sbin/nginx -s reload
@relax-more
relax-more / CreateRandomNumberTest.java
Created March 15, 2013 03:24
[java] SecureRandomについてSeedが同じ場合に同じ番号が生成されるのか調べてみた
public class CreateRandomNumberTest{
Logger LOGGER = LoggerFactory.getLogger(CreateRandomNumberTest.class);
@Test
public void testExpire(){
List<Long> rundomList1 =new ArrayList<Long>();
List<Long> rundomList2 =new ArrayList<Long>();
SecureRandom rundom = new SecureRandom();
@relax-more
relax-more / split_separate_text.sh
Last active December 15, 2015 03:19
[Shell] テキストファイルの分割 + 行の文字を分割 + 拡張子一括変更
split -l 100000 number_all.txt number.txt.
sed -e 's/^\([0-9]\{8\}\)/\1,/g' number.txt > number.sepalate.txt
# remae
# 拡張子を追加
for nm in number.sepalate.*; do mv $nm $nm.txt; done
#######
# 追記
@relax-more
relax-more / manner.sh
Created March 26, 2013 02:09
[Shell] OptionParamをもらう+OptionParamを判定して必要な値が設定されていなければHelpMessageを表示する
while getopts f:t:r:h opt; do
case $opt in
f) FROM_DATE="${OPTARG}" ;;
t) TO_DATE="${OPTARG}" ;;
h) HELP="true" ;;
*) ERROR="true" ;;
esac
done
function help()
@relax-more
relax-more / httpd.conf
Created April 11, 2013 13:02
[apache][conf] FollowSymLinks
# FollowSymLinks はDocumentRoot下にシンボリックリンクされたファイルを利用するために必要。
<Directory />
Options FollowSymLinks
AllowOverride None
FileETag None
</Directory>
@relax-more
relax-more / gist:5385388
Last active December 16, 2015 05:38
[Shell][perl] データが正しく桁分割されているかを確認するためのワンライナー
$ perl -ne 'if (/^[0-9]{7} [0-9]{7}\r\n$/) { print } ' *.txt | wc -l