Skip to content

Instantly share code, notes, and snippets.

View mre's full-sized avatar
🪴
I like plants.

Matthias Endler mre

🪴
I like plants.
View GitHub Profile
@mre
mre / llvm_clang_eclipse.md
Last active February 28, 2020 08:03
LLVM, clang and clang++ under Eclipse

How to setup llvm and clang for eclipse

This guide is many years old is most likely outdated. I'll keep it here for reference; use at your own risk.

Tested on Mac OSX 10.6.7 with LLVM and CLANG version 2.9 Eclipse Helios Service Release 1 (Build 20100917-0705)

1) Installing LLVM and clang

@mre
mre / prot.py
Last active September 25, 2015 22:57
Prototype of a functional scripting language.
# Prototype of a functional scripting language. Just fooling around. Nothing to see here.
#
A long comment.
Very long, they say.
#
# There's only one data type: list
# Assign variables with :
@mre
mre / Apple Jobs Haiku
Created August 10, 2011 19:52
Some curiosity on Apples "Jobs" website (pun not intended).
This works:
http://jobs.apple.com/index.ajs?BID=1&method=mExternal.returnToResults&CurrentPage=143165577
This doesn't:
http://jobs.apple.com/index.ajs?BID=1&method=mExternal.returnToResults&CurrentPage=143165578
But why?
@mre
mre / closures_js
Created September 5, 2011 18:09
Closures in JavaScript
function getCtr() {
var i = 0; return function() { console.log(++i); }
}
var ctr = getCtr()
ctr() // 1
ctr() // 2
@mre
mre / bitonic_sort.cu
Last active March 17, 2024 15:47
Bitonic Sort on CUDA. On a quick benchmark it was 10x faster than the CPU version.
/*
* Parallel bitonic sort using CUDA.
* Compile with
* nvcc -arch=sm_11 bitonic_sort.cu
* Based on http://www.tools-of-computing.com/tc/CS/Sorts/bitonic_sort.htm
* License: BSD 3
*/
#include <stdlib.h>
#include <stdio.h>
@mre
mre / dropbox-gallery.php
Created January 12, 2012 17:25
Monkeypatch to get PHP my Dropbox Gallery running with the new Dropbox Gallery.
@mre
mre / radixsort.py
Created July 10, 2012 12:54
Radix Sort implementation in Python
from math import log10
from random import randint
def get_digit(number, base, pos):
return (number // base ** pos) % base
def prefix_sum(array):
for i in range(1, len(array)):
array[i] = array[i] + array[i-1]
return array
@mre
mre / gist:5064256
Created March 1, 2013 12:14
Unexpected error: 'ascii' codec can't decode byte 0xc3 (UnicodeDecodeError)
I got this message when I tried to open a shell on my application:
$ dotcloud run www
==> Opening a shell on service (www) instance #0 (application trips)
Error: An unexpected error has occured: 'ascii' codec can't decode byte 0xc3 in position 67: ordinal not in range(128).
The remote server handling the last request was 174.129.124.156:443.
The remote timestamp was Thu, 28 Feb 2013 15:06:19 GMT.
Please try again; and if the problem persists, contact support@dotcloud.com with this information.
Adding the following to /usr/local/lib/python2.7/site-packages/sitecustomize.py fixed the error:
@mre
mre / .vimrc
Created June 24, 2013 09:44
Mac Vim text to speech. Put this into your vimrc and hit <leader>v in visual selection mode to read the selected text. Great for proof reading. ;-)
" Mac specific: Text-to-speech on selected text in visual mode
" w: Don't replace selection with command output after execution
" silent: Don't prompt for enter after execution
:vnoremap <leader>v :w<Home>silent <End> !say <CR>
@mre
mre / l33tspeak
Created January 23, 2014 00:05
Leetspeak is the ultimate weapon of every hacker. Join the force, yeah!
#!/usr/bin/python
"""
Usage from commandline:
python l33t.py "Can i haz cheezburgerz"
"""
from string import maketrans # Required to call maketrans function.
from sys import argv