Skip to content

Instantly share code, notes, and snippets.

@nna774 nna774/com.rb
Created Jul 6, 2016

Embed
What would you like to do?
#! /usr/bin/ruby
# -*- encoding: utf-8 -*-
require 'json'
require "net/https"
WH_URI = "https://hooks.slack.com/services/~~~~~~~~~~~~~~~~~~"
hashO = {
"text" => "また git com を実行しました。",
"icon_emoji" => ":sadpanda:",
"username" => "git com",
"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 "this \`com\` is reported to Slack"
@nna774

This comment has been minimized.

Copy link
Owner Author

commented Jul 6, 2016

[alias]
com = !/home/nona/.dotfiles/bin/com.rb

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.