Skip to content

Instantly share code, notes, and snippets.

View gregory's full-sized avatar
🎯
Focusing

Grégory Horion gregory

🎯
Focusing
View GitHub Profile
@gregory
gregory / curl.md
Created March 8, 2018 16:41 — forked from subfuzion/curl.md
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

@gregory
gregory / proxy.js
Created July 31, 2017 17:02 — forked from shaond/proxy.js
var http = require('http');
var express = require('express');
var router = express.Router();
/* GET users listing. */
router.get('/', function(req, res) {
var request = require('request');
var url = req.query.url;
@gregory
gregory / a-results
Created April 16, 2017 07:49 — forked from jlongster/a-results
transducers w/immutable-js
# benchmark immutable.js with my transducers lib: https://github.com/jlongster/transducers.js
% node bench/immut.js
Immutable map/filter (1000) x 5,497 ops/sec ±2.63% (91 runs sampled)
transducer map/filter (1000) x 7,309 ops/sec ±0.73% (100 runs sampled)
Immutable map/filter (100000) x 62.73 ops/sec ±0.85% (67 runs sampled)
transducer map/filter (100000) x 80.15 ops/sec ±0.48% (71 runs sampled)
@gregory
gregory / introrx.md
Created April 3, 2017 07:37 — forked from staltz/introrx.md
The introduction to Reactive Programming you've been missing
@gregory
gregory / meteor-async.md
Created July 31, 2016 18:48 — forked from possibilities/meteor-async.md
Meteor Async Guide

From Meteor's documentation:

In Meteor, your server code runs in a single thread per request, not in the asynchronous callback style typical of Node. We find the linear execution model a better fit for the typical server code in a Meteor application.

This guide serves as a mini-tour of tools, trix and patterns that can be used to run async code in Meteor.

Basic async

Sometimes we need to run async code in Meteor.methods. For this we create a Future to block until the async code has finished. This pattern can be seen all over Meteor's own codebase:

# A little Meteor CheatSheet about Iron-Router. (updated on a weekly basis)
# Check our Studio: https://gentlenode.com/
meteor add iron:router
meteor update iron:router
# Iron Router > Configuration
@gregory
gregory / config.ru
Created June 4, 2016 20:05 — forked from nathany/config.ru
Magical Unicorn Configuration for Heroku
# add something like this to config.ru
# see https://github.com/kzk/unicorn-worker-killer
if Integer(ENV['UNICORN_KILLER'] || 0) != 0
require 'unicorn/worker_killer'
# Max memory size (RSS) per worker
use Unicorn::WorkerKiller::Oom, (350*(1024**2)), (400*(1024**2)), 30, true
end
@gregory
gregory / config.ru
Created June 4, 2016 20:04 — forked from lucashungaro/config.ru
Unicorn + Heroku + worker_killer + GC vars tweak
# This file is used by Rack-based servers to start the application.
# GC_FREQUENCY = 8
# require "unicorn/oob_gc"
# GC.disable # Don't run GC during requests
# use Unicorn::OobGC, GC_FREQUENCY # Only GC once every GC_FREQUENCY requests
# # Unicorn self-process killer
require "unicorn/worker_killer"
@gregory
gregory / gist:0aeaf4a433737f02f050
Created November 21, 2015 08:58
Docker 1.9.0 - Using docker-machine, swarm and overlay networking with etcd
docker-machine create -d virtualbox cluster-store
CLUSTER_STORE_IP=$(docker-machine ip cluster-store)
docker $(docker-machine config cluster-store) run -d \
--restart="always" \
--publish="2379:2379" \
microbox/etcd:2.1.1 \
-name etcd0 \
-advertise-client-urls http://${CLUSTER_STORE_IP}:2379 \
-listen-client-urls http://0.0.0.0:2379 \
@gregory
gregory / README.md
Created November 21, 2015 06:52 — forked from oscarrenalias/README.md
Docker service discovery with HAproxy, consul and registrator on Docker Machine and Docker Swarm