Skip to content

Instantly share code, notes, and snippets.

Avatar

Hugues Malphettes hmalphettes

View GitHub Profile
View bindings-cheat-sheet.md
@hmalphettes
hmalphettes / pull-from-etcd.sh
Created Mar 9, 2016
push-to-etcd and pull-from-etcd
View pull-from-etcd.sh
#!/bin/bash
# Pull from etcd the template files.
function download() {
mkdir -p "$1"
pushd "$1"
local files="$(etcdctl ls /stoic-etc/$1)"
for file in $files; do
local filename="$(basename $file)"
etcdctl get $file > $filename
View gist:a5c63ea73b2c05d8a9f5
{
"hosts": [
{
"name": "localhost",
"port": 2084,
"containers": 4,
"platform": "kyu"
}
]
}
View listDependencies.js
'use strict';
const cp = require('child_process');
const fs = require('fs');
const folders = foldersToProcess();
const allDeps = {};
var output = 'dependencies-report.csv';
readAllDependencies();
@hmalphettes
hmalphettes / Dockerfile
Created Nov 24, 2014
setup and run the dockerized virtual hosting demo
View Dockerfile
# Builds the goodbye world nodejs app
FROM google/nodejs-runtime
@hmalphettes
hmalphettes / DVStringFieldMapper.java
Created Nov 14, 2014
Extended StringFieldMapper to have a docvalues on an analyzed string
View DVStringFieldMapper.java
/**
* 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 / test-uuid-v5.js
Created Jul 20, 2014
Generate uuid-v5 in node
View test-uuid-v5.js
var expect = require('chai').expect;
var UUID = require('./uuid-v5');
describe('When generating a uuid v5', function() {
it('must generate the expected uuids from 3 examples on the web', function() {
var testUrl = UUID.v5(UUID.URL, 'www.example.org');
var testDns = UUID.v5(UUID.DNS, 'www.example.org');
var testDns2 = UUID.v5(UUID.DNS, 'php.net');
// see the examples here: http://jsfiddle.net/rexmac/F3pwA/
expect(testDns).to.equal('74738ff5-5367-5958-9aee-98fffdcd1876');
expect(testUrl).to.equal('abe19220-c90c-5288-b33a-58772250d428');
View macos_jenv_install.sh
# 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 / Kibana Dash Test01
Created Jun 6, 2013
First experiment for a kibana dashboard
View Kibana Dash Test01
{
"title": "Logstash Search",
"rows": [
{
"title": "Options",
"height": "50px",
"editable": true,
"collapse": false,
"collapsable": true,
"panels": [
@hmalphettes
hmalphettes / gist:5027178
Last active Dec 14, 2015 — forked from haf/gist:2843680
Support for `vagrant ssh` via cygwin+openssh Original version of this patch uses 'where' which fails on cygwin
View gist:5027178

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],