Skip to content

Instantly share code, notes, and snippets.

View int128's full-sized avatar

Hidetake Iwata int128

View GitHub Profile
/*
* ハフマン符号化アルゴリズムの実装.
*
* Author: hidetake
* Time-stamp: <03/05/22 20:17:31 hidetake>
*/
#include <stdio.h>
#include <malloc.h>
//#define SHOW_TRACE
// requires classpath 'org.codehaus.groovy.modules.http-builder:http-builder:0.6'
/**
* Wait until the resource is ready state.
*/
def waitUntilResourceIsReady(String resource) {
def http = new groovyx.net.http.HTTPBuilder(resource)
def check = {
try {
http.get(contentType: groovyx.net.http.ContentType.TEXT)
@int128
int128 / httpd.conf
Created December 25, 2012 10:16
Apache configuration for HTTP/HTTPS forward proxy
Listen *:9090
<VirtualHost *:9090>
ProxyRequests on
AddDefaultCharset off
AllowCONNECT 443
<Proxy *>
Order deny,allow
Deny from all
</Proxy>
# allows HTTPS via CONNECT
esxi_host='root@192.168.1.100'
esxi_key='/home/jenkins/esxi_key'
function exec_on_esxi () {
ssh -i "${esxi_key}" "${esxi_host}" "$@"
}
function esxi_online_backup () {
vmid="$1"
vmname="$2"
@int128
int128 / openvpn-ca.sh
Created January 3, 2013 15:31
OpenVPN PKI setup
cd /etc/openvpn/pki
sudo certtool -c --load-ca-privkey ca.key --load-ca-certificate ca.crt --load-request $NODENAME.csr --outfile $NODENAME.crt
Generating a signed certificate...
Enter the certificate's serial number in decimal (default: xxxxx):
Activation/Expiration time.
The certificate will expire in (days): 1851
topdir="${WORKSPACE}/rpmbuild"
rpmdir="${topdir}/RPMS/$(uname -m)"
echo "%_topdir ${topdir}" > "${HOME}/.rpmmacros"
case "${TARGET}" in
*/httpd-*)
# patch for httpd-2.4.3
tarball="${TARGET##*/}"
module="${tarball%.tar.*}"
curl -O "${TARGET}"
@int128
int128 / git-http-backend-wrapper.cgi
Created January 17, 2013 00:54
Apache configuration for Git backend
#!/bin/sh
export GIT_PROJECT_ROOT=/home/git/repositories
export GIT_HTTP_EXPORT_ALL=1
exec /usr/libexec/git-core/git-http-backend
@int128
int128 / install.sh
Last active December 11, 2015 10:28
migrates to rbenv
#!/bin/bash -xe
cd /usr/local
sudo git clone git://github.com/sstephenson/rbenv.git
cd rbenv
sudo mkdir shims versions plugins
cd plugins
sudo git clone git://github.com/sstephenson/ruby-build.git
cat <<EOF | sudo tee /etc/profile.d/rbenv.sh
export RBENV_ROOT='/usr/local/rbenv'
export PATH="\$RBENV_ROOT/bin:\$PATH"
@int128
int128 / .gvimrc
Last active December 13, 2015 23:29
.gvimrc (Windows)
set guifont=MeiryoKe_Gothic:h12:cSHIFTJIS
set columns=120
set lines=50
set backupdir=C:\Users\hoge\vim
set directory=C:\Users\hoge\vim
set textwidth=0
@int128
int128 / oracle_statspack_report.bash
Created October 4, 2013 03:40
Generates Oracle StatsPack reports with SQL plans
#!/bin/bash
export BEGIN_SNAP_ID=$1
export END_SNAP_ID=$2
export REPORT_PREFIX=/tmp/spreport_${BEGIN_SNAP_ID}_${END_SNAP_ID}_pid$$
export ORACLE_AUTH=PERFSTAT/PERFSTAT
if [ "${END_SNAP_ID}" -a "${BEGIN_SNAP_ID}" ]; then
echo "BEGIN_SNAP_ID=${BEGIN_SNAP_ID}, END_SNAP_ID=${END_SNAP_ID}, REPORT_PREFIX=${REPORT_PREFIX}"
else
sudo -u oracle sqlplus ${ORACLE_AUTH} <<\EOF