Skip to content

Instantly share code, notes, and snippets.

@shyiko
shyiko / vagrantfile
Created May 8, 2014 08:24
mysql-5.0.95-sandbox
Vagrant.configure("2") do |config|
config.vm.box = 'lucid32'
config.vm.box_url = 'http://files.vagrantup.com/lucid32.box'
config.vm.provision :shell, :inline => %Q(
apt-get update && apt-get install -y make libaio1 # libaio1 required by mysql
echo 'Downloading MySQL distribution ...'
wget --progress=dot:mega --content-disposition \
http://mirror.cogentco.com/pub/mysql/MySQL-5.0/mysql-5.0.95-linux-i686-glibc23.tar.gz \
2>&1 | grep --line-buffered -o '[0-9]*%'
wget -O - https://launchpad.net/mysql-sandbox/mysql-sandbox-3/mysql-sandbox-3/+download/MySQL-Sandbox-3.0.33.tar.gz | tar xzv
@shyiko
shyiko / grep.js
Created May 18, 2014 12:57
Monkey patch bringing Mocha's --grep and --invert to Cucumber.js
function unquote(value) {
return /^'.*'|".*"$/.test(value) ? value.slice(1, -1) : value;
}
module.exports = function (options) {
process.argv.reduce(function (obj, value) {
var groups = /^--(\w+)(?::(.+))?$/.exec(value);
if (groups !== null) {
obj[groups[1]] = unquote(groups[2] || '');
@shyiko
shyiko / gist:b67e160a09dbc42d1d67
Created October 13, 2014 11:10
justniffer squeeze installation
wget http://ftp.jaist.ac.jp/pub/sourceforge/j/project/ju/justniffer/justniffer/justniffer%200.5.11/justniffer_0.5.11.tar.gz
tar -xzf justniffer_0.5.11.tar.gz
cd justniffer-0.5.11
apt-get install make
apt-get install gcc
apt-get install g++
apt-get install libc6
apt-get install libboost-dev
apt-get install libboost-regex-dev
apt-get install libboost-iostreams-dev
@shyiko
shyiko / hg-to-git.sh
Last active August 29, 2015 14:22
`hg` to `git` one-liner
#!/bin/bash
CHECKOUT_DIR=$PWD
if [ ! -d /tmp/fast-export.da7f34caf5629d283761 ]; then
git clone https://github.com/frej/fast-export /tmp/fast-export
(cd /tmp/fast-export && git reset --hard d202200fd9da)
cat >/tmp/fast-export.patch<<-EOF
diff --git a/hg2git.py b/hg2git.py
index c58cade..4abcbc2 100755
--- a/hg2git.py
+++ b/hg2git.py
@shyiko
shyiko / .editorconfig
Created June 27, 2015 23:54
docker-armv7-redis-image
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@shyiko
shyiko / .editorconfig
Created June 27, 2015 23:59
docker-armv7-archlinux-image
# http://editorconfig.org
root = true
[*]
indent_style = space
indent_size = 2
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@shyiko
shyiko / findclass.sh
Created May 19, 2011 13:00
Looks for class inside JARs/WARs/EARs/SARs
#!/bin/bash
DIRECTORY=$1
CLASS_NAME=$2
find $DIRECTORY -name '*.[jwes]ar' | while read LINE; do
grep -q $CLASS_NAME "$LINE";
if [ $? -eq 0 ]; then
REFERENCES=$(jar tvf "$LINE" | grep $CLASS_NAME);
if [ -n "$REFERENCES" ]; then
echo "$LINE";
echo "$REFERENCES";
@shyiko
shyiko / TomcatEmbeddedServer.java
Created June 7, 2011 11:50
Tomcat Embedded Server
import org.apache.catalina.Context;
import org.apache.catalina.Engine;
import org.apache.catalina.Host;
import org.apache.catalina.LifecycleException;
import org.apache.catalina.connector.Connector;
import org.apache.catalina.startup.Embedded;
import java.io.File;
/**
@shyiko
shyiko / DevModeJettyLauncher.java
Created June 26, 2011 14:05
Vaadin GWT Jetty Launcher
/*
* Copyright 2011 Stanley Shyiko
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@shyiko
shyiko / intellij-idea-jd-gui-launcher.sh
Created November 12, 2011 09:27
JD-GUI Launcher for Intellij IDEA (via External Tools)
#!/bin/bash
JDGUI_BIN=$1; FILE_PATH=$2
DELIMITER_INDEX=$(awk -v a="$FILE_PATH" -v b="!/" 'BEGIN{print index(a,b)}')
if [ $DELIMITER_INDEX -eq 0 ]; then
$JDGUI_BIN $FILE_PATH
else
JAR_FILE=${FILE_PATH:0:$DELIMITER_INDEX-1}
CLASS_RELATIVE_LOCATION=${FILE_PATH:$DELIMITER_INDEX+1}
if [[ $CLASS_RELATIVE_LOCATION == "" ]]; then
$JDGUI_BIN $JAR_FILE