Skip to content

Instantly share code, notes, and snippets.

Florent Clairambault fclairamb

Block or report user

Report or block fclairamb

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View keybase.md

Keybase proof

I hereby claim:

  • I am fclairamb on github.
  • I am fclairamb (https://keybase.io/fclairamb) on keybase.
  • I have a public key ASA3MsMSqP-rEvGEE4ps2nlLlSwZ_j2_TNiGGbJPUw8pIAo

To claim this, I am signing this object:

@fclairamb
fclairamb / gin_gokit_logger.go
Last active Dec 30, 2017
GIN Logger with go-kit/log
View gin_gokit_logger.go
package ginlogger
// Directly inspired from the default gin.Logger
// This is to be used like this:
// r := gin.New()
// r.Use(gin.Recovery())
// r.Use(ginlogger.LoggerWithGoKit(mylogger))
import (
@fclairamb
fclairamb / rapidjson_gen_json.cpp
Created Jan 5, 2016
Write some JSON using a rapidjson library
View rapidjson_gen_json.cpp
#ifdef SHELL
g++ -Wall -Werror -g -I../../cclib/rapidjson/include $0 && ./a.out
exit 0
#endif
// Output is:
// {"project":"rapidjson","stars":11}
// {"Name":"XYZ","Rollnumer":2,"array":["hello","world"],"Marks":{"Math":"50","Science":"70","English":"50","Social Science":"70"}}
// {"FromEmail":"sender@gmail.com","FromName":"Sender's name","Subject":"My subject","Recipients":[{"Email":"recipient@gmail.com"}],"Text-part":"this is my text"}
@fclairamb
fclairamb / svn_changes_notifications.sh
Created Oct 9, 2015
Jenkins SVN changes notifications (when your sysadmins don't want to add a post-commit hook to the SVN repository)
View svn_changes_notifications.sh
[ -f /usr/bin/svn ] || sudo apt-get install subversion -y
[ -f /usr/bin/mail ] || sudo apt-get install mailutils -y
[ -f /usr/bin/pip ] || sudo apt-get install python-pip -y
sudo pip install pygments >/dev/null
SVN_NEW=$SVN_REVISION_1
SVN_OLD=$(cat svn_old ||:)
echo $SVN_NEW >svn_old
svn log $SVN_URL -r $(expr $SVN_OLD + 1 ):$SVN_NEW >logs.txt
svn diff $SVN_URL -r $SVN_OLD:$SVN_NEW >diff.txt
cat diff.txt | pygmentize -l diff -f html -O noclasses,nobackground -o diff.html
@fclairamb
fclairamb / stack_trace.c
Last active Aug 29, 2015 — forked from banthar/stack_trace.c
stacktrace with libunwind and elfutils
View stack_trace.c
// stack_trace.c
//
// gcc stack_trace.c -ldw -lunwind -g -o stack_trace
#define UNW_LOCAL_ONLY
#include <elfutils/libdwfl.h>
#include <libunwind.h>
#include <stdio.h>
@fclairamb
fclairamb / permutation.c
Last active Aug 29, 2015
string permutation
View permutation.c
#ifdef SHELL
gcc -ansi -g $0 && ./a.out
exit 0
#endif
#include <stdio.h>
#include <string.h>
void permutation (char * prefix, char * str) {
int n = strlen(str);
@fclairamb
fclairamb / var_sized.c
Last active Aug 29, 2015
variable size object
View var_sized.c
#ifdef SHELL
gcc -std=c99 -Wall -Werror $0 && ./a.out
exit $?
#endif
#include <stdio.h>
/*
Output:
@fclairamb
fclairamb / tab.c
Created Dec 12, 2014
Multi-dimentionnal C array address
View tab.c
#ifdef SHELL
gcc -Wall -Werror $0 && ./a.out
exit $?
#endif
/*
Output:
Table : 0x7fff03ab7490
Row 0 : 0x7fff03ab7490
Cell 0:0 : 0x7fff03ab7490
@fclairamb
fclairamb / change_oom_score.c
Last active Aug 29, 2015
Change OOM priority score
View change_oom_score.c
#ifdef SHELL
gcc -Wall -Werror $0 && ./a.out
exit $?
#endif
#include <stdio.h>
void change_oom_score(int oom_adj) {
FILE * fp = fopen("/proc/self/oom_adj", "w"); // Old one (SK20)
if ( ! fp ) fp = fopen("/proc/self/oom_score_adj", "w"); // New one
@fclairamb
fclairamb / get_ppid_and_name.c
Created Oct 6, 2014
posix: Get parent process id and name
View get_ppid_and_name.c
#ifdef SHELL
gcc -Wall -Werror $0 && ./a.out
exit $?
#endif
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
You can’t perform that action at this time.