Posts
Author Archives: Linuxgal
Compile
Compile short C programs on the fly at the command prompt echo ‘main() { printf(“Hello world!\n”); }’ | gcc -w -x c – -o hello echo ‘#include <stdio.h> int fibonacci(int n){return n<2?n:fibonacci(n-1)+fibonacci(n-2);} int main(){printf(“%d\n”,fibonacci(19));return 0;}’ | gcc -x c – … Continue reading
Posted in Uncategorized
Leave a comment
1 Liners
Print all primes less than 5000: $ python3 -c ‘print([i for i in range(2,5000) if all(i%j for j in range(2,int(i**0.5)+1))])’ Break a GIF into individual frames: ffmpeg -i taarna.gif frame_%d.jpg List all the words in a file with no matches … Continue reading
Posted in Uncategorized
Leave a comment