Skip to content

Instantly share code, notes, and snippets.

using Images
data = rand(10, 10)
image = Image(data)
immutable Point{T}
i::T
j::T
end
using Images
data = rand(10, 10)
image = Image(data)
immutable Point{T}
i::T
j::T
end
@maleadt
maleadt / Makefile
Created May 29, 2014 10:24
Unable to read from STDIN in ccall'ed DSO
MAKEFLAGS += --no-builtin-rules
CXX=g++
all: libinput.so demo
%.o: %.cpp
$(CXX) -fPIC -c -o $@ $<
lib%.so: %.o
$(CXX) -shared -o $@ $<
@maleadt
maleadt / interpolate.c++.ll
Created June 2, 2014 07:00
Interpolate kernel bitcode - Julia vs C++
define float @interpolate(%"class.Eigen::Matrix"* nocapture readonly %source, %"class.Eigen::Matrix.2"* nocapture readonly %p) #3 {
%x_int = alloca float, align 4
%y_int = alloca float, align 4
%1 = getelementptr inbounds %"class.Eigen::Matrix.2"* %p, i64 0, i32 0, i32 0, i32 0, i32 0, i64 0
%2 = load float* %1, align 4
%3 = call float @modff(float %2, float* %x_int) #2
%4 = getelementptr inbounds %"class.Eigen::Matrix.2"* %p, i64 0, i32 0, i32 0, i32 0, i32 0, i64 1
%5 = load float* %4, align 4
%6 = call float @modff(float %5, float* %y_int) #2
%7 = load float* %y_int, align 4
@maleadt
maleadt / Makefile
Created March 19, 2015 10:48
encfs mounting Makefile
SHELL := /bin/bash
ROOT_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
LOOPDEV=/dev/loop0
MOUNTPOINT=$(ROOT_DIR)/mount
PASSWORD=foobar
.PHONY: default
@maleadt
maleadt / gist:ee1ab7e3127672395ad2
Created March 27, 2015 12:16
LaTeX macro to obfuscate text as an image (to prevent selecting, parsing, ...)
\makeatletter
\newcount\@imagecount
\newcommand\showasimage[1]{%
\global\advance\@imagecount 1
\edef\x{image-\the\@imagecount}%
\immediate\write18{echo '\unexpanded{\font\1=}\fontname\font' > \x.tex}%
\immediate\write18{echo '\unexpanded{\1#1\nopagenumbers\bye}' >> \x.tex}%
\immediate\write18{pdftex \x.tex}%
\immediate\write18{pdf2ps -dNoOutputFonts \x.pdf \x.ps}
\immediate\write18{ps2pdf \x.ps \x.pdf}
# Maintainer: Zifei Tong <soariez@gmail.com>
# Contributor: Tim Besard
pkgname=dyninst
pkgver=8.2.1
pkgrel=1
pkgdesc="An API for run-time code generation"
url="http://www.dyninst.org"
arch=('x86_64' 'i686')
license=('LGPL')

Keybase proof

I hereby claim:

  • I am maleadt on github.
  • I am maleadt (https://keybase.io/maleadt) on keybase.
  • I have a public key whose fingerprint is 7550 6A80 7642 01B4 C9A3 AEEA 1CA4 3519 FA77 B3B5

To claim this, I am signing this object:

// At this point, there shouldn't be any external references in the module
llvm::SmallVector<const llvm::GlobalValue*, 2> ExternalReferences;
for (const auto& GV : M->getGlobalList())
if (GV.isDeclaration())
ExternalReferences.push_back(&GV);
for (const auto& F : M->getFunctionList())
if (F.isDeclaration() && !F.isIntrinsic())
ExternalReferences.push_back(&F);
for (const auto* V: ExternalReferences) {
JL_PRINTF(JL_STDERR, "Warning: detected use of external value '%s'\n",
@maleadt
maleadt / MobileVikingsN900.py
Created February 26, 2011 20:07
Mobile Vikings widget for Maemo, with a bit more native lookings.
# (c) 2011 Bart Coppens
# Licensed under GPLv3+
import gtk
import cairo
import hildon
import hildondesktop
import pycurl
import StringIO
import math