Skip to content

Instantly share code, notes, and snippets.

//this simple file show you how to read the XSettings properties (http://standards.freedesktop.org/xsettings-spec/xsettings-spec-0.5.html)
package main
import "fmt"
import "github.com/BurntSushi/xgb/xproto"
import "github.com/BurntSushi/xgb"
import "encoding/binary"
import "io"
import "bytes"
package main
import (
"flag"
"fmt"
"io/ioutil"
"os"
"path"
"strings"
"time"
@Happy-Ferret
Happy-Ferret / README
Created September 17, 2018 15:19 — forked from bert/README
Draw in a GdkPixbuf with Cairo
A relatively simple application that demonstrates some advanced usage of GdkPixbuf and cairo.
Two most interesting functions are documented inside sources.
@Happy-Ferret
Happy-Ferret / pulseaudio.py
Created September 14, 2018 09:46 — forked from bastibe/pulseaudio.py
A minimal CFFI interface to pulseaudio (pulse-simple)
import numpy
from cffi import FFI
ffi = FFI()
ffi.cdef("""
typedef enum pa_stream_direction {
PA_STREAM_NODIRECTION,
PA_STREAM_PLAYBACK,
PA_STREAM_RECORD,
PA_STREAM_UPLOAD
@Happy-Ferret
Happy-Ferret / xcb-no-decoration.cpp
Created August 27, 2018 13:35 — forked from andr1972/xcb-no-decoration.cpp
XCB library - show window without decoration
//http://stackoverflow.com/questions/5134297/xlib-how-does-this-removing-window-decoration-work
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <iostream>
#include <inttypes.h>
#include <xcb/xcb.h>
#include <xcb/xproto.h>
//xcb_event.h
@Happy-Ferret
Happy-Ferret / index.html
Created August 6, 2018 11:57 — forked from neave/index.html
Wobbly Surface with canvas
<!DOCTYPE html>
<html>
<head>
<style> body { margin: 0; } </style>
</head>
<body>
<canvas id="wobble"></canvas>
<script src="http://cdnjs.cloudflare.com/ajax/libs/dat-gui/0.5/dat.gui.min.js"></script>
<script src="wobble.js"></script>
</body>

The numbers claimed by this benchamark about Gevent [1] comparaed with the numbers got by Asyncio with the uvloop and even with the default loop has left me a bit frozen. Ive repeated a few of them : gevent, asyncio, asyncio-uvloop and go for the echo server and these are the numbers roughly:

For gevent

$ ./echo_client
685393 0.98KiB messages in 30 seconds
Latency: min 0.04ms; max 4.48ms; mean 0.126ms; std: 0.048ms (37.68%)
Latency distribution: 25% under 0.088ms; 50% under 0.122ms; 75% under 0.158ms; 90% under 0.182ms; 99% under 0.242ms; 99.99% under 0.91ms
@Happy-Ferret
Happy-Ferret / ximage2opencvimage.cpp
Created July 26, 2018 13:47 — forked from DaHoC/ximage2opencvimage.cpp
Example program showing conversion of an image in the X11 XImage format to the openCV format IplImage (by demonstrating the XImage2OpenCVImage function below). The minimalistic program takes a screenshot of a specified area using XGetImage(...), converts the resulting XImage to IplImage and shows the resulting openCV image until the user presses…
/**
* Example program showing conversion of an image in the X11 XImage format to the openCV format IplImage
* (by demonstrating the XImage2OpenCVImage function below)
* The minimalistic program takes a screenshot of a specified area using XGetImage(...),
* converts the resulting XImage to IplImage and shows the resulting openCV image until the user presses a key.
*
* Compile with opencv linker flags (`pkg-config --libs opencv`) e.g.
* $ g++ ximage2opencvimage.cpp -L `pkg-config --libs opencv` -o ximage2opencvimage && ./ximage2opencvimage
*
* @File: ximage2opencvimage.cpp
@Happy-Ferret
Happy-Ferret / jwm-image-lite.c
Created July 26, 2018 13:47 — forked from technosaurus/jwm-image-lite.c
use lighter image loaders for jpg,png and svg + support gif,bmp,tga and others
/**
* @file image.c
* @author Joe Wingbermuehle
* @date 2005-2007
*
* @brief Functions to load images.
*
*/
#include "jwm.h"
@Happy-Ferret
Happy-Ferret / x11_screen_grab.cpp
Created July 25, 2018 12:43 — forked from richard-to/x11_screen_grab.cpp
X11 Example code for grabbing screenshots of window and sending key events
#include <iostream>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <opencv2/imgproc/imgproc.hpp>
#include <opencv2/highgui/highgui.hpp>
#include <X11/Xlib.h>