Skip to content

Instantly share code, notes, and snippets.

Avatar
🤘

Chris Pahl sahib

🤘
View GitHub Profile
@sahib
sahib / Makefile
Last active Jul 5, 2019
cairo-pango-gles2 bug report (start reading surface.c -> main; the headers are from wayland weston and probably not relevant)
View Makefile
all:
gcc surface.c -o surface ${CFLAGS} ${LDFLAGS} $(shell pkg-config --libs --cflags cairo wayland-client wayland-server wayland-egl pango pangocairo) -lEGL -Wall -Wextra
View ipfsbug.go
package main
import (
"flag"
"fmt"
"golang.org/x/net/context"
"os"
"os/user"
"path/filepath"
View gx-trouble.go
package main
import (
A "github.com/jbenet/go-multihash"
B "gx/ipfs/QmYf7ng2hG5XBtJA3tN34DQ2GUN5HNksEw1rLDkmr6vGku/go-multihash"
)
func main() {
a := A.Multihash(nil)
b := B.Multihash(nil)
View moose_zeroconf.py
#!/usr/bin/env python
# encoding: utf-8
from gi.repository import Moose
from gi.repository import GLib
import sys
def zeroconf_state_changed(browser):
@sahib
sahib / get-n-fds.c
Created Feb 24, 2015
Find number of file descriptor per process (initially 3 usually)
View get-n-fds.c
int rm_fd_cache_get_fds_per_process(RmFdCache *self) {
g_assert(self);
int n = -1;
struct rlimit rl;
if(getrlimit(RLIMIT_NOFILE, &rl) == -1) {
return -1;
}
@sahib
sahib / app.css
Created Feb 9, 2015
Small & colorful indicator label for Gtk
View app.css
/* Support for colored labels.
* These are sometimes handy in order to highlight errors
* or mark some entries with "xx new items".
*/
#AppIndicatorLabelError,
#AppIndicatorLabelSuccess,
#AppIndicatorLabelWarning,
#AppIndicatorLabelTheme {
/* Animate changes so the label color gets faded in */
View list-disks.c
#include <gio/gunixmounts.h>
#include <glib.h>
/* Compile with:
gcc list-disks.c $(pkg-config --libs --cflags gio-unix-2.0) -std=c11 -ggdb3 -W -Wall
*/
int main(void) {
g_printerr("MOUNTS:\n");
View popover_menu.py
#!/usr/bin/env python
# encoding: utf-8
from gi.repository import Gtk, GLib, Gio
import sys
class MainWindow(Gtk.ApplicationWindow):
def __init__(self, app):
Gtk.Window.__init__(self, title="Welcome to Gylfeed", application=app)
@sahib
sahib / pre-commit
Last active Aug 29, 2015
Pre commit hook for rmlint - put in .git/hooks/pre-commit and chmod +x it.
View pre-commit
#!/bin/sh
#
# Shamelessly stolen from:
# http://www.es.ele.tue.nl/sdf3/manuals/development/files/pre-commit
# An example hook script to verify what is about to be committed.
# Called by "git commit" with no arguments. The hook should
# exit with non-zero status after issuing an appropriate message if
# it wants to stop the commit.
#
# To enable this hook, rename this file to "pre-commit".
@sahib
sahib / problem.rst
Last active Dec 27, 2015
I haz problemz.
View problem.rst

Folgendes Problem zu libmunin:

  • Ich hab eine Liste von Songs.
  • Um Aussagen über deren ähnlichkeit zu machen muss ich die untereinander vergleichen. Das ergibt für N Songs ((N - 1) ^ 2 / 2) Vergleiche. Für N=32k ne ganze Menge. (Abgeschätzte Zeit wären ca. 13h, also unakzeptabel.)