Last active
June 26, 2016 17:53
-
-
Save nna774/5992a4eaf59570c086a0c9cb133c7798 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
require 'json' | |
require "net/https" | |
WH_URI = "https://hooks.slack.com/services/hoehoehoehoe~~~~~~~~" | |
uptime = `uptime`.chomp | |
hash = { | |
"text" => "こ、殺される~~~っ!(uptime: #{uptime})", | |
"icon_emoji" => ":pepper:", | |
"username" => `hostname`.chomp, | |
"channel" => "#nona-kanshi", | |
}.to_json | |
hash = "payload=" + hash | |
uri = URI.parse(WH_URI) | |
https = Net::HTTP.new(uri.host, uri.port) | |
https.use_ssl = true | |
req = Net::HTTP::Post.new(uri.request_uri) | |
req.body = hash | |
res = https.request(req) | |
puts res.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=korosareru | |
After=network.target | |
[Service] | |
ExecStart=/bin/sleep 86400 | |
ExecStop=/home/nona/.dotfiles/bin/acpi.rb | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/ruby | |
# -*- encoding: utf-8 -*- | |
require 'json' | |
require "net/https" | |
WH_URI = "https://hooks.slack.com/services/hoehoe~~~~~~" | |
hashO = { | |
"text" => "おはようございます。僕はペッパーです。", | |
"icon_emoji" => ":pepper:", | |
"username" => `hostname`.chomp, | |
"channel" => "#nona-kanshi", | |
} | |
hash = "payload=" + hashO.to_json | |
uri = URI.parse(WH_URI) | |
https = Net::HTTP.new(uri.host, uri.port) | |
https.use_ssl = true | |
req = Net::HTTP::Post.new(uri.request_uri) | |
req.body = hash | |
res = https.request(req) | |
puts res.body | |
hashO["text"] = "うそだよ。" | |
hash = "payload=" + hashO.to_json | |
req.body = hash | |
res = https.request(req) | |
puts res.body |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=ohayou | |
After=network.target | |
[Service] | |
ExecStart=/home/nona/.dotfiles/bin/login.rb | |
Type=oneshot | |
RemainAfterExit=yes | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment