Skip to content

Instantly share code, notes, and snippets.

View hmalphettes's full-sized avatar

Hugues Malphettes hmalphettes

  • Standard Chartered Bank
  • Singapore
  • 15:28 (UTC +08:00)
View GitHub Profile
@hmalphettes
hmalphettes / macos_jenv_install.sh
Last active August 29, 2015 13:56
JDK8 on Macosx with http://jenv.be
# Install jenv with brew
brew tap jenv/jenv
brew install jenv
# I did not touch my .zshrc or my bashrc: the jenv binary is already on the PATH thanks to brew.
# Instead:
mkdir ~/.jenv/versions
# Download jdk8 from Oracle in a web browser: https://jdk8.java.net/download.html
# Then add it:
@hmalphettes
hmalphettes / DVStringFieldMapper.java
Created November 14, 2014 01:21
Extended StringFieldMapper to have a docvalues on an analyzed string
/**
* License: same than Elasticsearch: ASL-2.0.
* Source: copy and paste bits and pieces from the original Elasticsearch StringFieldMapper.
*/
package org.elasticsearch.docvalues.exporter;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseField;
import static org.elasticsearch.index.mapper.core.TypeParsers.parseMultiField;
import java.io.IOException;
@hmalphettes
hmalphettes / Dockerfile
Created November 24, 2014 07:51
setup and run the dockerized virtual hosting demo
# Builds the goodbye world nodejs app
FROM google/nodejs-runtime
'use strict';
const cp = require('child_process');
const fs = require('fs');
const folders = foldersToProcess();
const allDeps = {};
var output = 'dependencies-report.csv';
readAllDependencies();
@hmalphettes
hmalphettes / em_download_test.rb
Created October 29, 2011 06:06
Download a file with EventMachine
require 'rubygems'
require 'eventmachine'
require 'em-http'
# Learning EM: file download with progress.
# See http://rubylearning.com/blog/2010/10/01/an-introduction-to-eventmachine-and-how-to-avoid-callback-spaghetti/
# for a brilliant introduction to EM.
EM.run do
# just an innocent eclipse file of 2megs from a reasonably fast but not balzing fast server.
@hmalphettes
hmalphettes / ubuntu-12.04-gems.erb
Created March 14, 2012 04:27
Chef bootstrap With root-only rvm and ruby 1.9.2 on ubuntu 12.04
bash -c '
echo "boostrap chef on a ubuntu VM. Install ruby via rvm sandbox it for the root user: does not install rvm system wide."
echo "Example VM already booted: knife bootstrap 192.168.122.165 -x ubuntu -P ubuntu -d ubuntu-12.04-gems --node-name my_node --run-list role[intalio_micro_all] --environment intalio-CF --sudo"
echo "Example EC2 with knife-ec2: knife bootstrap ec2-122-248-197-139.ap-southeast-1.compute.amazonaws.com -i ~/.ec2/hmalphettes-ap.pem -x ubuntu -d ubuntu-12.04-gems i --run-list \"role[intalio_micro_all]\" --environment intalio-CF --no-host-key-verify --sudo"
echo "Example EC2 with knife-ec2: knife ec2 server create -I $UBUNTU_AMI -f m1.large -x ubuntu -d ubuntu-12.04-gems -i $EC2_KEYPAIR_PEM \"--run-list role[intalio_micro_all]\" -G http-https-ssh-smtp-vmreg -N ec2-ubuntu-new --region $EC2_REGION --availability-zone ap-southeast-1b --ebs-size $SIZE --no-host-key-verify --environment intalio-CF"
echo "Example HP Cloud with knife-hp: knife hp server create --flavor 103 --image 5579 --ssh-
@hmalphettes
hmalphettes / .bashrc
Created March 23, 2012 01:46
"my" ~/.bashrc: rvm and git prompt; ec2, esx, java mvn, tycho
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
#git show branch and other things in the console
#http://henrik.nyh.se/2008/12/git-dirty-prompt
RED="\[\033[0;31m\]"
YELLOW="\[\033[0;33m\]"
GREEN="\[\033[0;32m\]"
BLUE="\[\033[0;34m\]"
{
"hosts": [
{
"name": "localhost",
"port": 2084,
"containers": 4,
"platform": "kyu"
}
]
}
@hmalphettes
hmalphettes / gist:5027178
Last active December 14, 2015 04:19 — forked from haf/gist:2843680
Support for `vagrant ssh` via cygwin+openssh Original version of this patch uses 'where' which fails on cygwin

If you are using vagrant, you probably-statistically are using git. Make sure you have its binary folder on your path, because that path contains 'ssh.exe'.

Now, modify C:\vagrant\vagrant\embedded\lib\ruby\gems\1.9.1\gems\vagrant-1.0.3\lib\vagrant\ssh.rb to comment out the faulty Windows check and add a real SSH check:

 if Util::Platform.windows?
   if !Kernel.system("where ssh >NUL 2>&1") && !File.exists?("/usr/bin/ssh")
     raise Errors::SSHUnavailableWindows, :host => ssh_info[:host],
                                        :port => ssh_info[:port],
 :username => ssh_info[:username],
@hmalphettes
hmalphettes / Kibana Dash Test01
Created June 6, 2013 04:15
First experiment for a kibana dashboard
{
"title": "Logstash Search",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [