Skip to content

Instantly share code, notes, and snippets.

View phsym's full-sized avatar

Pierre-Henri Symoneaux phsym

  • OVHcloud
  • Brest, France
  • X @phsym
View GitHub Profile
@phsym
phsym / cc-graphql.rb
Created March 28, 2018 14:12
Coding-Corner 28-03-2018 : Introduction to GraphQL
require 'graphql'
require 'json'
require 'sinatra'
books = [
{id: 0, title: "A year at the wall", year: 2018, author: 0, themes:["mountains", "swords", "walkers"]},
{id: 1, title: "From basterd to king of the north", year: 2017, author: 0, themes: ["war", "king"]},
{id: 2, title: "Me and my dragons", year: 2017, author: 1, themes: ["dragons"]},
{id: 3, title: "I drink and I know things", year: 2017, author: 3, themes: ["rhum", "wine"]},
{id: 4, title: "How to get hated by the whole world", year: 2015, author: 4, themes: ["war", "king"]}
@phsym
phsym / travis-wine-rust.yml
Created January 13, 2016 14:57
Travis file for running rustc & cargo for windows in a wine container
before_script:
- sudo add-apt-repository ppa:ubuntu-wine/ppa -y
- sudo apt-get update -qq
- sudo apt-get install wine1.6 xvfb
- sudo Xvfb :1 &
- export DISPLAY=":1.0"
- export WINEDEBUG="fixme-all"
- wine --version
script:
@phsym
phsym / publish_doc.sh
Last active June 5, 2017 18:36
Publish cargo doc from travis-ci job
#!/bin/sh
CRATE_NAME="$1"
MASTER_DOC_ONLY="$2"
PUBLISH_CRATE="no"
PUBLISH_DOC="no"
if [ -z "$CRATE_NAME" ]; then
echo "Please provide crate name as first argument"
exit 1
fi
@phsym
phsym / TabPrinter.java
Created June 1, 2015 15:03
A simple quick and dirty tab printer written in java
import java.io.IOException;
import java.util.Vector;
/**
* Utility class to print pretty tables in a console
*/
public class TabPrinter {
private int num_col = 0;
private String[] titles = null;
@phsym
phsym / VipQueue.java
Created December 4, 2014 14:44
A 2 level priority queue (Normal and VIP priority), like in night clubs. Any VIP element will be queued with other VIP element, and will be picked up in priority
import java.util.Random;
import java.util.concurrent.Semaphore;
/**
* A 2 level priority queue (Normal and VIP priority).
* Any VIP element will be queued with other VIP element, and will
* be available in priority. Picking an element can be blocking if needed.
* @author Pierre-Henri Symoneaux
*
* @param <E> Type of the objects to store
@phsym
phsym / hashtable.c
Last active February 21, 2024 12:57
An hashtable implementation in C
/*
* Author : Pierre-Henri Symoneaux
*/
#include <stdlib.h>
#include <string.h>
//Hashtable element structure
typedef struct hash_elem_t {
struct hash_elem_t* next; // Next element in case of a collision