Skip to content

Instantly share code, notes, and snippets.

thefloweringash / ruby-test.rb
Last active Aug 29, 2015
What does this do? What is the expected output?
View ruby-test.rb
#!/usr/bin/env ruby
at_exit { raise }
if pid = fork {}
thefloweringash /
Last active Aug 29, 2015
package.el dependency test

Test case for package.el's dependency resolution. The two test cases are, with dependencies flowing left to right:

     / \            X---Z
    A   D--E         \ /
     \ /              Y
thefloweringash / gist:1442127
Created Dec 7, 2011
Noppoo HID descriptors, original and modified with MacOS support.
View gist:1442127
#include <stdio.h>
#include <stdint.h>
#include "HIDReportData.h"
const uint8_t standard_descriptor_primary[] = {
HID_RI_USAGE(8, 0x06),
View gist:1921139
#include <string.h>
template <typename T> struct lift {
typedef T t;
template <typename T> struct ptr {
typedef typename lift<T>::t* t;
template <typename T> struct lift<ptr<T> > {
thefloweringash / hid_report_dumper.c
Created May 12, 2012
HID report dumper for MacOS
View hid_report_dumper.c
#include <curses.h>
#include <CoreFoundation/CoreFoundation.h>
#include <IOKit/hid/IOHIDManager.h>
#include <IOKit/hid/IOHIDKeys.h>
struct keyboard_handler {
uint8_t hid_report_buffer[1024];
int index;
thefloweringash / gist:2987134
Created Jun 25, 2012
C++11 Variadic Template Pattern Matching
View gist:2987134
#include <iostream>
using namespace std;
template <typename... T>
struct pp {};
template <typename T, typename TI,
typename U, typename UI>
struct matcher;
thefloweringash / gist:2988405
Created Jun 25, 2012
Winning at templates?
View gist:2988405
#include <iostream>
using namespace std;
template <typename... T>
struct pp {};
template <typename T, typename TI,
typename U, typename UI,
typename F>
thefloweringash / lists.cpp
Created Aug 14, 2012
Not sure if winning: variadic templates as lists
View lists.cpp
// Template Wrangling
// ==================
// convert a template into something that can be ::apply-ed
template <template <typename...> class T>
struct make_apply {
template <typename... Args>
using apply = T<Args...>;
thefloweringash / ctags.patch
Created Nov 4, 2012
ctags: Fix invalid use of 'const' resulting in garbage filenames
View ctags.patch
diff -ur a/ctags-5.8/read.c b/ctags-5.8/read.c
--- a/ctags-5.8/read.c 2009-07-04 17:29:02.000000000 +1200
+++ b/ctags-5.8/read.c 2012-11-04 16:19:27.000000000 +1300
@@ -18,7 +18,6 @@
#include <string.h>
#include <ctype.h>
-#define FILE_WRITE
#include "read.h"
#include "debug.h"
thefloweringash / indent-to-test.el
Last active Dec 10, 2015
Testing indent-to with indent-tabs-mode
View indent-to-test.el
(require 'cl)
(whitespace-mode t)
(setq indent-tabs-mode t
tab-width 4)
(defun indent-to-test--run (start end)
(interactive "r")
(flet ((undo-boundary () nil))