Skip to content

Instantly share code, notes, and snippets.

@LevitatingBusinessMan
Created January 9, 2023 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save LevitatingBusinessMan/ca6143104f962013cdad3cff215584e5 to your computer and use it in GitHub Desktop.
Save LevitatingBusinessMan/ca6143104f962013cdad3cff215584e5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env ruby
FILENAME = ARGV[0]
abort "No filename given" if !FILENAME
clog = ""
STARTTIME = Time.now
File.write FILENAME, `date`, mode: 'a'
loop do
print "> "
line = STDIN.gets
break if !line or line == "end\n"
clog += line
# End clog
if line == "\n"
time_since = (Time.now - STARTTIME).to_i / 60
File.write FILENAME, "T+#{time_since}: #{clog}", mode: 'a'
puts "Saved"
clog = ""
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment