Skip to content

Instantly share code, notes, and snippets.

View gicmo's full-sized avatar
💭
🧠

Christian Kellner gicmo

💭
🧠
View GitHub Profile
@gicmo
gicmo / setup-pkgcfg.py
Last active August 29, 2015 14:04
Package config support for python
#!/usr/bin/env python
import commands
import sys
class PackageNotFoundError(StandardError):
pass
def pkg_config(*packages, **kw):
flag_map = {'-I': 'include_dirs', '-L': 'library_dirs', '-l': 'libraries'}
@gicmo
gicmo / threadpoo.cpp
Created July 22, 2014 22:21
Threadpool
// Created by Christian Kellner on 22/07/2014.
// Copyright (c) 2014 G-Node. All rights reserved.
//
#include <iostream>
#include <thread>
#include <vector>
#include <mutex>
#include <utility>
@gicmo
gicmo / Dockerfile
Created November 30, 2014 19:15
Dockerfile for ohmage 3.0 front-end
FROM buildpack-deps
# base on tomcat from docker
MAINTAINER Christian Kellner [email protected]
ENV DEBIAN_FRONTEND noninteractive
RUN apt-get update
RUN apt-get -y upgrade
@gicmo
gicmo / txt2rdf.py
Last active March 10, 2017 03:48
Textfile 2 RDF
#!/usr/bin/env python
# generate a list of files with: find `pwd` -type f | sed -e "s/\//file:\/\/`hostname`/" > list.txt
from __future__ import print_function
import argparse
from urlparse import urlparse
import rdflib
import sys
import mimetypes
@gicmo
gicmo / CMakeLists.txt
Created March 31, 2015 07:32
CMake for Qt5 projects with qcustomplot skeleton
cmake_minimum_required(VERSION 2.8.11)
project(testproject)
message($ENV{QT5_DIR})
if($ENV{QT5_DIR})
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "$ENV{QT5_DIR}/lib/cmake")
endif()
# Find includes in corresponding build directories
@gicmo
gicmo / fitsine.py
Created March 31, 2015 17:47
Fit a sine using least squares
#!/usr/bin/env python
import numpy as np
import scipy.optimize as optimize
import matplotlib.pylab as plt
import csv
import argparse
def main():
parser = argparse.ArgumentParser(description='iris - sine fitter')
@gicmo
gicmo / u8to32.cc
Created April 14, 2015 14:51
poor man's utf8 → utf32
ssize_t u8_nbytes(uint8_t bytes) {
std::bitset<8> bs(bytes);
size_t i;
for (i = 0; i < bs.size(); i++) {
if (bs[7 - i] == 0) {
break;
}
}
@gicmo
gicmo / parse_val.cc
Created September 13, 2015 21:38
POC to parse a value+uncertainty+unit string
#include <iostream>
#include <string>
#include <vector>
#include <cmath>
namespace odml2 {
ssize_t u8_nbytes(uint8_t bytes) {
std::bitset<8> bs(bytes);
@gicmo
gicmo / findboost.py
Last active August 26, 2016 19:36
Find boost python
#!/usr/bin/env python
# coding=utf-8
from __future__ import print_function
from __future__ import division
import os
import re
import sys
from collections import namedtuple
#include "nix.hpp"
#include <chrono>
#include <thread>
#include <nix/base/Entity.hpp>
/*
struct cleaner {
cleaner(const std::vector<std::reference_wrapper<nix::base::ImplContainer<nix::base::IEntity>>> &x) : e(x){ };