Skip to content

Instantly share code, notes, and snippets.

@PaulMougel
PaulMougel / Ansible 2.3
Created September 30, 2017 13:04
Ansible pipelining issue
$ git checkout stable-2.3
[...]
$ source hacking/env-setup
[...]
$ time ANSIBLE_SSH_PIPELINING=False ansible -vvv -i /tmp/my-host my-host.com -m shell -a 'echo ok'
No config file found; using defaults
META: ran handlers
Using module file /private/tmp/ansible/lib/ansible/modules/commands/command.py
<my-host.com> ESTABLISH SSH CONNECTION FOR USER: None
<my-host.com> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/Users/pmougel/.ansible/cp/e4c7a8aacc my-host.com '/bin/sh -c '"'"'echo ~ && sleep 0'"'"''
@PaulMougel
PaulMougel / index.js
Last active June 7, 2017 19:17
How to use bell for JIRA
// You'll need to create a hapi.js server
//
// For more information about tokens, check
// https://developer.atlassian.com/jiradev/jira-apis/jira-rest-apis/jira-rest-api-tutorials/jira-rest-api-example-oauth-authentication
var jiraStrategy = require('./jira.strategy');
server.auth.strategy('jira', 'bell', {
provider: strategy('https://xxx.atlassian.net'),
password: 'COOKIE-PASSWORD',
@PaulMougel
PaulMougel / index.js
Created April 1, 2015 08:20
javascript bind stream example
// $ dd if=/dev/random of=bigfile.txt bs=4k count=1k
var Counter = function () {
this.count = 0;
this.tick = function () {
this.count++;
console.log(this.count);
}
};
@PaulMougel
PaulMougel / run
Created April 1, 2015 08:13
javascript bind
$ node test2.js
1
2
3
NaN
4
@PaulMougel
PaulMougel / index.js
Created April 1, 2015 08:08
bind example
var express = require('express');
var Logger = function (level) {
this.level = level;
this.log = function (message) {
if (message === undefined) {
message = "...";
}
console.log('[' + this.level + '] ' + message);
};
@PaulMougel
PaulMougel / 0-installation.sh
Last active June 21, 2016 10:19
Attachment upload & indexation in Elasticsearch
# https://github.com/elasticsearch/elasticsearch-mapper-attachments
plugin install elasticsearch/elasticsearch-mapper-attachments/2.4.2
curl -X PUT http://localhost:9200/test
# Note that here we declare that the attachement is stored in the field "my_attachment"
curl -X PUT http://localhost:9200/test/pdf/_mapping -d '{"pdf": {"properties": {"my_attachment": {"type": "attachment"}}}}'
@PaulMougel
PaulMougel / fix-css-classes.sh
Last active August 29, 2015 14:08
Fix material-design-icons CSS classes
set -e
for filename in *.css
do
category=${filename%.*}
category=${category#sprite-}
sed "s/^\.icon/\.icon-$category/" < $filename > $filename.new
mv -f $filename.new $filename
done
@PaulMougel
PaulMougel / gist:b962949958e26e932b8a
Last active August 29, 2015 14:06
hapi gzip issue

Image 280, served from filesystem

MD5 (/image/280 from Chrome)              = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from Chrome)       = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280 from curl)                = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from curl)         = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280 from Firefox)             = 00f543dd8a14fa23f6b43806a97cd415
MD5 (/image/280.nii.gz from Firefox)      = 66e40034de146a20ce146df0eccb184b
MD5 (image stored on filesystem)          = 00f543dd8a14fa23f6b43806a97cd415
@PaulMougel
PaulMougel / npm-debug.log
Created August 20, 2014 13:22
rstats install fails
~/t/rstats ❯❯❯ npm i rstats ⏎
npm WARN package.json tmp@0.0.0 No description
npm WARN package.json tmp@0.0.0 No repository field.
npm WARN package.json tmp@0.0.0 No README data
npm http GET https://registry.npmjs.org/rstats
npm http GET https://registry.npmjs.org/rstats
npm http 304 https://registry.npmjs.org/rstats
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings
{"event":"request","timestamp":1400685220411,"id":"1400685220411-98077-30707","instance":"https://localhost:8081","labels":[],"method":"get","path":"/public/scripts/directives/navBar.js","query":{},"source":{"remoteAddress":"127.0.0.1","userAgent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0","referer":"https://localhost:8081/public/"},"responseTime":8,"statusCode":304,"log":[{"request":"1400685220411-98077-30707","timestamp":1400685220411,"tags":["hapi","received"],"data":{"id":"1400685220411-98077-30707","method":"get","url":"/public/scripts/directives/navBar.js","agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:29.0) Gecko/20100101 Firefox/29.0"}},{"request":"1400685220411-98077-30707","timestamp":1400685220416,"tags":["hapi","handler"],"data":{"msec":1.6566630005836487}},{"request":"1400685220411-98077-30707","timestamp":1400685220419,"tags":["hapi","response"]},{"request":"1400685220411-98077-30707","timestamp":1400685220421,"tags":["hapi","internal","implemen