Skip to content

Instantly share code, notes, and snippets.

View gicmo's full-sized avatar
💭
🧠

Christian Kellner gicmo

💭
🧠
View GitHub Profile
@gicmo
gicmo / bolt.supp
Created January 8, 2018 14:46
Bolt valgrind suppression file
# from https://github.com/pwithnall/walbottle/blob/master/libwalbottle/tests/walbottle.supp
# by Philip Withnall <[email protected]>
{
gnutls-init-calloc
Memcheck:Leak
fun:calloc
...
fun:gtls_gnutls_init
}
@gicmo
gicmo / bolt.spec
Last active December 14, 2017 23:25
spec file for bolt
Name: bolt
Version: 0.1
Release: 1%{?dist}
Summary: Thunderbolt device manager
License: LGPLv2+
URL: https://github.com/gicmo/bolt
Source0: %{url}/archive/%{version}/%{name}-%{version}.tar.gz
Source1: https://raw.githubusercontent.com/gicmo/bolt/master/COPYING
BuildRequires: asciidoc
@gicmo
gicmo / signal.py
Created December 8, 2017 10:32
Simple signal class for python
#!/usr/bin/env python3
class Signal(object):
def __init__(self, name):
self.name = name
self.callbacks = set()
def connect(self, callback):
self.callbacks.add(callback)
@gicmo
gicmo / clang-format
Created August 28, 2017 22:48
Clang format
BasedOnStyle: LLVM
IndentWidth: 8
UseTab: Always
BreakBeforeBraces: Linux
AllowShortIfStatementsOnASingleLine: false
IndentCaseLabels: false
PointerAlignment: Right
ColumnLimit: 85
AlignOperands: true
AlignTrailingComments: true
@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
@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>
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 / 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
@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 / 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()