mirror of
https://github.com/narkoz/hacker-scripts
synced 2025-08-29 05:37:45 +00:00
log to stdout
This commit is contained in:
parent
12c4f2dcfd
commit
f9321f0f07
16
hangover.rb
16
hangover.rb
@ -3,13 +3,6 @@
|
|||||||
# Skip on weekends
|
# Skip on weekends
|
||||||
exit if Time.now.saturday? || Time.now.sunday?
|
exit if Time.now.saturday? || Time.now.sunday?
|
||||||
|
|
||||||
log_file_name = File.dirname(__FILE__) + '/logs/hangover.txt'
|
|
||||||
|
|
||||||
# Be sure that logs dir always exists
|
|
||||||
Dir.mkdir('logs') unless File.exists?(log_file_name)
|
|
||||||
|
|
||||||
LOG_FILE = File.open(log_file_name, 'a+')
|
|
||||||
|
|
||||||
# Exit early if sessions with my username are found
|
# Exit early if sessions with my username are found
|
||||||
exit if `who -q`.include? ENV['USER']
|
exit if `who -q`.include? ENV['USER']
|
||||||
|
|
||||||
@ -27,19 +20,18 @@ TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN']
|
|||||||
my_number = '+xxx'
|
my_number = '+xxx'
|
||||||
number_of_boss = '+xxx'
|
number_of_boss = '+xxx'
|
||||||
|
|
||||||
excuses = [
|
excuse = [
|
||||||
'Locked out',
|
'Locked out',
|
||||||
'Pipes broke',
|
'Pipes broke',
|
||||||
'Food poisoning',
|
'Food poisoning',
|
||||||
'Not feeling well'
|
'Not feeling well'
|
||||||
]
|
].sample
|
||||||
|
|
||||||
# Send a text message
|
# Send a text message
|
||||||
@twilio.messages.create(
|
@twilio.messages.create(
|
||||||
from: my_number, to: number_of_boss,
|
from: my_number, to: number_of_boss,
|
||||||
body: 'Gonna work from home. ' + excuses.sample
|
body: "Gonna work from home. #{excuse}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Log this
|
# Log this
|
||||||
LOG_FILE.puts("Message sent at: #{Time.now}")
|
puts "Message sent at: #{Time.now} | Excuse: #{excuse}"
|
||||||
LOG_FILE.close
|
|
||||||
|
@ -3,13 +3,6 @@
|
|||||||
# Skip on weekends
|
# Skip on weekends
|
||||||
exit if Time.now.saturday? || Time.now.sunday?
|
exit if Time.now.saturday? || Time.now.sunday?
|
||||||
|
|
||||||
log_file_name = File.dirname(__FILE__) + '/logs/smack_my_bitch_up.txt'
|
|
||||||
|
|
||||||
# Be sure that logs dir always exists
|
|
||||||
Dir.mkdir('logs') unless File.exists?(log_file_name)
|
|
||||||
|
|
||||||
LOG_FILE = File.open(log_file_name, 'a+')
|
|
||||||
|
|
||||||
# Exit early if no sessions with my username are found
|
# Exit early if no sessions with my username are found
|
||||||
exit if `who -q`.include? ENV['USER']
|
exit if `who -q`.include? ENV['USER']
|
||||||
|
|
||||||
@ -27,20 +20,16 @@ TWILIO_AUTH_TOKEN = ENV['TWILIO_AUTH_TOKEN']
|
|||||||
my_number = '+xxx'
|
my_number = '+xxx'
|
||||||
her_number = '+xxx'
|
her_number = '+xxx'
|
||||||
|
|
||||||
reasons = [
|
reason = [
|
||||||
'Working hard',
|
'Working hard',
|
||||||
'Gotta ship this feature',
|
'Gotta ship this feature',
|
||||||
'Someone fucked the system again'
|
'Someone fucked the system again'
|
||||||
]
|
].sample
|
||||||
|
|
||||||
sample = reasons.sample
|
|
||||||
|
|
||||||
# Send a text message
|
# Send a text message
|
||||||
@twilio.messages.create(
|
@twilio.messages.create(
|
||||||
from: my_number, to: her_number, body: 'Late at work. ' + sample
|
from: my_number, to: her_number, body: "Late at work. #{reason}"
|
||||||
)
|
)
|
||||||
|
|
||||||
# Log this
|
# Log this
|
||||||
LOG_FILE.puts("Message sent at: #{Time.now}")
|
puts "Message sent at: #{Time.now} | Reason: #{reason}"
|
||||||
LOG_FILE.puts("Reason: #{sample}")
|
|
||||||
LOG_FILE.close
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user