Install the netcat nc
command with Homebrew (otherwise Mac OS X version is really old and the interface is different):
brew install netcat
Use netcat to listen for incoming TCP connections on port 3000:
nc -l -p 3000
root = true | |
[*] | |
indent_size = 2 | |
charset = utf-8 | |
end_of_line = lf | |
indent_style = tab | |
insert_final_newline = true | |
trim_trailing_whitespace = true |
def calculate_aspect(width: int, height: int) -> str: | |
def gcd(a, b): | |
"""The GCD (greatest common divisor) is the highest number that evenly divides both width and height.""" | |
return a if b == 0 else gcd(b, a % b) | |
r = gcd(width, height) | |
x = int(width / r) | |
y = int(height / r) | |
return f"{x}:{y}" |
Install the netcat nc
command with Homebrew (otherwise Mac OS X version is really old and the interface is different):
brew install netcat
Use netcat to listen for incoming TCP connections on port 3000:
nc -l -p 3000
import time | |
from http.server import BaseHTTPRequestHandler, HTTPServer | |
HOST_NAME = 'localhost' | |
PORT_NUMBER = 9000 | |
class MyHandler(BaseHTTPRequestHandler): | |
def do_HEAD(self): | |
self.send_response(200) |
When building a service, we have a responsibility to define some baseline agreements as to the service’s expected uptime and performance. This document focuses on the various terminology that we use to define these values.
Service Level Indicator (SLI)
What the service owner has chosen to measure progress towards their goal.
Service Level Objective (SLO)
What the service owner’s goal is for the given indicator.
Specify and test one point of the contract of single method of a class. This should have a very narrow and well defined scope. Complex dependencies and interactions to the outside world are stubbed or mocked.
Test the correct inter-operation of multiple subsystems. There is whole spectrum there, from testing integration between two classes, to testing integration with the production environment.
Look at the following image...
...it shows an object being tested.
You can't see inside the object. All you can do is send it messages. This is an important point to make because we should be "testing the interface, and NOT the implementation" - doing so will allow us to change the implementation without causing our tests to break.
# copy src directory into the destination directory | |
# i.e. you'll end up with compute/src/... | |
cp -r src ~/Code/rust/compute/ | |
# copy the 'files' from the src directory into the destination directory | |
# i.e. you'll end up with compute/... | |
# | |
# NOTICE the subtle difference! a trailing slash on src/ will | |
# copy the files within that directory rather than the directory as a whole. | |
cp -r src/ ~/Code/rust/compute/ |
Reference: http://perfectionkills.com/understanding-delete/
There are 3 types of executable code in ECMAScript:
When ECMAScript code executes, it always happens within a certain execution context.
NOTE: Guide to
net/http
timeouts
Also, here are some Transport settings you might want.
Although not explicitly stated, DNS resolution appears to be taken into consideration as part of the overall http.Client.Timeout
setting. If you need to set your own DNS timeout, then it seems https://github.com/miekg/dns is a popular solution.
Additionally, it's important to realise how golang resolves hostnames to IPs (i.e. DNS resolution):
https://golang.org/pkg/net/#hdr-Name_Resolution