Skip to content

Instantly share code, notes, and snippets.

View mathieujobin's full-sized avatar

Mathieu Jobin mathieujobin

  • Tokyo, Japan
View GitHub Profile
@mathieujobin
mathieujobin / gist:b6354aceec41beded36e
Created July 7, 2014 17:34
ackerman with and without cache
mathieu@Miyauchi-QC-PC:/mnt/btr/homes/mathieu/projects/somekool/playgrounds/c$ make && time ./a.out
computing ack(0, 0);
result of ackerman(0, 0) => 1.
computing ack(0, 1);
result of ackerman(0, 1) => 2.
computing ack(0, 2);
result of ackerman(0, 2) => 3.
computing ack(0, 3);
result of ackerman(0, 3) => 4.
@mathieujobin
mathieujobin / gist:cea26c21d331763565ed
Created July 7, 2014 17:48
ackerman until (4, 19) with and without cache...

without cache, I CTRL-C after a minute... with cache, it finished up to 4, 19 in 0m0.013s

source code

/************ ACKERMAN **************/
#define enable_global_cache
#ifdef enable_global_cache
int **global_ack_cache;
$ ulimit -s
99999
$ time ./a.out
result of ackerman(0, 0) => 1.
result of ackerman(0, 1) => 2.
result of ackerman(0, 2) => 3.
result of ackerman(0, 3) => 4.
result of ackerman(0, 4) => 5.
Application: plasmashell (plasmashell), signal: Segmentation fault
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[Current thread is 1 (Thread 0x7f9519d55780 (LWP 4170))]
Thread 25 (Thread 0x7f9503d0f700 (LWP 4172)):
#0 0x00007f95124d4fbd in poll () at ../sysdeps/unix/syscall-template.S:81
#1 0x00007f9515e29b72 in ?? () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#2 0x00007f9515e2b64f in xcb_wait_for_event () from /usr/lib/x86_64-linux-gnu/libxcb.so.1
#3 0x00007f9505abbc89 in QXcbEventReader::run (this=0x15c1090) at qxcbconnection.cpp:1043
#4 0x00007f9512b5ce11 in QThreadPrivate::start (arg=0x15c1090) at thread/qthread_unix.cpp:345
@mathieujobin
mathieujobin / gist:5b96f906cfa9f4eb830a
Created September 24, 2014 15:25
Find popular lines in application code - to DRY it up afterward
bash$ grep -r . app lib | cut -d : -f 2- | sed 's/^[ \t]*//' | sort | uniq -c | sort -n
[user]
email = foo@bar.tv
name = First Last
[push]
default = simple
[core]
excludesfile = /home/foo/.gitignore_global
[help]
autocorrect = 5
@mathieujobin
mathieujobin / soprano compile output
Created November 8, 2011 18:30
problem with soprano
==> cmake . -DCMAKE_INSTALL_PREFIX='/usr/local/Cellar/soprano/2.7.3' -DCMAKE_BUILD_TYPE=None -Wno-dev -DSOPRANO_DISABLE_RAPTOR_PARSER=ON -DSOPRANO_DISABLE_RAPTOR_SERIALIZER=ON -DSOPRANO_DISABLE_REDLAND_BACK
==> make install
[ 0%] [ 1%] [ 1%] [ 2%] [ 3%] [ 3%] [ 4%] Generating asyncquery.moc
[ 5%] Generating model.moc
Generating pluginmanager.moc
Generating filtermodel.moc
Generating storagemodel.moc
Generating inferencemodel.moc
Generating nrlmodel.moc
Generating mutexmodel.moc
@mathieujobin
mathieujobin / kde-baseapps.rb
Created January 6, 2012 17:09
kde-baseapps.rb formula
require 'formula'
class KdeBaseapps < Formula
url 'ftp://ftp.kde.org/pub/kde/stable/4.7.4/src/kde-baseapps-4.7.4.tar.bz2'
homepage 'http://kde.org/'
md5 'd44310cad99a9afb757ff13f24eeae32'
depends_on 'cmake' => :build
depends_on 'automoc4' => :build
@mathieujobin
mathieujobin / kde-baseapps-brew-install-output.log
Created January 6, 2012 17:06
brew install -v kde-baseapps
==> Downloading ftp://ftp.kde.org/pub/kde/stable/4.7.4/src/kde-baseapps-4.7.4.tar.bz2
File already downloaded in /Users/mjobin/Library/Caches/Homebrew
/usr/bin/tar xf /Users/mjobin/Library/Caches/Homebrew/kde-baseapps-4.7.4.tar.bz2
==> cmake .. -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/kdelibs/4.7.4 -DBUILD_doc=FALSE -DBUNDLE_INSTALL_DIR=/usr/local/Cellar/kde-baseapps/4.7.4/bin
cmake .. -DCMAKE_OSX_ARCHITECTURES=x86_64 -DCMAKE_INSTALL_PREFIX=/usr/local/Cellar/kdelibs/4.7.4 -DBUILD_doc=FALSE -DBUNDLE_INSTALL_DIR=/usr/local/Cellar/kde-baseapps/4.7.4/bin
-- The C compiler identification is GNU
-- The CXX compiler identification is GNU
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag

Keybase proof

I hereby claim:

  • I am mathieujobin on github.
  • I am mathieujobin (https://keybase.io/mathieujobin) on keybase.
  • I have a public key whose fingerprint is E456 38FD 0C05 FB5B AEED 610B 72D0 BEA7 41A1 70E8

To claim this, I am signing this object: