Skip to content

Instantly share code, notes, and snippets.

@MaheshReddy
MaheshReddy / fibonacci_number_generator
Created June 10, 2014 20:37
simple function to generate Fibonacci series.
float golden_ratio = 1.61803398874989484820;
float root_5 = 2.2360679774997896964091736687313;
int get_fibonacci(int n){
float fib_num = 0.0;
fib_num = (powf(golden_ratio,(float)n) - powf(1 - golden_ratio,(float)n)) / root_5;
return (int)fib_num;
}
@MaheshReddy
MaheshReddy / rename.dotfile.sh
Created July 2, 2012 18:52
Rename all the . files in directory by removing the .
for i in `ls -a` ; do mv $i ./`echo $i | sed 's/\.//g'`;done