Example of how to use stdout and stdin from other programs in golang
Requires go
go run parentprocess.go
| ;; A space invaders game in Racket | |
| ;; Copyright (c) 2020 Alex Harsányi (AlexHarsanyi@gmail.com) | |
| ;; Permission is hereby granted, free of charge, to any person obtaining a | |
| ;; copy of this software and associated documentation files (the "Software"), | |
| ;; to deal in the Software without restriction, including without limitation | |
| ;; the rights to use, copy, modify, merge, publish, distribute, sublicense, | |
| ;; and/or sell copies of the Software, and to permit persons to whom the | |
| ;; Software is furnished to do so, subject to the following conditions: |
| #!/bin/bash | |
| # Run this script just before you put the laptop in the bin for security scanning. | |
| # You can add the seconds the laptop will be waiting before speaking. The default | |
| # is waiting for 180 seconds (3 minutes). | |
| # Switch to the login screen, effectively locking the screen. | |
| function lockscreen() { | |
| /System/Library/CoreServices/"Menu Extras"/User.menu/Contents/Resources/CGSession -suspend | |
| } |
| /** | |
| * GOZORK Text Adventure Game | |
| * by apoc <http://apoc.cc> | |
| * | |
| * Inspired by the infamous beginning of Zork I. | |
| * Reading the source will obviously spoil the game. | |
| * The goal is to somehow kill the troll. | |
| * Oh yeah and: This is my first GO program! Which would be | |
| * my perfect excuse for the bad code quality1! | |
| * Here is a solution/transcript: |
As configured in my dotfiles.
start new:
tmux
start new with session name:
| package main | |
| import ( | |
| "http" | |
| ) | |
| func main() { | |
| http.Handle("/foo/", http.StripPrefix("/foo", http.FileServer(http.Dir("/xyz/foo/")))) | |
| http.ListenAndServe(":6543", nil) | |
| } |