Skip to content

Instantly share code, notes, and snippets.

View bageljp's full-sized avatar

Keisuke Kadoyama bageljp

  • Tokyo, Japan
  • 01:19 (UTC +09:00)
  • X @bageljp
View GitHub Profile
@bageljp
bageljp / Preferences.sumblime-settings
Created November 10, 2012 06:22
Sublime Text 2 User Settings
// Settings in here override those in "Default/Preferences.sublime-settings", and
// are overridden in turn by file type specific settings.
{
// カーソルのスタイル
"caret_style": "blink",
// フォント
//"font_face": "DejaVuSans",
// フォントサイズ
"font_size": 12.0,
// タブによる補完
@bageljp
bageljp / etc_logrotate.d_mysqld
Created November 26, 2012 09:45
mysqld configuration by amazonlinux
/var/log/mysqld.log /var/lib/mysqld/*log {
daily
rotate 31
dateext
missingok
postrotate
# just if mysqld is really running
if test -x /usr/bin/mysqladmin && \
/usr/bin/mysqladmin -u <user> -p<password> ping &>/dev/null
then
@bageljp
bageljp / s3java
Last active December 12, 2015 06:38
public PutObjectResult put(String key, InputStream input, long length) {
ObjectMetadata objectMetadata = new ObjectMetadata();
objectMetadata.setContentLength(length);
objectMetadata.setContentType("image/gif");
PutObjectRequest request = new PutObjectRequest(this.bucket, key, input, objectMetadata);
request.withCannedAcl(CannedAccessControlList.PublicRead);
log.info("S3にファイルをアップロードします… bucket:" + this.bucket + "\tkey:" + key);
PutObjectResult result = this.s3Client.putObject(request);
log.info("S3にファイルをアップロードしました。 bucket:" + this.bucket + "\tkey:" + key);
@bageljp
bageljp / index.html
Created February 17, 2013 13:57
upload_before_thumbnail
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>Thumbnail Load Example</title>
</head>
<body>
<h2>Select an image file</h2>
<p><input id="file-input" type="file"></p>
<div id="result" class="well">
@bageljp
bageljp / command
Created February 18, 2013 09:59
benchmark utils
while : ;do date; vmstat 2 30; echo -e "------------------------------------------------------\n\n"; done
while : ;do date; mpstat -P ALL 2 30; echo -e "------------------------------------------------------\n\n"; done
while : ;do date; free; sleep 10; echo -e "------------------------------------------------------\n\n"; done
while : ;do date; top -b -n 1 | head -20; sleep 2; echo -e "------------------------------------------------------\n\n"; done
@bageljp
bageljp / xenserver_running_vm.bash
Last active December 14, 2015 00:49
XenServer utils.
#!/bin/bash
#-------------------------
# define
#-------------------------
OUTPUT="/var/log/messages"
LANG="C"
#------------------------
@bageljp
bageljp / accesslog_count.bash
Last active October 9, 2019 21:59
access_log parse.
#!/bin/bash
LOG_FILE="access_log-20130310"
for i in `seq 4 1 23`; do
hour=`printf "%02d" ${i}`
# sourceIp
grep "09/Mar/2013:${hour}" ${LOG_FILE} | awk '{print $1}' | sort | uniq -c | sort -r > ip-${hour}.log
# url
grep "09/Mar/2013:${hour}" ${LOG_FILE} | awk '{print $7}' | sort | uniq -c | sort -r > url-${hour}.log
@bageljp
bageljp / FontsList.java
Created March 19, 2013 10:52
javac FontsList.java export CLASSPATH="`pwd`:${CLASSPATH}" java FontsList
import java.awt.Font;
import java.awt.GraphicsEnvironment;
public class FontsList {
Font [] fonts=GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
FontsList(String as[]){
char dspchr=0;
int fnumber=fonts.length;
int sp,n=0;
#!/bin/bash
MYSQL_USER="mysql"
MYSQL_PASS="password"
MYSQL_HOST_MASTER[0]="192.168.0.1"
MYSQL_HOST_MASTER[1]="192.168.0.2"
MYSQL_HOST_SLAVE[0]="192.168.0.2"
MYSQL_HOST_SLAVE[1]="192.168.0.3"
echo "------------------"
@bageljp
bageljp / put_mon.bash
Created April 16, 2013 04:47
CloudWatch custom metric put.
#!/bin/bash
#--------------------------------------
#
# Author(s):
#
# K.Kadoyama
#
# Usage:
#
# mon_put.bash