Skip to content

Instantly share code, notes, and snippets.

@srishanbhattarai
Created April 18, 2018 10:25
Show Gist options
  • Save srishanbhattarai/b5aea2bbfc1854bdd2fa90bc86770f84 to your computer and use it in GitHub Desktop.
Save srishanbhattarai/b5aea2bbfc1854bdd2fa90bc86770f84 to your computer and use it in GitHub Desktop.
Scrape list of Docker container names. Run `go run docker-names.go >> names.txt`
package main
import (
"fmt"
"io/ioutil"
"net/http"
"os"
"time"
)
func main() {
t := time.After(10 * time.Second)
for i := 0; i < 50; i++ {
go name()
}
<-t
}
func name() {
c := http.Client{}
res, err := c.Get("https://frightanic.com/goodies_content/docker-names.php")
if err != nil {
fmt.Printf("Couldnt get URL: %v", err)
os.Exit(1)
}
b, _ := ioutil.ReadAll(res.Body)
fmt.Printf("%s", string(b))
go name()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment