Example of how to use stdout and stdin from other programs in golang
Requires go
go run parentprocess.go
| package main | |
| import ( | |
| "context" | |
| "errors" | |
| "log" | |
| "net/http" | |
| "sync" | |
| "time" |
Theory:
your git repository can have more than one remote server; In this case we want to have two:
origin)upstream)How to make a private fork from github to gitlab
| import functools | |
| def memoize(fn): | |
| known = dict() | |
| @functools.wraps(fn) | |
| def memoizer(*args): | |
| if args not in known: | |
| known[args] = fn(*args) |
| # encoding: utf-8 | |
| """ | |
| The Decorator Pattern | |
| Use Cases: | |
| • Caching | |
| • Logging | |
| • Monitoring | |
| • Debugging | |
| • Business rules |
| import unittest, os, os.path, sys, urllib | |
| import tornado.database | |
| import tornado.options | |
| from tornado.options import options | |
| from tornado.testing import AsyncHTTPTestCase | |
| # add application root to sys.path | |
| APP_ROOT = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) | |
| sys.path.append(os.path.join(APP_ROOT, '..')) |
| /** | |
| * Go to "Atom" => "Stylesheet..." | |
| * Add this below | |
| **/ | |
| atom-text-editor::shadow { | |
| /** | |
| * Open your Atom settings and under "Editor Settings" change your | |
| * "Invisbles Tab" field to a single space (" "). | |
| * Otherwise you will see both tab indicators. | |
| */ |
| package main | |
| // Restorer holds a function that can be used | |
| // to restore some previous state. | |
| type Restorer func() | |
| // Restore restores some previous state. | |
| func (r Restorer) Restore() { | |
| r() | |
| } |
| # install docker | |
| apt-get update | |
| apt-get install -y --force-yes apt-transport-https ca-certificates | |
| apt-key adv --keyserver hkp://p80.pool.sks-keyservers.net:80 --recv-keys 58118E89F3A912897C070ADBF76221572C52609D | |
| # edit /etc/apt/sources.list.d/docker.list | |
| vi /etc/apt/sources.list.d/docker.list | |
| deb https://apt.dockerproject.org/repo ubuntu-trusty main | |
| apt-get update |
| package main | |
| import ( | |
| "log" | |
| "net/mail" | |
| "encoding/base64" | |
| "net/smtp" | |
| "fmt" | |
| "strings" |