Skip to content

Instantly share code, notes, and snippets.

View adaedra's full-sized avatar

Thibault “Adædra” Hamel adaedra

View GitHub Profile
@adaedra
adaedra / anetzen-patch.patch
Created July 4, 2012 12:01
anetzen (1) : Fix for SIGSEGV under Linux-x86_64
Index: ACoreApp.cc
===================================================================
diff --git a/ACoreApp.cc b/ACoreApp.cc
--- a/ACoreApp.cc (revision 32)
+++ b/ACoreApp.cc (working copy)
@@ -20,7 +20,7 @@
#include "ANetSoul.hh"
#include "AChatWindow.hh"
-ACoreApp::ACoreApp(int argc, char** argv) : QApplication(argc, argv)
@adaedra
adaedra / gist:3403964
Created August 20, 2012 13:21
Ruby vs JRuby
(pegasus) % cat benchmark.rb
#!/usr/bin/env ruby
t_b = Time.now.to_f
# 50'000 * sin [ -90 .. 90 ]
50000.times do
( -90 .. 90 ).each do |x|
Math.sin(x)
H4sIACyiOFAAA0tNzshX8DAp9nT0Sszwd3N0dDQo86lyLQkqdAsIDEk09AwJi/IMyawIMnA2DMn0zvUvDAv3LE6NdHb0rzIv9Q1NBupwVKhRSEosTjUzUdB1AbLTS/OqMgsUdJMVdIG84gwuAM5BcGZlAAAA
@adaedra
adaedra / gist:3632783
Created September 5, 2012 07:45
PKGBUILD for lib32-gdbm
# Maintainer: josephgbr <rafael.f.f1 at gmail.com>
# Contributor: Maribu <leonidas200 at web dot de>
_pkgbase=gdbm
pkgname=lib32-$_pkgbase
pkgver=1.10
pkgrel=1
pkgdesc="GNU database library (32 bit)"
license=('GPL')
url="http://www.gnu.org/software/gdbm/gdbm.html"
@adaedra
adaedra / gist:3851553
Created October 8, 2012 09:11
Objective-C Mangling FAIL !
#import <Edifice/EdObject.h>
#import <stdio.h>
@interface Test : EdObject
- (void) test: (int) i;
- (void) test_;
@end
@adaedra
adaedra / gist:3888306
Created October 14, 2012 11:34
Ruby implementations comparison
adaedra@pegasus % ./test.rb
Test "sinusTest" runned in 1.340s
Test "loopTest" runned in 6.249s
Test "arrayTest" runned in 1.810s
Test "randomTest" runned in 3.110s
Test "sortTest" runned in 1.774s
Test "threadsTest" runned in 5.762s
Total time run : 20.045s
adaedra@pegasus % rvm use jruby
Using /usr/local/rvm/gems/jruby-1.6.8
@adaedra
adaedra / typescript
Created December 13, 2012 22:16
Apple's memory & valgrind fail
adaedra@pegasus % cd /tmp
adaedra@pegasus % echo "int main(void) { }" > memory_fail.c
adaedra@pegasus % gcc -o memory_fail memory_fail.c
adaedra@pegasus % valgrind ./memory_fail
==2086== Memcheck, a memory error detector
==2086== Copyright (C) 2002-2012, and GNU GPL'd, by Julian Seward et al.
==2086== Using Valgrind-3.8.1 and LibVEX; rerun with -h for copyright info
==2086== Command: ./memory_fail
==2086==
==2086== WARNING: Support on MacOS 10.8 is experimental and mostly broken.
@adaedra
adaedra / foo.rb
Created January 15, 2013 23:33
Ruby fun :D
def false.to_s
"true"
end
@adaedra
adaedra / .zshrc
Last active December 17, 2015 09:29
My `.zshrc` file. This gist is used by the script itself to maintain itself up-to-date.
OPEN_SYMBOL="❮"
CLOSE_SYMBOL="❯"
PROMPT=" %F{cyan}%m: %B%n%b%F{cyan} \${CLOSE_SYMBOL}%f "
RPROMPT="\${STATUS_PROMPT}%F{blue}\${OPEN_SYMBOL} %B%1~%b%f"
LAST_RET=0
setopt PROMPT_SUBST
setopt TRANSIENT_RPROMPT
#include <ctype.h>
#include <stdio.h>
#include <string.h>
#include <stdlib.h>
#include <time.h>
#include <limits.h>
#define PASSWORD_LENGTH 10
int main(void) {