Skip to content

Instantly share code, notes, and snippets.

@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>
/*
The MIT License (MIT)
Copyright (c) 2014 Ismael Celis
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
@Happy-Ferret
Happy-Ferret / do to dot bin echo.sh
Created July 11, 2018 06:35 — forked from o-jasper/do to dot bin echo.sh
ln -s trick you can do with firejail, but with everything. In Python.
ln -s ~/.bin/lnstrick.py ~/.bin/echo
@Happy-Ferret
Happy-Ferret / ln_s_trick.py
Created July 11, 2018 06:35 — forked from o-jasper/ln_s_trick.py
Ln -s trick which am using. Could possibly use some features like supporting quotes, perhaps "patterns"
#!/bin/python
import sys
import subprocess
import os
import sys
from pathlib import Path
def figure_path_list():
got = os.getenv('LNS_TRICK_PATH')
// 1) Install Firebug
// 2) In a new browser window, open this URL:
// chrome://global/content/commonDialog.xul
// (It doesn't matter the particular .xul file you open, as long as it is a valid XUL file.)
// 3) Launch JavaScript Shell in Firebug
// 4) In the new shell window, type the following commands:
var wm = Components.classes["@mozilla.org/appshell/window-mediator;1"]
.getService(Components.interfaces.nsIWindowMediator);
@Happy-Ferret
Happy-Ferret / mojave.xml
Created June 28, 2018 07:46 — forked from trongthanh/mojave.xml
macOS Mojave dynamic background re-implement as GTK+ background slideshow. Background images are changed to reflect the time of the day.
<!-- Intruction:
- Download and unzip Mojave dynamic background here: https://files.rb.gd/mojave_dynamic.zip
- Fix the path to the background images
- Use gnome-tweaks tool to select this XML as wallpaper
-->
<background>
<starttime>
<year>2014</year>
<month>01</month>
<day>11</day>