Skip to content

Instantly share code, notes, and snippets.

View t-8ch's full-sized avatar

Thomas Weißschuh t-8ch

View GitHub Profile
@t-8ch
t-8ch / Makefile
Created January 31, 2018 22:10
minimal mutter application with window management
CFLAGS=$(shell pkg-config --cflags libmutter-1) -Wl,-rpath,/usr/lib/mutter
LDLIBS=$(shell pkg-config --libs libmutter-1)
all: main
@t-8ch
t-8ch / __main__.py
Created May 28, 2015 21:22
Poor mans crossplatform curl (intended to be used as `python -m requests`)
from __future__ import print_function
from contextlib import closing
from sys import argv, exit, stderr
from . import get
from .compat import urlparse
if len(argv) != 2:
exit('Usage: {0} URL'.format(argv[0]), file=stderr)
@t-8ch
t-8ch / test_ssl.py
Created February 24, 2015 14:19
triage kennethreitz/request#2455
import subprocess
import pytest
class Interpreter(object):
base = '/usr/bin/python'
def __init__(self, suffix):
self.suffix = suffix
@t-8ch
t-8ch / bad.html
Created December 5, 2014 23:45
HTML file triggering excessive resource consumption in pandoc
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="format-detection" content="telephone=no">
<style type="text/css">
<!--
.ReadMsgBody { width: 100%;}
@t-8ch
t-8ch / 1.py
Created May 10, 2014 13:00
surrogates in python
# Works with CPython, PyPy 2 (Py version 2)
# Blows up with PyPy 2 (Py version 3), Jython (Py version 2)
u"\uD800"
@t-8ch
t-8ch / requests_debuginfo.py
Last active August 29, 2015 14:01
Show debug info for python-requests
#!/usr/bin/env python
from __future__ import print_function
import pkg_resources
import platform
import requests
@t-8ch
t-8ch / main.c
Created September 6, 2013 20:02
ZFS and Rust (d39cec65b025ad4c6de50e778ffd1177279b5b3d)
// Works as expected... if one gets it to compile
#include <libzfs.h>
#include <stdio.h>
#include <stdlib.h>
int zp_iter(zpool_handle_t *z, void *a) {
printf("name:\t%s\n", zpool_get_name(z));
return 0;
}
@t-8ch
t-8ch / test_libsoup_msg.c
Last active December 14, 2015 03:18
Simple test for libsoup
/*
* file: test_libsoup_msg.c
* compile with:
* cc $(pkg-config --cflags --libs libsoup-2.4) test_libsoup_msg.c -o test_libsoup_msg
*/
#include <libsoup/soup.h>
#include <glib/gprintf.h>
int main(int argc, char** argv) {
@t-8ch
t-8ch / benchmark.c
Created June 13, 2012 19:42
poppler and cairo test programm
/*
* Warning:
* This thing is full of memory leaks
*
* filename: benchmark.c
* compile with: LDFLAGS=$(pkg-config --libs --cflags gtk+-3.0 poppler-glib) make benchmark
*/
#include <gtk/gtk.h>
#include <poppler/glib/poppler.h>