Skip to content

Instantly share code, notes, and snippets.

View cbliard's full-sized avatar

Christophe Bliard cbliard

  • OpenProject
  • Besançon, France
View GitHub Profile
@cbliard
cbliard / keybase.md
Created August 19, 2020 14:17
keybase.md

Keybase proof

I hereby claim:

  • I am cbliard on github.
  • I am cbliard (https://keybase.io/cbliard) on keybase.
  • I have a public key ASCdMBCKni_k6tH61HSuEb3chkgXX-7GeBpT4GQ8mBzhrQo

To claim this, I am signing this object:

@cbliard
cbliard / prompt.sh
Created February 16, 2015 16:29
Prompt with more information
# prompt with more informations when set -x
export PS4='+$(/bin/date +"%Y/%m/%d-%T%z"):[$(which $(sed -n -r "${LINENO}s/^[[:space:]]*([^[:space:]]+).*/\1/p" "${BASH_SOURCE}"))]:${BASH_SOURCE}:${LINENO}:${FUNCNAME}: '
@cbliard
cbliard / proxy_params
Last active August 29, 2015 14:10
Nginx reverse proxy
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header X-Forwarded-Proto $scheme;
@cbliard
cbliard / diff.md
Last active August 29, 2015 14:01
Diff two GC.stat values
# quick'n'dirty
def diff_gc(first_gc, second_gc)
  # add custom field
  [first_gc, second_gc].each { |gc| gc[:allocated] = gc[:total_allocated_object] - gc[:total_freed_object] }
  # get data
  first_gc.keys.map do |key|
    before = first_gc[key]
    after = second_gc[key]
 diff = after - before
@cbliard
cbliard / gist:f4256e65ee179ec59360
Last active August 29, 2015 14:01
Memory allocation trace
require 'allocation_stats
stats = AllocationStats.trace { Project.last.as_json };
puts stats.allocations(alias_paths: true).at_least(5).group_by(:sourcefile, :sourceline, :class_plus).sort_by_count.to_text
#
@cbliard
cbliard / statsd.init.sh
Created August 28, 2012 08:13 — forked from erickr/statsd.init.sh
Modified statsd.init.sh file to work on Debian with LSB functions
#!/bin/sh
#
# StatsD
#
# chkconfig: 3 50 50
# description: StatsD init.d
. /lib/lsb/init-functions
desc=statsd
STATSDDIR=/opt/statsd