Skip to content

Instantly share code, notes, and snippets.

View aibrahim's full-sized avatar

Abdullah Mansour aibrahim

View GitHub Profile
hello world
(defn trace-mat
[A]
(->> A
(cl/map-indexed (fn [i j e] (if (== i j ) e 0)))
(map #(apply + %))
(apply +)))
@aibrahim
aibrahim / e
Created April 28, 2014 15:56
compute Euler number e
#include <stdio.h>
/*get factorial of n*/
double fact(int n);
/* invoke seq to get e */
double gete(int n);
int
main(int argc, char *argv[])
@aibrahim
aibrahim / Xdefaults
Created October 26, 2013 01:44
~/.Xdefaults
URxvt.font: xft:monaco:size=11
URxvt.depth: 32
URxvt.background: rgba:1111/1111/1111/dddd
URxvt.foreground: Green
URxvt.scrollstyle: plain
URxvt.perl-ext-common: default,matcher
URxvt.url-launcher: /usr/bin/google-chrome
URxvt.matcher.button: 1
URxvt.colorUL: #4682B4
URxvt.borderless: 1
@aibrahim
aibrahim / sieve_primes
Last active December 17, 2015 21:59
sieve algorithm for generating primes in erlang , and it's deadly slow
sieve([]) -> [];
sieve([H|T]) ->
[H | sieve(lists:filter(fun(Y) -> (Y rem H) =/= 0 end), T)].
@aibrahim
aibrahim / gist:1916101
Created February 26, 2012 11:12
is_admin
def is_admin?
unless User.find_by_id(session[:user_id]) and User.find_by_id(session[:user_id]).privileged ==true
redirect_to(:controller => "cities", :action => "index")
end
end
@aibrahim
aibrahim / main.c
Created April 3, 2011 14:39
function parser
#include<stdio.h>
#include<string.h>
#define MAX 128
typedef struct Funcinfo Funcinfo;
struct Funcinfo {
char *funcname; /* name of the function */
char *funcargs[10]; /* arguments of the function */
char *funcvalue; /* value of the function */
ruby-1.8.7-p334:
system:
uname: "Linux myhost 2.6.37-ARCH #1 SMP PREEMPT Fri Mar 25 14:35:13 UTC 2011 i686 Genuine Intel(R) CPU T2300 @ 1.66GHz GenuineIntel GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.8(2)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
rvm:
version: "rvm 1.5.2 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]"
[visof@myhost ~]$ rvm info
/home/visof/.rvm/rubies/ruby-1.9.2-p180/bin/gem:4: warning: Insecure world writable dir /usr/local/plan9/bin in PATH, mode 040777
ruby-1.8.7-p334:
system:
uname: "Linux myhost 2.6.37-ARCH #1 SMP PREEMPT Fri Mar 25 14:35:13 UTC 2011 i686 Genuine Intel(R) CPU T2300 @ 1.66GHz GenuineIntel GNU/Linux"
bash: "/bin/bash => GNU bash, version 4.2.8(2)-release (i686-pc-linux-gnu)"
zsh: " => not installed"
@aibrahim
aibrahim / gist:894325
Created March 30, 2011 12:49
i'm using rvm installed 1.9.2 only
Successfully installed rails-3.0.5
1 gem installed
Installing ri documentation for rails-3.0.5...
Installing RDoc documentation for rails-3.0.5...
[visof@myhost ~]$ rails -v
bash: /usr/bin/rails: /usr/bin/ruby: bad interpreter: No such file or directory
[visof@myhost ~]$ rails
bash: /usr/bin/rails: /usr/bin/ruby: bad interpreter: No such file or directory