This file contains hidden or 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
| func FindInPath(targets []string) <-chan string { | |
| messages := make(chan string) | |
| go func() { | |
| defer close(messages) | |
| var paths = EnviromentPaths() | |
| for _, target := range targets { | |
| for _, path := range paths { | |
| var target = path + "/" + target | |
| if Exists(target) { | |
| messages <- target |
This file contains hidden or 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
| func main() { | |
| if len(os.Args) > 1 { | |
| found := FindInPath(os.Args[1:]) | |
| for path := range found { | |
| fmt.Println(path) | |
| } | |
| } else { | |
| fmt.Println("usage: which program ...") | |
| os.Exit(1) | |
| } |
This file contains hidden or 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
| package main | |
| import ( | |
| "fmt" | |
| "os" | |
| "strings" | |
| ) | |
| func EnviromentPaths() []string { | |
| val, ok := os.LookupEnv("PATH") |
This file has been truncated, but you can view the full file.
This file contains hidden or 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
| jOFPeRMsKIZukh7gVtDKgAbYAvQhKUuLMKHy8NbrB9B+JdW+Vxf9xrdxV3XQhU6diPWQkRND | |
| pgsYKgWOlUnVxsf9IP6oFSfYj13wjncONO11yWEpwENIl4p4ny5+JDQfH/Vh+7K7rGkTFHOQ | |
| kAeakwFTkuJU9oTmE+kGOz2OKfLV6XGePjZc1spzm1htXLacFHXheR2rSUcbhmPyvcXAHeMw | |
| xOB2q1/PIRPkZZmTzVdg8BBLoFEGf15M6RdpQLn6KPM0NoHvgo/sgb1LzcPRFR9z2CHhvXTO | |
| Bv9FOPtelG3UpUnziT8p80iTULpkoztUtHmZB3+iI1m9Br1EaLnI41++eyzXT4veHl+bf9pJ | |
| dRQGEEfGD1rDYoxLDHJ1MUk+6C/TMHOdWCT0/irBA+cmE84DWD4E9lstD8dSoTJDWL6kbEW+ | |
| z866wyTKl7TdADKYoAAoE+O8rihCZD/4rwv5u2/cABXskAoDOVIqJOD2+ZJeoQ22e25UIDcd | |
| d9hj3wbXRGy/miOG9ZcvJtSgjIY5y1wgdvte0/+k7GgsTlQcMxgbd1NC3MFiaxIlMRH0o7MP | |
| iY5aMHcT1BMOWRCCuOzFxovd6Y5yjwA7w6i0QcdIdy5K7rXe8jhjfdMifPKPBkQJOQm04laK | |
| lL22xVIQsOZVE3gUwP9MhoqEoLCNbGbntzqsCGLGNOl3qWKFCKBtBhm9RtRQTd/fuXNYX5Cq |
This file contains hidden or 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
| var session | |
| var credentials | |
| var resp | |
| function encodeBasicAuthorizationCredentials(options = {}) { | |
| return 'Basic ' + btoa(options.username + ":" + options.password) | |
| } | |
| function setCredentials(options = {}) { | |
| credentials = encodeBasicAuthorizationCredentials(options) |
This file contains hidden or 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
| require 'slack-ruby-client' | |
| require 'net/http' | |
| require 'logger' | |
| # random logging for later analysis | |
| logger = Logger.new('bot.log') | |
| # public ip address for connecting to | |
| PUBLIC_IP = Net::HTTP.get(URI "https://api.ipify.org").strip |
This file contains hidden or 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
| FROM ruby:2.5.0 | |
| RUN gem install slack-ruby-client faye-websocket eventmachine | |
| COPY kumo_dojo_bot.rb /kumo_dojo_bot.rb | |
| CMD ["ruby", "kumo_dojo_bot.rb"] |
This file contains hidden or 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
| provider "aws" {} | |
| data "aws_ami" "ubuntu" { | |
| most_recent = true | |
| filter { | |
| name = "name" | |
| values = ["ubuntu/images/hvm-ssd/ubuntu-xenial-16.04-amd64-server-*"] | |
| } |
This file contains hidden or 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
| require 'packetgen' | |
| class Worker | |
| attr_accessor :reader | |
| attr_accessor :writer | |
| def initialize | |
| @reader, @writer = IO.pipe | |
| @output_reader, @output_writer = IO.pipe | |
| @process = fork do | |
| trap "SIGINT" do |
This file contains hidden or 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
| require 'httparty' | |
| url = "https://cloudflare-dns.com/dns-query" | |
| query = { name: "microsoft.com", type: "MX", ct: "application/dns-json" } | |
| headers = {'Content-Type': 'application/json'} | |
| buffer = StringIO.new | |
| response = HTTParty.get(url, stream_body: true, query: query, headers: headers) do |fragment| | |
| buffer << fragment |