Skip to content

Instantly share code, notes, and snippets.

View evincarofautumn's full-sized avatar

Jon Purdy evincarofautumn

View GitHub Profile
@evincarofautumn
evincarofautumn / gist:7006675d11d400850e45
Created October 9, 2014 19:06
Installing GTK# on OS X 10.9.4
brew install pango
brew install atk
brew install gtk+
tar xvf gtk-sharp-2.12.10.tar.gz
cd gtk-sharp-2.12.10
# Set PKG_CONFIG_PATH so that cairo knows where to find xcb-shm.
# Set __GLIB_H_INSIDE__ to stop glib from preventing GTK# from including its headers other than glib.h.
# Alias _glibsharp_g_thread_supported to the missing _g_thread_supported.
./configure --prefix=/usr/local PKG_CONFIG_PATH=/opt/X11/lib/pkgconfig CFLAGS="-D__GLIB_H_INSIDE__" LDFLAGS="-Wl,-alias,_glibsharp_g_thread_supported,_g_thread_supported"
make -j4
#include <stdio.h>
#include <unistd.h>
int main() {
if (geteuid() == 0) {
puts("Okay.");
return 0;
}
puts("What? Make it yourself.");
return 1;
@evincarofautumn
evincarofautumn / shootout.ktn
Last active November 22, 2015 01:12
Thoughts on Kitten shootout benchmarks.
def ack (int, int -> int) {
-> m, n;
if (m = 0) {
n + 1
} elif (n = 0) {
(m - 1) 1 ack
} else {
(m - 1) m (n - 1) ack ack
}
}
@evincarofautumn
evincarofautumn / timestamp.pl
Created October 24, 2014 01:33
Watches the RSS of a process and gives you a list of timestamp–RSS pairs.
#!/usr/bin/env perl
use warnings;
use strict;
use POSIX 'strftime';
use Time::HiRes 'gettimeofday';
my $timestamp = gettimeofday;
printf "%.3f", $timestamp;
@evincarofautumn
evincarofautumn / git-branch-description.sh
Created October 29, 2014 18:18
Show git branch description
#!/bin/sh
if [ $# -ne 1 ]; then
echo 'Usage: git-branch-description <branch name>' >&2
exit 1
fi
EDITOR='cat' git branch --edit-description "$1" | grep -v '^#'
// Translation of https://gist.github.com/jeaye/ae36de6b677c4000ce67
data queue:
case queue ([<s...> (s... -> s...)])
define push<s...> (queue (s... -> s...) -> queue):
-> f;
match:
case queue:
f append queue
@evincarofautumn
evincarofautumn / monoid.cpp
Last active May 1, 2021 11:22
Monoids in C++
#include <iostream>
#include <numeric>
#include <vector>
using namespace std;
// In Haskell, the Monoid typeclass is parameterised by only a type. Such a
// definition requires “newtype hacks” to produce different monoids on the same
// type. This definition is parameterised by both the type and the function, and
// as such can be used to define different monoids on the same type without any
// interference.
@evincarofautumn
evincarofautumn / main.c
Created December 5, 2014 22:15
Clang Optimisation Bug
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
int sum(int a, int b, int c, int d) {
return a + b + c + d;
}
int product(int a, int b, int c, int d) {
return a * b * c * d;
Git submodules updated successfully
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in po
Making all in mcs
make[3]: Nothing to be done for `all-am'.
Making all in libgc
Making all in m4
make[3]: Nothing to be done for `all'.
Making all in include
Making all in private
@evincarofautumn
evincarofautumn / gist:0917acd8d671e7ef9b9a
Created February 24, 2015 21:07
Diagnostic output for XamarinAndroid project in Mobile-App-Performance benchmark
Building: Shared (Debug)
Building: XamarinAndroid (Debug)
Build started 2/24/2015 1:06:44 PM.
__________________________________________________
Project "/Users/jonathanpurdy/Projects/Mobile-App-Performance/Xamarin/XamarinAndroid/XamarinAndroid.csproj" (Build target(s)):
Initial Properties:
__CF_USER_TEXT_ENCODING = 0x1F5:0:0