Skip to content

Instantly share code, notes, and snippets.

View int128's full-sized avatar

Hidetake Iwata int128

View GitHub Profile
@int128
int128 / build.gradle
Last active August 29, 2015 14:05
Apache MINA SSHD seems slow down on Java 8 due to secure random
if (System.getProperty('os.name') == 'Linux') {
tasks.withType(JavaForkOptions) {
systemProperty 'java.security.egd', 'file:/dev/./urandom'
}
}
@int128
int128 / jenkins.sh
Created August 29, 2014 02:34
from RPM
# Search usable Java. We do this because various reports indicated
# that /usr/bin/java may not always point to Java 1.5
# see http://www.nabble.com/guinea-pigs-wanted-----Hudson-RPM-for-RedHat-Linux-td25673707.html
for candidate in /etc/alternatives/java /usr/lib/jvm/java-1.6.0/bin/java /usr/lib/jvm/jre-1.6.0/bin/java /usr/lib/jvm/java-1.5.0/bin/java /usr/lib/jvm/jre-1.5.0/bin/java /usr/bin/java
do
[ -x "$JENKINS_JAVA_CMD" ] && break
JENKINS_JAVA_CMD="$candidate"
done
JAVA_CMD="$JENKINS_JAVA_CMD $JENKINS_JAVA_OPTIONS -DJENKINS_HOME=$JENKINS_HOME -jar $JENKINS_WAR"
@int128
int128 / setup_jenkins.sh
Last active August 29, 2015 14:06
Setting up Jenkins slave on Digital Ocean
fallocate -l 4G /swapfile
chmod -v 600 /swapfile
mkswap /swapfile
echo '/swapfile none swap sw 0 0' >> /etc/fstab
swapon -a
free
groupadd -g 900 jenkins
useradd -m -u 900 -g 900 -G docker jenkins
@int128
int128 / README.md
Created September 26, 2014 06:36
Enable stone repeater on systemd

Enable stone repeater on systemd

Prerequisite:

  • CentOS 7
  • Development Tools
    • yum groupinstall 'Development tools'
@int128
int128 / README.md
Last active January 17, 2024 07:55
Transparent proxy for Docker containers

Transparent proxy for Docker containers

If the Docker host is placed inside a proxy server, it needs to add the proxy configuration to each Dockerfile such as ENV http_proxy.

Following allows transparent access from the container to outside without any proxy configuration.

  1. Set up the transparent proxy
  2. Apply iptables rule for the transparent proxy
@int128
int128 / log.txt
Last active August 29, 2015 14:07
Install Panamax
% ssh [email protected]
CoreOS (beta)
core@panamax ~ $
core@panamax ~ $ sudo -i
panamax ~ # curl -O http://download.panamax.io/installer/pmx-installer-latest.zip
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 15983 100 15983 0 0 16368 0 --:--:-- --:--:-- --:--:-- 39366
panamax ~ # unzip pmx-installer-latest.zip -d /var/panamax
Archive: pmx-installer-latest.zip
@int128
int128 / gist:40035d3eb60494ff4085
Created October 2, 2014 06:27
Install Shipyard

Install Shipyard

See https://github.com/shipyard/shipyard

docker run -d --name rethinkdb -P shipyard/rethinkdb
docker run -d --name shipyard -p 8080:8080 -v /var/run/docker.sock:/var/run/docker.sock --link rethinkdb:rethinkdb shipyard/shipyard
@int128
int128 / README.md
Last active August 17, 2017 07:55
Publish the artifact to Bintray and Maven Central

Publish to Bintray and Maven Central

Add your Bintray user and key to ~/.gradle/gradle.properties as follows.

bintrayUser=example
bintrayKey=secret

Run the task.

@int128
int128 / README.md
Created October 9, 2014 12:19
Execute SSH script

Execute SSH script with groovy-ssh.

  • groovy-ssh-0.1.2
  • groovy-all-2.3.6
  • jsch-0.1.51
  • slf4j-api-1.7.7
  • logback-core-1.1.2
  • logback-classic-1.1.2
ssh {
outputLogLevel = LogLevel.LIFECYCLE
}
task example(type: SshTask) {
session(remotes.localhost) {
execute 'uname -a'
execute 'secret', logging: false