Skip to content

Instantly share code, notes, and snippets.

@richiejp
richiejp / fib.ll
Created September 2, 2013 21:03
Fibonachi sequence in LLVM IR
@resultmsg = internal constant [14 x i8] c"fib(%u) = %u\0A\00"
declare i32 @printf(i8 *, ...)
declare i32 @atoi(i8 *)
define fastcc i32 @fib (i32 %n) {
entry:
%leone = icmp sle i32 %n, 1
br i1 %leone, label %exitzero, label %checkiftwo
checkiftwo:
@richiejp
richiejp / pthreadproducer.c
Created January 10, 2012 18:45
pthread producer consumer example in wrote for my blog
/*pthread example.
Copyright (c) 2006-2007 Richard Palethorpe
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 furnished to do so, subject to the following
conditions:
@richiejp
richiejp / posixsignal.c
Created January 10, 2012 18:37
POSIX signal example I wrote for my blog
/*Really Simple POSIX Signal example.
Copyright (c) 2006-2007 Richard Palethorpe
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 furnished to do so, subject to the following
conditions:
@richiejp
richiejp / linuxsocket.c
Created January 10, 2012 18:18
POSIX/Linux socket example I wrote years ago for my blog
/*POSIX/Linux multithreaded socket test
Copyright (c) 2006-2007 Richard Palethorpe
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 furnished to do so, subject to the following
conditions:
@richiejp
richiejp / NHamlViewEngine.cs
Created January 10, 2012 12:36
NHaml adapter for Nancy framework hack
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Nancy;
using Nancy.ViewEngines;
using Nancy.Responses;
using NHaml4.Walkers.CodeDom;
using NHaml4.TemplateResolution;
using NHaml4.TemplateBase;