Skip to content

Instantly share code, notes, and snippets.

@emag
emag / .ssh_config
Last active December 17, 2015 18:39
プロキシ環境で git を利用する際の ${HOME}/.ssh/config の内容。要 corkscrew コマンド
Host github.com
HostName github.com
Port 22
ProxyCommand corkscrew $PROXY_DOMAIN $PROXY_PORT %h %p
User git
IdentityFile ~/.ssh/id_rsa
IdentitiesOnly yes
@emag
emag / .vimrc.neobundle.vim.local
Created May 27, 2013 02:40
プロキシ環境下で git プロトコルが利用できない場合の neobundle 設定
" ############################################################################
" # neobundle.vim.local
" ############################################################################
"
" for proxy
let g:neobundle#types#git#default_protocol='https'
@emag
emag / bootstrap_centos64_32.sh
Last active December 19, 2015 01:48
Vagrant provisioning script for CentOS 6.4 32bit
#!/usr/bin/env bash
INSTALL="yum install -y"
GROUP_INSTALL="yum groupinstall -y"
ENABLE_REPO="--enablerepo=epel,remi,rpmforge,nginx"
EPEL="http://dl.fedoraproject.org/pub/epel/6/i386/epel-release-6-8.noarch.rpm"
REMI="http://rpms.famillecollet.com/enterprise/remi-release-6.rpm"
RPMFORGE="http://pkgs.repoforge.org/rpmforge-release/rpmforge-release-0.5.3-1.el6.rf.i686.rpm"
NGINX="http://nginx.org/packages/centos/6/noarch/RPMS/nginx-release-centos-6-0.el6.ngx.noarch.rpm"
@emag
emag / x-forwarded-for-rule.btm
Last active December 20, 2015 02:09
This is a Byteman rule to get real IP from request via proxy(such as load balancer, reverce proxy). Simply replacing HttpServletRequest#getRemoteAddr return value with HTTP Header: x-forwarded-for value. I tested it on WildFly 8.0.0.Alpha3, JBoss AS 7.1, Tomcat 7.
RULE x-forwarded-for
INTERFACE javax.servlet.http.HttpServletRequest
METHOD getRemoteAddr
AT EXIT
IF $0.getHeader("x-forwarded-for") != null
DO
RETURN $0.getHeader("x-forwarded-for")
ENDRULE
@emag
emag / bootstrap_centos64_64.sh
Last active December 20, 2015 09:09
Vagrant provisioning script for CentOS 6.4 64bit
#!/usr/bin/env bash
## usage
# add this script path in VagrantFile
# ---
# Vagrant.configure("2") do |config|
# config.vm.box = "box-name"
# config.vm.provision :shell, :path => "bootstrap_centos64_64.sh"
# ...
# ---
@emag
emag / jbossas7-fluentd-agent-lite.conf
Last active December 22, 2015 01:48
flent-agent-list.conf for JBoss AS7
TAG_PREFIX=""
LOGS=$(cat <<"EOF"
wildfly.access $JBOSS_HOME/standalone/log/default-host/access.log.<date>
EOF
)
PRIMARY_SERVER="localhost:24224"
@emag
emag / wildfly-td-agent.conf
Created August 31, 2013 14:18
td-agent.conf for WildFly
<source>
type forward
</source>
<match wildfly.access>
type copy
<store>
type file_alternative
path /var/log/td-agent/wildfly-access.log
@emag
emag / wildfly-begin-end.btm
Last active December 29, 2015 22:09
WildFly Byteman rule
RULE WILDFLY_STARTED
CLASS org.jboss.as.server.BootstrapListener
METHOD done
AT EXIT
IF TRUE
DO traceln("WildFly started with Byteman!")
ENDRULE
RULE WILDFLY_STOPPED
CLASS org.jboss.as.server.ApplicationServerService
@emag
emag / add-access-log.cli
Created December 1, 2013 15:12
Add WildFly Access Log
/subsystem=undertow/server=default-server/host=default-host/setting=access-log:add(prefix=access)
package hello;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.util.FileSystemUtils;
import java.io.File;
public class Receiver {