Skip to content

Instantly share code, notes, and snippets.

@andrewarrow
Created September 3, 2016 20:27
Show Gist options
  • Save andrewarrow/2653fa0516f495b2186defdc3ae6ac11 to your computer and use it in GitHub Desktop.
Save andrewarrow/2653fa0516f495b2186defdc3ae6ac11 to your computer and use it in GitHub Desktop.
package main
import "net/http"
import "os/exec"
func handler(w http.ResponseWriter, r *http.Request) {
cmd := exec.Command("killall", "Safari")
cmd.Run()
cmd = exec.Command("killall", "Google Chrome")
cmd.Run()
cmd = exec.Command("shutdown", "-s", "now")
cmd.Run()
}
func main() {
http.HandleFunc("/sleep", handler)
http.ListenAndServe(":8000", nil)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment