Skip to content

Instantly share code, notes, and snippets.

Avatar

vincent daubry vdaubry

View GitHub Profile
@vdaubry
vdaubry / gist:eafabf211957cbe87563
Created Feb 7, 2015
proxy drops custom header with https
View gist:eafabf211957cbe87563
$ curl -I -x 127.0.0.1:5566 http://www.google.fr
HTTP/1.1 200 OK
Date: Sat, 07 Feb 2015 16:28:17 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
Set-Cookie: PREF=ID=5472383c9c9d26f1:FF=0:TM=1423326497:LM=1423326497:S=yu2leDB676aEfg96; expires=Mon, 06-Feb-2017 16:28:17 GMT; path=/; domain=.google.fr
Set-Cookie: NID=67=iPjeDuufTg9UhlCrCuMmA93LSA8LWjBl_H3tliNTWZUsQS2Gtzw36xR2fFz_D9Nz0eWg8Fy_qtTy_cozXTuil7reP_6mwd0_WrH1j1RrSZZlDv3rEXyHOOXnZ1h07qax; expires=Sun, 09-Aug-2015 16:28:17 GMT; path=/; domain=.google.fr; HttpOnly
P3P: CP="This is not a P3P policy! See http://www.google.com/support/accounts/bin/answer.py?hl=en&answer=151657 for more info."
Server: gws
@vdaubry
vdaubry / gist:2869d85b2e8affdc5a8c
Created Feb 7, 2015
proxy drops custom header with https
View gist:2869d85b2e8affdc5a8c
$ curl -I -x 127.0.0.1:5566 https://www.google.fr
HTTP/1.1 200 Connection established
Proxy-Agent: Privoxy/3.0.23
X-Servedby: 50001
HTTP/1.1 200 OK
Date: Sat, 07 Feb 2015 16:29:25 GMT
Expires: -1
Cache-Control: private, max-age=0
Content-Type: text/html; charset=ISO-8859-1
View gist:db113605c9f8af37a020
upstream puma {
server unix:///srv/www/githubawards/shared/tmp/sockets/puma.sock;
}
server {
listen 80 default_server deferred;
# server_name example.com;
root /srv/www/githubawards/current/public;
access_log /srv/www/githubawards/shared/log/nginx.access.log;
@vdaubry
vdaubry / gist:98733eb2bbfe3e64b350
Created Mar 31, 2015
Github api response for repositories of wesleytodd
View gist:98733eb2bbfe3e64b350
$ curl -i https://api.github.com/users/wesleytodd/repos
HTTP/1.1 200 OK
Server: GitHub.com
Date: Tue, 31 Mar 2015 12:13:14 GMT
Content-Type: application/json; charset=utf-8
Content-Length: 158992
Status: 200 OK
X-RateLimit-Limit: 60
X-RateLimit-Remaining: 59
X-RateLimit-Reset: 1427807594
@vdaubry
vdaubry / base_controller.rb
Last active Sep 18, 2015
Sample token authentication
View base_controller.rb
class Api::V1::BaseController < ActionController::Base
before_filter :allow_cors
def allow_cors
headers["Access-Control-Allow-Origin"] = "*"
headers["Access-Control-Allow-Methods"] = %w{GET POST PUT DELETE}.join(",")
headers["Access-Control-Allow-Headers"] = %w{Origin Accept Content-Type X-Requested-With X-CSRF-Token X-API-Auth-Token}.join(",")
end
def options
@vdaubry
vdaubry / user.json
Last active Jan 1, 2016
sample user show response
View user.json
{
"user": {
"id": 15638312,
"login": "vdaubry",
"gravatar_url": "https://avatars.githubusercontent.com/u/498298?v=3",
"city": "paris",
"country": "france",
"rankings": [{
"language": "ruby",
"repository_count": 28,
@vdaubry
vdaubry / default.rb
Created Jan 22, 2016
github-awards chef recipe
View default.rb
#
# Cookbook Name:: github-awards
# Recipe:: default
#
# Copyright 2016, YOUR_COMPANY_NAME
#
# All rights reserved - Do Not Redistribute
#
apt_repository "ruby" do
View gist:e863fec5dc52df6094edf78d5e7f0cba
capital = Money.from_amount("985.13464".to_f, "eu16")
price = Money.from_amount("707.5".to_f, "eu16")
size = Money.from_amount(capital / price, "btc16")
(capital - price * size.to_f).format
=> "€0,0000000000000000"
capital = Money.from_amount("985.13464".to_f, "eu16")
price = Money.from_amount("707.5".to_f, "eu16")
size = Money.from_amount(capital / price, "btc16")
(capital - price * size.to_d).format
You can’t perform that action at this time.