Skip to content

Instantly share code, notes, and snippets.

use ocl::ProQue;
pub fn main() -> ocl::Result<()> {
let kernel_src = r#"
float uniform (__global unsigned int* seed)
{
*seed = ((*seed) * 16807 ) % 2147483647;
return (float)(*seed) * 4.6566129e-10;
}

Keybase proof

I hereby claim:

  • I am michaelmelanson on github.
  • I am michaelmelanson (https://keybase.io/michaelmelanson) on keybase.
  • I have a public key whose fingerprint is CB15 E5FE 90A6 FA10 AF91 7054 774B 5480 A228 3F0D

To claim this, I am signing this object:

@michaelmelanson
michaelmelanson / population.cc
Created June 18, 2012 22:23
Canada population projections
#include <list>
#include <iostream>
#include <boost/random/linear_congruential.hpp>
#include <boost/random/variate_generator.hpp>
#include <boost/generator_iterator.hpp>
#include <boost/random/uniform_real.hpp>
using namespace std;
#define MALE 0
{"results":[
{"from_user_id_str":"94940014",
"profile_image_url":"http://a0.twimg.com/profile_images/1166351075/Joker_by_el_grimlock_normal.jpg",
"created_at":"Tue, 18 Jan 2011 13:33:52 +0000",
"from_user":"sunnychahal",
"id_str":"27358008371585024",
"metadata":{"result_type":"recent"},
"to_user_id":1694060,
"text":"@nikhilpai It's not the delay I have a problem with but the quality. The apps aren't half as gkod as iOS versions.",
"id":27358008371585024,
@michaelmelanson
michaelmelanson / template.rb
Created February 18, 2010 05:20
Based on "sethbc.rb"
# Link to local copy of edge rails
inside('vendor') { run 'ln -s ~/Development/rails/rails rails' }
# Delete unnecessary files
run "rm README"
run "rm doc/README_FOR_APP"
run "rm public/index.html"
run "rm public/favicon.ico"
run "rm public/robots.txt"
from scipy.stats.distributions import binom
data = [
{'name': 'ISTJ', 'count': 12, 'expected': 0.1160},
{'name': 'ISFJ', 'count': 4, 'expected': 0.1380},
{'name': 'INFJ', 'count': 14, 'expected': 0.0150},
{'name': 'INTJ', 'count': 206, 'expected': 0.0210},
{'name': 'ISTP', 'count': 16, 'expected': 0.0540},
{'name': 'ISFP', 'count': 1, 'expected': 0.0880},
{'name': 'INFP', 'count': 56, 'expected': 0.0430},
@michaelmelanson
michaelmelanson / rmdir_r.c
Created September 10, 2009 10:16
Recursively deletes a directory and all its contents, like "rmdir -Rf" on the command line
/*
* Recursively deletes a directory, like "rm -Rf" on the command-line.
*
* Returns 0 on success. On error, returns -1 and sets errno.
*/
int rmdir_r(const char *dirname)
{
struct dirent **namelist;
int n = scandir(dirname, &namelist, 0, alphasort);
-- Stochatistic Gradient Descent in Haskell
--
-- Based on Mark Reid's implementation in Clojure:
--
-- http://github.com/mreid/injuce
--
--
-- Profiling
-- ---------
--
@michaelmelanson
michaelmelanson / FindEvent.cmake
Created May 14, 2009 20:55
CMake packages for libevent, Net-SNMP, and others.
# Find Libevent
# http://monkey.org/~provos/libevent/
#
# Once done, this will define:
#
# Event_FOUND - system has Event
# Event_INCLUDE_DIRS - the Event include directories
# Event_LIBRARIES - link these to use Event
#
def editable_content_tag(elemtype, obj, prop, editable=true, options = {}, editOptions = {}, ajaxOptions = {})
objname = obj.class.to_s.downcase
options[:url] = url_for(obj) unless options.has_key? :url
options[:url] += '.json'
options[:id] = dom_id(obj)+"_#{prop}" unless options.has_key? :id
ajaxOptions[:method] = 'put'
edops = jsonify editOptions
ajops = jsonify ajaxOptions
contents = obj.send(prop)