Skip to content

Instantly share code, notes, and snippets.

View gicmo's full-sized avatar
💭
🧠

Christian Kellner gicmo

💭
🧠
View GitHub Profile
@gicmo
gicmo / jniUtil.cpp
Created February 26, 2016 23:52
javacpp generated code for nix-java's util
// Generated by JavaCPP version 1.1
#ifdef __APPLE__
#define _JAVASOFT_JNI_MD_H_
#define JNIEXPORT __attribute__((visibility("default")))
#define JNIIMPORT
#define JNICALL
@gicmo
gicmo / nix-dataframe.cpp
Created November 26, 2016 20:02
NIX DataFrame Proof of Concept
//NIX DataFrame test
#include <nix.hpp>
#include <cstdlib>
#include <cstring>
#include <iostream>
#include "backend/hdf5/h5x/H5DataType.hpp"
#include "backend/hdf5/h5x/H5Group.hpp"
#include "backend/hdf5/h5x/H5DataSet.hpp"
// gcc -I/usr/include -lfprint -o ftest fptest.c
// before: dnf install libinput-devel
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <libfprint/fprint.h>
static struct fp_dev *active;
@gicmo
gicmo / countex.py
Created February 17, 2017 16:48
Count file extensions recursivly
#!/usr/bin/env python
# Do What the Fuck You Want to Public License
# for Olli with love, for his birthday
from __future__ import print_function
import argparse
import os
import os.path
import sys
@gicmo
gicmo / ev.py
Created February 24, 2017 16:09
#!/usr/bin/env python
from evdev import InputDevice, categorize, ecodes, list_devices
import argparse
def main():
parser = argparse.ArgumentParser(description="little evdev helper")
parser.add_argument("device", help='input device to open', default=None, nargs='?')
args = parser.parse_args()
@gicmo
gicmo / hidpu.py
Created May 17, 2017 15:59
Estimation for mutter HiDPI thresholds
#!/usr/bin/env python3
import sys
import numpy as np
def area(d, a, b):
return (a*b)/(a**2+b**2) * d**2
def dpi(d, res, ratio):
a, b = ratio
@gicmo
gicmo / hidpi_limits.py
Created May 20, 2017 08:46
Calculate the width, height limits for a given dpi threshold
#!/usr/bin/env python3
import sys
import numpy as np
def limit(ts, r):
return (r / ts) * 25.4
def ds(w, h):
return np.sqrt(w**2 + h**2) / 25.4
template<typename Container, typename E>
void replaceEntities(Container &container, const std::vector<E> &newEntities) {
auto cmp = [](const E &a, const E &b) { return a.name() < b.name(); };
std::vector<E> new_entities(newEntities);
ObjectType ot = nix::objectToType<E>::type;
ndsize_t current = container.entityCount(ot);
size_t old_count = nix::check::fits_in_size_t(current, "entityCount() failed; count > size_t.");
@gicmo
gicmo / monitor-info.c
Created June 20, 2017 13:02
monitor info via gtk api
/* -*- mode: C; c-file-style: "stroustrup"; indent-tabs-mode: nil; -*- */
#include <gdk/gdk.h>
#include <gtk/gtk.h>
#ifdef GDK_WINDOWING_WAYLAND
#include <gdk/gdkwayland.h>
#endif
#ifdef GDK_WINDOWING_X11
#include <gdk/gdkx.h>
@gicmo
gicmo / fallthrough.patch
Last active June 22, 2017 10:49
renderdoc fallthrough patch
commit a95e03f0be450bb30af5cf1cd968ca8191c2560d (HEAD -> master)
Author: Christian Kellner <[email protected]>
Date: Mon Jun 19 17:45:54 2017 +0200
Add fallthrough comments to fix gcc warnings
diff --git a/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx b/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx
index 4e290309..100c6f84 100644
--- a/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx
+++ b/qrenderdoc/3rdparty/scintilla/src/RESearch.cxx