Skip to content

Instantly share code, notes, and snippets.

View rened's full-sized avatar

Rene Donner rened

View GitHub Profile
mkdir -p ~/julia
curl -s -L https://julialang.s3.amazonaws.com/bin/linux/x64/0.4/julia-0.4.6-linux-x86_64.tar.gz | \
tar -C ~/julia -x -z --strip-components=1 -f -
echo "export PATH=$PATH:$HOME/julia/bin" >> ~/.profile
source ~/.profile
f(a) = a + 1
g(a,f) = f(a) + 10
g(1,f)
@code_llvm f(1)
@code_llvm g(1,f)
#!/bin/bash
# This script installs nix from source into the current working directory.
set -e
export TARGET=$(pwd)
export BUILDTMP=/tmp/install-nix-here
export BUILDTMPESC=$(echo $BUILDTMP | sed -e's/\//\\\//g')
if [ "$(ls -A $TARGET)" ]; then
@rened
rened / gist:eb1462258cb3210060ed
Created May 9, 2015 21:16
"incorrect checksum for freed object"
julia> versioninfo()
Julia Version 0.3.8
Commit 79599ad* (2015-04-30 23:40 UTC)
Platform Info:
System: Darwin (x86_64-apple-darwin13.4.0)
CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
WORD_SIZE: 64
BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
LAPACK: libopenblas
error: a ‘x86_64-linux’ is required to build ‘/nix/store/h7s2kgq77gw3bv8pr8pac87kvr6r5ab0-users-groups.json.drv’, but I am a ‘x86_64-darwin’
error: unable to build all machine configurations
@rened
rened / gist:6d4792e9be71fceb0cdf
Created October 26, 2014 10:14
nixops error on OS X 10.10
fetching path ‘/nix/store/s1sk7p2q27ijdz38la67pl860gf7f8s5-perl-DBD-SQLite-1.42’...
*** Downloading ‘http://cache.nixos.org/nar/17y01zvjacxc25cd5sanf7f586qjnanpzjzz9d7pb4i6phj45khh.nar.xz’ to ‘/nix/store/s1sk7p2q27ijdz38la67pl860gf7f8s5-perl-DBD-SQLite-1.42’...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 89808 100 89808 0 0 211k 0 --:--:-- --:--:-- --:--:-- 212k
building path(s) ‘/nix/store/bz5bngwd1sxwxcc1cqdhzgmfsx3z4xd6-stage-2-init.sh’
error: a ‘x86_64-linux’ is required to build ‘/nix/store/h9rfm77y2z52xj3vp80b1cnhp91d9smx-stage-2-init.sh.drv’, but I am a ‘x86_64-darwin’
error: unable to build all machine configurations
# rmprocs()
# [Pkg.rm(x[1]) for x in Pkg.installed()]
# Pkg.update()
# # [Pkg.add(x) for x in {"JSON","HDF5","Nettle"}]
# for x in Pkg.available()
# try
# Pkg.add(x)
# catch e
# dump(e)
# end
@rened
rened / osxblocksizetest.c
Created April 9, 2014 17:28
Check max size of OSX's read()/write()
#include <stdlib.h>
#include <stdio.h>
#include <fcntl.h>
#include <sys/stat.h>
#include <errno.h>
void main() {
char filename[] = "/tmp/out.txt";
int fd = open(filename, O_RDWR | O_CREAT | O_TRUNC | O_APPEND, S_IXUSR | S_IWUSR | S_IRUSR);
printf("fd: %d errno: %d\n", fd, errno);
@rened
rened / valgrind.out
Created January 17, 2014 12:16
Valgrind output of test case resulting in memory corruption / segfault
==6481== Memcheck, a memory error detector
==6481== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==6481== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==6481== Command: julia -e using\ WebApp;\ WebApp.demo()
==6481== Parent PID: 22678
==6481==
--6481--
--6481-- Valgrind options:
--6481-- --track-origins=yes
--6481-- -v
rene@lemonlab:lib $ ls -la
total 152
drwxr-xr-x 22 rene staff 748 Sep 20 23:01 .
drwxr-xr-x 14 rene staff 476 Sep 20 23:00 ..
lrwxr-xr-x 1 rene staff 54 Sep 20 23:01 libgnutls-openssl.27.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls-openssl.27.dylib
lrwxr-xr-x 1 rene staff 51 Sep 20 23:01 libgnutls-openssl.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls-openssl.dylib
lrwxr-xr-x 1 rene staff 50 Sep 20 23:01 libgnutls-xssl.0.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls-xssl.0.dylib
lrwxr-xr-x 1 rene staff 48 Sep 20 23:01 libgnutls-xssl.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls-xssl.dylib
lrwxr-xr-x 1 rene staff 46 Sep 20 23:01 libgnutls.28.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls.28.dylib
lrwxr-xr-x 1 rene staff 43 Sep 20 23:01 libgnutls.dylib -> ../Cellar/gnutls/3.1.10/lib/libgnutls.dylib