Skip to content

Instantly share code, notes, and snippets.

View jp's full-sized avatar
🥔

Julien Pellet jp

🥔
View GitHub Profile
require 'rspec'
require 'json'
require 'active_support/all'
require 'pry'
def input
[
{lastmodificationdate:"2012-11-16",userproject:'FCBIZ',totalcost:10},
{lastmodificationdate:"2012-11-16",userproject:'LMS',totalcost:20},
{lastmodificationdate:"2012-11-16",userproject:'NetEngine',totalcost:52},
@jp
jp / index.html
Created February 13, 2013 03:23 — forked from darwin/index.html
<!DOCTYPE html>
<meta charset="utf-8">
<link rel="stylesheet" href="http://cmx.io/v/0.1/cmx.css"/>
<script src="http://cmx.io/v/0.1/cmx.js"></script>
<body>
<scene id="scene1">
<label t="translate(0,346)">
<tspan x="0" y="0em">Comix Sample</tspan>
</label>
<actor t="translate(131,49)" pose="-11,9|-5,117|-11,99|-11,89|-11,79|-11,59|-16,34|-21,9|-6,34|-1,9|-18,79|-18,59|-6,79|-1,59">
@jp
jp / gist:5449809
Created April 24, 2013 05:21
Generate cloudfront signed URL from a bucket
CONNECTION = Fog::Storage.new({
:provider => 'AWS',
:aws_access_key_id => S3_STREAMING_BUCKET[:key],
:aws_secret_access_key => S3_STREAMING_BUCKET[:secret],
:region => S3_STREAMING_BUCKET[:region]
})
S3 = CONNECTION.directories.get(S3_STREAMING_BUCKET[:bucket])
S3.files.each do |file|
@jp
jp / cache.rake
Created August 31, 2013 09:44 — forked from JangoSteve/cache.rake
# See rails source:
# https://github.com/rails/rails/blob/master/actionpack/lib/action_controller/caching/pages.rb
#
# Turn on caching in development, by changing this line to true in config/environments/development.rb:
#
# config.action_controller.perform_caching = true
#
# Then run:
#
# bundle exec rake pages:cache
@jp
jp / puma
Last active August 29, 2015 13:57 — forked from niwo/puma
#!/bin/sh
#
# puma - this script starts and stops the puma daemon
#
# chkconfig: - 85 15
# description: Description \
# goes here...
# processname: puma
# config: /etc/puma.conf
# pidfile: /home/stanislaw/apps/micro-apps/puma/puma.pid
@jp
jp / morphline.conf
Last active August 29, 2015 14:01
morphline basic apache log conf
morphlines : [
{
# Name used to identify a morphline. E.g. used if there are multiple
# morphlines in a morphline config file
id : morphline1
# Import all morphline commands in these java packages and their
# subpackages. Other commands that may be present on the classpath are
# not visible to this morphline.
importCommands : ["com.cloudera.**", "org.apache.solr.**", "org.kitesdk.**"]
# open iptables for each node
iptables_ng_rule 'cluster' do
name '01-cluster-access'
chain 'INPUT'
rule search(:node,"chef_environment:#{node.chef_environment}").map {|node| "--source #{node[:ipaddress]} --jump ACCEPT" }
ip_version 4
end
@jp
jp / update-openssl-on-cluster.sh
Created October 3, 2014 10:19
run ssh command in a loop on an array of IP addresses
array=(
10.0.0.1
10.0.0.2
10.0.0.3
10.0.0.4
10.0.0.5
)
for i in "${array[@]}"
do
/*
npm install ws
node demo-websocket-client.js
( ---> curl 'localhost:9200/myindex/_search')
Ctrl-C
*/
var WebSocket = require('ws')
@jp
jp / gist:4628ddf1a1811f659d25
Last active September 18, 2022 00:31
kafka / node / websocket
var WebSocketServer = require('ws').Server
, wss = new WebSocketServer({ port: 8080 });
wss.broadcast = function broadcast(data) {
wss.clients.forEach(function each(client) {
client.send(JSON.stringify(data));
});
};
var kafka = require('kafka-node'),