To me, legacy code is simply code without tests. I’ve gotten some grief for this definition. What do tests have to do with whether code is bad? To me, the answer is straightforward, and it is a point that I elaborate throughout the book: Code without tests is bad code. It doesn’t matter how well written it is; it doesn’t matter how pretty or object-oriented or well-encapsulated it is. With tests, we can change the behavior of our code quickly and verifiably. Without them, we really don’t know if our code is getting better or worse.
Four Reasons to Change Software: For simplicity’s sake, let’s look at four primary reasons to change software.
Picking the right architecture = Picking the right battles + Managing trade-offs
- Clarify and agree on the scope of the system
- User cases (description of sequences of events that, taken together, lead to a system doing something useful)
- Who is going to use it?
- How are they going to use it?
FWIW: I'm not the author of the content presented here (which is an outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.
- By Edmond Lau
- Highly Recommended 👍
- http://www.theeffectiveengineer.com/
# Assuming an Ubuntu Docker image | |
$ docker run -it <image> /bin/bash |
- Install docker
- Install shadowsocks and v2ray then set deamon.json for docker
- **in ROOT user => ** export http_proxy=socks5://127.0.0.1:7788 https_proxy=socks5://127.0.0.1:7788 => refrence
and in
/etc/environment
add this line:
export http_proxy=socks5://127.0.0.1:7788
export https_proxy=socks5://127.0.0.1:7788
install npm and add http-proxy-to-socks package to convert socks<->http(s)
Use docker inspect
is different in swarm
mode and normal
mode if you wnat to use it in swarm
mode:
-
Manager nodes: use this command for services. (but if you want to see healthceck logs of specific container see worker nodes section):
docker inspect --format "{{json .Spec.TaskTemplate.ContainerSpec.Healthcheck }}" hinava_dashboard |jq
-
Worker nodes: you should use complete name of the container that completed with
<tab>
key
docker inspect hinava_filebeat.1.umvobmm9wrjdz1b08y5jibvl2 | grep -B 10 -A 10 "health"
GREEN='\033[0;32m' | |
NC='\033[0m' # No Color | |
function goto() { | |
program="bash" | |
if [ -n "$2" ] | |
then | |
program="$2" | |
fi | |
if [ $(docker ps -q --filter "name=$1" | wc -l) -gt 1 ] |
function require(e,t,n){var i=require.resolve(e);if(null==i){n=n||e,t=t||"root";var a=new Error('Failed to require "'+n+'" from "'+t+'"');throw a.path=n,a.parent=t,a.require=!0,a}var r=require.modules[i];return r.exports||(r.exports={},r.client=r.component=!0,r.call(this,r.exports,require.relative(i),r)),r.exports}var has=Object.prototype.hasOwnProperty;require.modules={},require.aliases={},require.resolve=function(e){for(var t=e+"/index.js",n=[e,e+".js",e+".json",e+"/index.js",e+"/index.json"],i=0;i<n.length;i++){var e=n[i];if(has.call(require.modules,e))return e}return has.call(require.aliases,t)?require.aliases[t]:void 0},require.normalize=function(e,t){var n=[];if("."!=t.charAt(0))return t;e=e.split("/"),t=t.split("/");for(var i=0;i<t.length;++i)".."==t[i]?e.pop():"."!=t[i]&&""!=t[i]&&n.push(t[i]);return e.concat(n).join("/")},require.register=function(e,t){require.modules[e]=t},require.alias=function(e,t){if(!has.call(require.modules,e))throw new Error('Failed to alias "'+e+'", it does not exist');requir |
As configured in my dotfiles.
start new:
tmux
start new with session name: