{"action":"created","comment":{"url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/comments/31232789","id":31232789,"diff_hunk":"@@ -1,45 +1,107 @@\n package main\n \n import (\n-  \"log\"\n-  \"math/rand\"\n-  \"net/http\"\n+\t\"bytes\"\n+\t\"encoding/json\"\n+\t\"log\"\n+\t\"math/rand\"\n+\t\"net/http\"\n+\t\"os\"\n+\t\"time\"\n )\n \n+type Event struct {\n+\tAddress   string\n+\tEmailType string\n+\tEvent     string\n+\tTimestamp int64\n+}\n+\n func randomSender() string {\n-  senders := []string{\n-    \"alex@lostmy.name\",\n-    \"barney@lostmy.name\",\n-    \"callum@lostmy.name\",\n-    \"j@lostmy.name\",\n-    \"jacob@lostmy.name\",\n-    \"jesse@lostmy.name\",\n-    \"josh@lostmy.name\",\n-    \"oz@lostmy.name\",\n-    \"patrick@lostmy.name\",\n-    \"pete@lostmy.name\",\n-    \"rehat@lostmy.name\",\n-    \"simon@lostmy.name\",\n-    \"simonf@lostmy.name\",\n-    \"tal@lostmy.name\",\n-    \"tom@lostmy.name\",\n-    \"tony@lostmy.name\",\n-    \"vitor@lostmy.name\",\n-  }\n-\n-  return senders[rand.Intn(len(senders))]\n+\tsenders := []string{\n+\t\t\"alex@lostmy.name\",\n+\t\t\"barney@lostmy.name\",\n+\t\t\"callum@lostmy.name\",\n+\t\t\"f@lostmy.name\",\n+\t\t\"jacob@lostmy.name\",\n+\t\t\"jesse@lostmy.name\",\n+\t\t\"josh@lostmy.name\",\n+\t\t\"oz@lostmy.name\",\n+\t\t\"patrick@lostmy.name\",\n+\t\t\"pete@lostmy.name\",\n+\t\t\"rehat@lostmy.name\",\n+\t\t\"simon@lostmy.name\",\n+\t\t\"simonf@lostmy.name\",\n+\t\t\"tal@lostmy.name\",\n+\t\t\"tom@lostmy.name\",\n+\t\t\"tony@lostmy.name\",\n+\t\t\"vitor@lostmy.name\",\n+\t}\n+\n+\treturn senders[rand.Intn(len(senders))]\n+}\n+\n+func randomEvent() string {\n+\trandomInt := rand.Intn(100)\n+\tswitch {\n+\tcase randomInt < 60:\n+\t\treturn \"send\"\n+\tcase randomInt < 90:\n+\t\treturn \"open\"\n+\tdefault:\n+\t\treturn \"click\"\n+\t}\n }\n \n-func sendRequest(url string) {\n-  _, err := http.Get(url)\n+func randomEmailType() string {\n+\ttypes := []string{\n+\t\t\"Order\",\n+\t\t\"UserConfirmation\",\n+\t\t\"Shipment\",\n+\t\t\"ReferAFriend\",\n+\t\t\"GetABookDiscount\",\n+\t}\n \n-  if err != nil {\n-    log.Fatal(err)\n-  }\n+\treturn types[rand.Intn(len(types))]\n+}\n+\n+func sendRequests(target string) {\n+\tfor {\n+\t\tevent := Event{\n+\t\t\trandomSender(),\n+\t\t\trandomEmailType(),\n+\t\t\trandomEvent(),\n+\t\t\ttime.Now().Unix(),\n+\t\t}\n+\t\teventJson, _ := json.Marshal(event)\n+\t\tresp, err := http.Post(\n+\t\t\ttarget,\n+\t\t\t\"text/json\",\n+\t\t\tbytes.NewReader(eventJson),\n+\t\t)\n+\n+\t\tif err != nil {\n+\t\t\tlog.Fatal(err)\n+\t\t}\n \n-  log.Printf(\"Successfully posted payload to %s\", url)\n+\t\tif resp.StatusCode != 200 {\n+\t\t\tlog.Fatalf(\"Expecting 200 returned, got %f\", resp.StatusCode)\n+\t\t}\n+","path":"llirdnam.go","position":120,"original_position":120,"commit_id":"2c375bae2f50eb3b6cdd7f0a48e47778480acb74","original_commit_id":"2c375bae2f50eb3b6cdd7f0a48e47778480acb74","user":{"login":"mcmillan","id":1315466,"avatar_url":"https://avatars.githubusercontent.com/u/1315466?v=3","gravatar_id":"","url":"https://api.github.com/users/mcmillan","html_url":"https://github.com/mcmillan","followers_url":"https://api.github.com/users/mcmillan/followers","following_url":"https://api.github.com/users/mcmillan/following{/other_user}","gists_url":"https://api.github.com/users/mcmillan/gists{/gist_id}","starred_url":"https://api.github.com/users/mcmillan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mcmillan/subscriptions","organizations_url":"https://api.github.com/users/mcmillan/orgs","repos_url":"https://api.github.com/users/mcmillan/repos","events_url":"https://api.github.com/users/mcmillan/events{/privacy}","received_events_url":"https://api.github.com/users/mcmillan/received_events","type":"User","site_admin":false},"body":"Groovylicious","created_at":"2015-05-28T13:33:43Z","updated_at":"2015-05-28T13:33:43Z","html_url":"https://github.com/Lostmyname/llirdnam/pull/1#discussion_r31232789","pull_request_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1","_links":{"self":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/comments/31232789"},"html":{"href":"https://github.com/Lostmyname/llirdnam/pull/1#discussion_r31232789"},"pull_request":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1"}}},"pull_request":{"url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1","id":36405895,"html_url":"https://github.com/Lostmyname/llirdnam/pull/1","diff_url":"https://github.com/Lostmyname/llirdnam/pull/1.diff","patch_url":"https://github.com/Lostmyname/llirdnam/pull/1.patch","issue_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/1","number":1,"state":"open","locked":false,"title":"Make this a thing","user":{"login":"simonpfry","id":3431694,"avatar_url":"https://avatars.githubusercontent.com/u/3431694?v=3","gravatar_id":"","url":"https://api.github.com/users/simonpfry","html_url":"https://github.com/simonpfry","followers_url":"https://api.github.com/users/simonpfry/followers","following_url":"https://api.github.com/users/simonpfry/following{/other_user}","gists_url":"https://api.github.com/users/simonpfry/gists{/gist_id}","starred_url":"https://api.github.com/users/simonpfry/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/simonpfry/subscriptions","organizations_url":"https://api.github.com/users/simonpfry/orgs","repos_url":"https://api.github.com/users/simonpfry/repos","events_url":"https://api.github.com/users/simonpfry/events{/privacy}","received_events_url":"https://api.github.com/users/simonpfry/received_events","type":"User","site_admin":false},"body":"Make this app into a function widget to help find new awesome developers.","created_at":"2015-05-28T13:25:57Z","updated_at":"2015-05-28T13:33:43Z","closed_at":null,"merged_at":null,"merge_commit_sha":"9e9f426e4a201e898dbf1b6756f2913680dcfa93","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1/commits","review_comments_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1/comments","review_comment_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/comments{/number}","comments_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/1/comments","statuses_url":"https://api.github.com/repos/Lostmyname/llirdnam/statuses/2c375bae2f50eb3b6cdd7f0a48e47778480acb74","head":{"label":"Lostmyname:make-this-a-thing","ref":"make-this-a-thing","sha":"2c375bae2f50eb3b6cdd7f0a48e47778480acb74","user":{"login":"Lostmyname","id":3286865,"avatar_url":"https://avatars.githubusercontent.com/u/3286865?v=3","gravatar_id":"","url":"https://api.github.com/users/Lostmyname","html_url":"https://github.com/Lostmyname","followers_url":"https://api.github.com/users/Lostmyname/followers","following_url":"https://api.github.com/users/Lostmyname/following{/other_user}","gists_url":"https://api.github.com/users/Lostmyname/gists{/gist_id}","starred_url":"https://api.github.com/users/Lostmyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lostmyname/subscriptions","organizations_url":"https://api.github.com/users/Lostmyname/orgs","repos_url":"https://api.github.com/users/Lostmyname/repos","events_url":"https://api.github.com/users/Lostmyname/events{/privacy}","received_events_url":"https://api.github.com/users/Lostmyname/received_events","type":"Organization","site_admin":false},"repo":{"id":36432802,"name":"llirdnam","full_name":"Lostmyname/llirdnam","owner":{"login":"Lostmyname","id":3286865,"avatar_url":"https://avatars.githubusercontent.com/u/3286865?v=3","gravatar_id":"","url":"https://api.github.com/users/Lostmyname","html_url":"https://github.com/Lostmyname","followers_url":"https://api.github.com/users/Lostmyname/followers","following_url":"https://api.github.com/users/Lostmyname/following{/other_user}","gists_url":"https://api.github.com/users/Lostmyname/gists{/gist_id}","starred_url":"https://api.github.com/users/Lostmyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lostmyname/subscriptions","organizations_url":"https://api.github.com/users/Lostmyname/orgs","repos_url":"https://api.github.com/users/Lostmyname/repos","events_url":"https://api.github.com/users/Lostmyname/events{/privacy}","received_events_url":"https://api.github.com/users/Lostmyname/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Lostmyname/llirdnam","description":"","fork":false,"url":"https://api.github.com/repos/Lostmyname/llirdnam","forks_url":"https://api.github.com/repos/Lostmyname/llirdnam/forks","keys_url":"https://api.github.com/repos/Lostmyname/llirdnam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Lostmyname/llirdnam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Lostmyname/llirdnam/teams","hooks_url":"https://api.github.com/repos/Lostmyname/llirdnam/hooks","issue_events_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/events{/number}","events_url":"https://api.github.com/repos/Lostmyname/llirdnam/events","assignees_url":"https://api.github.com/repos/Lostmyname/llirdnam/assignees{/user}","branches_url":"https://api.github.com/repos/Lostmyname/llirdnam/branches{/branch}","tags_url":"https://api.github.com/repos/Lostmyname/llirdnam/tags","blobs_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/refs{/sha}","trees_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Lostmyname/llirdnam/statuses/{sha}","languages_url":"https://api.github.com/repos/Lostmyname/llirdnam/languages","stargazers_url":"https://api.github.com/repos/Lostmyname/llirdnam/stargazers","contributors_url":"https://api.github.com/repos/Lostmyname/llirdnam/contributors","subscribers_url":"https://api.github.com/repos/Lostmyname/llirdnam/subscribers","subscription_url":"https://api.github.com/repos/Lostmyname/llirdnam/subscription","commits_url":"https://api.github.com/repos/Lostmyname/llirdnam/commits{/sha}","git_commits_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/commits{/sha}","comments_url":"https://api.github.com/repos/Lostmyname/llirdnam/comments{/number}","issue_comment_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/comments{/number}","contents_url":"https://api.github.com/repos/Lostmyname/llirdnam/contents/{+path}","compare_url":"https://api.github.com/repos/Lostmyname/llirdnam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Lostmyname/llirdnam/merges","archive_url":"https://api.github.com/repos/Lostmyname/llirdnam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Lostmyname/llirdnam/downloads","issues_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues{/number}","pulls_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls{/number}","milestones_url":"https://api.github.com/repos/Lostmyname/llirdnam/milestones{/number}","notifications_url":"https://api.github.com/repos/Lostmyname/llirdnam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Lostmyname/llirdnam/labels{/name}","releases_url":"https://api.github.com/repos/Lostmyname/llirdnam/releases{/id}","created_at":"2015-05-28T11:03:21Z","updated_at":"2015-05-28T11:03:35Z","pushed_at":"2015-05-28T13:25:57Z","git_url":"git://github.com/Lostmyname/llirdnam.git","ssh_url":"git@github.com:Lostmyname/llirdnam.git","clone_url":"https://github.com/Lostmyname/llirdnam.git","svn_url":"https://github.com/Lostmyname/llirdnam","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"Lostmyname:master","ref":"master","sha":"1c93a88c1b521561073d37bfdfa3e6622083d612","user":{"login":"Lostmyname","id":3286865,"avatar_url":"https://avatars.githubusercontent.com/u/3286865?v=3","gravatar_id":"","url":"https://api.github.com/users/Lostmyname","html_url":"https://github.com/Lostmyname","followers_url":"https://api.github.com/users/Lostmyname/followers","following_url":"https://api.github.com/users/Lostmyname/following{/other_user}","gists_url":"https://api.github.com/users/Lostmyname/gists{/gist_id}","starred_url":"https://api.github.com/users/Lostmyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lostmyname/subscriptions","organizations_url":"https://api.github.com/users/Lostmyname/orgs","repos_url":"https://api.github.com/users/Lostmyname/repos","events_url":"https://api.github.com/users/Lostmyname/events{/privacy}","received_events_url":"https://api.github.com/users/Lostmyname/received_events","type":"Organization","site_admin":false},"repo":{"id":36432802,"name":"llirdnam","full_name":"Lostmyname/llirdnam","owner":{"login":"Lostmyname","id":3286865,"avatar_url":"https://avatars.githubusercontent.com/u/3286865?v=3","gravatar_id":"","url":"https://api.github.com/users/Lostmyname","html_url":"https://github.com/Lostmyname","followers_url":"https://api.github.com/users/Lostmyname/followers","following_url":"https://api.github.com/users/Lostmyname/following{/other_user}","gists_url":"https://api.github.com/users/Lostmyname/gists{/gist_id}","starred_url":"https://api.github.com/users/Lostmyname/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Lostmyname/subscriptions","organizations_url":"https://api.github.com/users/Lostmyname/orgs","repos_url":"https://api.github.com/users/Lostmyname/repos","events_url":"https://api.github.com/users/Lostmyname/events{/privacy}","received_events_url":"https://api.github.com/users/Lostmyname/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/Lostmyname/llirdnam","description":"","fork":false,"url":"https://api.github.com/repos/Lostmyname/llirdnam","forks_url":"https://api.github.com/repos/Lostmyname/llirdnam/forks","keys_url":"https://api.github.com/repos/Lostmyname/llirdnam/keys{/key_id}","collaborators_url":"https://api.github.com/repos/Lostmyname/llirdnam/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/Lostmyname/llirdnam/teams","hooks_url":"https://api.github.com/repos/Lostmyname/llirdnam/hooks","issue_events_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/events{/number}","events_url":"https://api.github.com/repos/Lostmyname/llirdnam/events","assignees_url":"https://api.github.com/repos/Lostmyname/llirdnam/assignees{/user}","branches_url":"https://api.github.com/repos/Lostmyname/llirdnam/branches{/branch}","tags_url":"https://api.github.com/repos/Lostmyname/llirdnam/tags","blobs_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/refs{/sha}","trees_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/trees{/sha}","statuses_url":"https://api.github.com/repos/Lostmyname/llirdnam/statuses/{sha}","languages_url":"https://api.github.com/repos/Lostmyname/llirdnam/languages","stargazers_url":"https://api.github.com/repos/Lostmyname/llirdnam/stargazers","contributors_url":"https://api.github.com/repos/Lostmyname/llirdnam/contributors","subscribers_url":"https://api.github.com/repos/Lostmyname/llirdnam/subscribers","subscription_url":"https://api.github.com/repos/Lostmyname/llirdnam/subscription","commits_url":"https://api.github.com/repos/Lostmyname/llirdnam/commits{/sha}","git_commits_url":"https://api.github.com/repos/Lostmyname/llirdnam/git/commits{/sha}","comments_url":"https://api.github.com/repos/Lostmyname/llirdnam/comments{/number}","issue_comment_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues/comments{/number}","contents_url":"https://api.github.com/repos/Lostmyname/llirdnam/contents/{+path}","compare_url":"https://api.github.com/repos/Lostmyname/llirdnam/compare/{base}...{head}","merges_url":"https://api.github.com/repos/Lostmyname/llirdnam/merges","archive_url":"https://api.github.com/repos/Lostmyname/llirdnam/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/Lostmyname/llirdnam/downloads","issues_url":"https://api.github.com/repos/Lostmyname/llirdnam/issues{/number}","pulls_url":"https://api.github.com/repos/Lostmyname/llirdnam/pulls{/number}","milestones_url":"https://api.github.com/repos/Lostmyname/llirdnam/milestones{/number}","notifications_url":"https://api.github.com/repos/Lostmyname/llirdnam/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/Lostmyname/llirdnam/labels{/name}","releases_url":"https://api.github.com/repos/Lostmyname/llirdnam/releases{/id}","created_at":"2015-05-28T11:03:21Z","updated_at":"2015-05-28T11:03:35Z","pushed_at":"2015-05-28T13:25:57Z","git_url":"git://github.com/Lostmyname/llirdnam.git","ssh_url":"git@github.com:Lostmyname/llirdnam.git","clone_url":"https://github.com/Lostmyname/llirdnam.git","svn_url":"https://github.com/Lostmyname/llirdnam","homepage":null,"size":0,"stargazers_count":0,"watchers_count":0,"language":"Go","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1"},"html":{"href":"https://github.com/Lostmyname/llirdnam/pull/1"},"issue":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/issues/1"},"comments":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/issues/1/comments"},"review_comments":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1/comments"},"review_comment":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/pulls/1/commits"},"statuses":{"href":"https://api.github.com/repos/Lostmyname/llirdnam/statuses/2c375bae2f50eb3b6cdd7f0a48e47778480acb74"}}}}