This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package timestamp | |
| import ( | |
| "fmt" | |
| "labix.org/v2/mgo/bson" | |
| "strconv" | |
| "time" | |
| ) | |
| type Timestamp time.Time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import Queue | |
| import threading | |
| class WorkerThread(threading.Thread): | |
| def __init__(self, q): | |
| super(WorkerThread, self).__init__() | |
| self q = q | |
| self.exception = None | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package main | |
| import ( | |
| "errors" | |
| ) | |
| var ( | |
| // ErrNotFound is returned when something isn't found | |
| ErrNotFound = errors.New("not found") | |
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyHTTPClientTest extends AndroidTestCase { | |
| private MockWebServer mServer; | |
| private MyHTTPClient mClient; | |
| public void setUp() throws Exception { | |
| mServer = new MockWebServer(); | |
| mServer.play(); | |
| mClient = new MyHTTPClient(mServer.getUrl("/")); | |
| } | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class MyHTTPClient { | |
| private URL mUrl; | |
| public MyHTTPClient(URL url) { | |
| mUrl = url; | |
| } | |
| public String getString() throws IOException { | |
| HTTPUrlConnection urlConnection = null; | |
| URL url = new URL(mUrl, "/string"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| node.js (version 0.8.18): | |
| ------------------------- | |
| var http = require('http'); | |
| http.createServer(function (req, res) { | |
| res.writeHead(200, {'Content-Type': 'text/plain'}); | |
| res.end('Hello World\n'); | |
| }).listen(1337, '127.0.0.1'); | |
| console.log('Server running at http://127.0.0.1:1337/'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| global | |
| maxconn 4096 | |
| daemon | |
| defaults | |
| mode http | |
| frontend insecure | |
| # HTTP | |
| bind :80 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| backend nginx { | |
| .host = "127.0.0.1"; | |
| .port = "8080"; | |
| } | |
| backend node1 { | |
| .host = "127.0.0.1"; | |
| .port = "3000"; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/sh | |
| GIT_WORK_TREE=/home/ubuntu/myapp git checkout -f | |
| echo "Installing dependencies..." | |
| cd /home/ubuntu/myapp | |
| npm install | |
| echo "Restarting node.js..." | |
| sudo restart myapp |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| check host localhost with address 127.0.0.1 | |
| start "/sbin/start myapp" | |
| stop "/sbin/stop myapp" | |
| if failed port 3000 protocol HTTP | |
| request / | |
| with timeout 5 seconds | |
| then restart |
NewerOlder