Skip to content

Instantly share code, notes, and snippets.

View alexis779's full-sized avatar

Alexis de Tréglodé alexis779

View GitHub Profile
@alexis779
alexis779 / read_kqueue.c
Created October 17, 2018 06:12
Read file on macosx using kqueue
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <sys/event.h>
#include <fcntl.h>
#include <err.h>
@alexis779
alexis779 / gist:b2eae94b3a90f9758e58499dbfeebf2f
Created October 12, 2018 03:50
#5287 Thread dump on sysread stuck process
"main@1" prio=5 tid=0x1 nid=NA runnable
java.lang.Thread.State: RUNNABLE
at com.kenai.jffi.Foreign.invokeL6(Foreign.java:-1)
at com.kenai.jffi.Invoker.invokeL6(Invoker.java:455)
at jnr.enxio.channels.Native$LibC$jnr$ffi$2.kevent(Unknown Source:-1)
at jnr.enxio.channels.KQSelector.poll(KQSelector.java:168)
at jnr.enxio.channels.KQSelector.select(KQSelector.java:148)
at org.jruby.RubyThread.select(RubyThread.java:1883)
- locked <0x1886> (a java.lang.Object)
at org.jruby.RubyThread.select(RubyThread.java:1804)
@alexis779
alexis779 / ANTLR.java
Created August 12, 2017 20:36
Parser Benchmark
public void antlr() {
long start = System.currentTimeMillis();
CharStream charStream = CharStreams.fromString(input);
Lexer lexer = new SameOccurrenceLexer(charStream);
CommonTokenStream stream = new CommonTokenStream(lexer);
SameOccurrenceParser parser = new SameOccurrenceParser(stream);
parser.addParseListener(new SameOccurrenceParseListener());
parser.getInterpreter().setPredictionMode(PredictionMode.LL);
parser.r();
@alexis779
alexis779 / Instacart.py
Last active July 28, 2017 16:07
R vs Python versions of fabienvs solution
import pandas as pd
import numpy as np
import xgboost as xgb
import matplotlib.pyplot as plt
class Instacart:
def __init__(self):
pd.set_option("display.width", 1000)
def file_path(self, file_name):
@alexis779
alexis779 / ESprocess
Created January 4, 2012 15:13
0.17.8 ElasticSearch java command
/usr/bin/java
-Xms256m
-Xmx3500m
-Xss128k
-XX:+UseParNewGC
-XX:+UseConcMarkSweepGC
-XX:+CMSParallelRemarkEnabled
-XX:SurvivorRatio=8
-XX:MaxTenuringThreshold=1