Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # # # # # # # #
- #!/usr/bin/env ruby
- # # # # # # #
- # # # # # #
- # Created January 28th 2018
- # Copyright (c) 2017 Beyar N.
- # # # #
- # # #
- # Name: count.rb
- # #
- # System methods
- class Sys
- def Sys::cls
- system "clear" or system "cls"
- end
- def Sys::cmd(input)
- system(input)
- end
- end
- # Source code
- source = '#include <stdio.h>
- int main(){
- int counter;
- for(counter = 0; counter < 1000001; counter++){
- printf("%d\n", counter);
- }
- }'.split("\n").to_a
- # Creates & inserts the code
- srcfile = File.new("tempfile.c", "w+")
- for each in source
- srcfile.puts(each)
- end
- srcfile.close
- # Run and destroy
- Sys.cmd("gcc tempfile.c -o tempfile -O2")
- Sys.cmd("rm tempfile.c")
- Sys.cmd("./tempfile")
- Sys.cmd("rm tempfile")
Add Comment
Please, Sign In to add comment