0%

Overview

Ansible is an open source IT automation engine that automates provisioning, configuration management, application deployment, orchestration, and many other IT processes.

basic arch

Ansible works by connecting to your nodes and pushing out small programs—called modules—to these nodes. Modules are used to accomplish automation tasks in Ansible. These programs are written to be resource models of the desired state of the system. Ansible then executes these modules and removes them when finished.

Read more »

Overview

systemd is a Linux initialization system and service manager that includes features like on-demand starting of daemons, mount and automount point maintenance, snapshot support, and processes tracking using Linux control groups. systemd provides a logging daemon and other tools and utilities to help with common system administration tasks.

Read more »

SPICE VNC RDP
BIOS screen display can can Can’t
Full color support can can can
Change resolution can can can
Multi-display Multi-monitor support (up to 4 screens) Only one screen Multi-monitor support
Image transmission Image and graphics transmission Image transmission Image and graphics transmission
Video playback support GPU acceleration support Can’t GPU acceleration support
Audio transmission Two-way voice can be controlled Can’t Two-way voice can be controlled
Mouse control Both client and server can be controlled Server-side control Server-side control
USB transfer USB can be transmitted over the network Can’t USB can be transmitted over the network

Ref

-

std

strings

Package strings implements simple functions to manipulate UTF-8 encoded strings.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
- func Contains(s, substr string) bool
- func ContainsAny(s, chars string) bool any Unicode code points in chars are within s.
- func Count(s, substr string) int

- func Fields(s string) []string splited by whitespace

- func HasPrefix(s, prefix string) bool whether the string s begins with prefix.
- func HasSuffix(s, suffix string) bool

- func Index(s, substr string) first instance of substr in s, or -1 if substr is not present in s.
- func IndexAny(s, chars string) int
- func LastIndex(s, substr string) int
- func LastIndexAny(s, chars string) int

- func Join(elems []string, sep string) string
- func Split(s, sep string) []string any separator!!!

- func Map(mapping func(rune) rune, s string) string
//Map returns a copy of the string s with all its characters modified according to the mapping function. If mapping returns a negative value, the character is dropped from the string with no replacement.**
- func Replace(s, old, new string, n int) string
- func ReplaceAll(s, old, new string) string

- func ToLower(s string) string
- func ToUpper(s string) string
- func Trim(s, cutset string) string
// // Trim returns a slice of the string s with all leading and trailing Unicode code points contained in cutset removed
- func TrimLeft(s, cutset string) string
//returns a slice of the string s with all leading Unicode code(check one by one) points contained in cutset removed.**
- func TrimRight(s, cutset string) string
- func TrimSpace(s string) string

- func TrimSuffix(s, suffix string) string
- func TrimPrefix(s, prefix string) string

//prefix as a whole to check

- func TrimSpace(s string) string
//TrimSpace returns a slice of the string s, with all leading and trailing white space removed, as defined by Unicode.

Note

  • Trim, TrimLeft, TrimRight, check ‘each character’ in the cutset
  • TrimSuffix, TrimPrefix check ‘suffix and prefix’ as a whole not a set”
Read more »

Advanced

struct

tags

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package main

import (
"fmt"
"reflect"
)

type Person struct {
Name string `k1:"v1" k2:"v2"`
}

func main() {
var p Person
tp := reflect.TypeOf(p)
for i := 0; i < tp.NumField(); i++ {
f := tp.Field(i)
fmt.Println(f.Tag.Get("k1"))
fmt.Println(f.Tag.Get("k2"))
}
}
main()
v1
v2

Rules for writing tag

Read more »

Overview

socket

There are two popular tools for inspecting the socket states (netstat and ss)

netstat gets its information from /proc/net directly. It parses the file and prints out information based on it.

ss was written more recently to use the netlink API (it will fall back to proc/net if netlink is unavailable). The information in both systems is essentially the same, but netlink API exposes more information than procfs. so try to use ss for socket stats if it’s available.

NOTE: netstat provides other info except socket statistics, like routing table etc.

Read more »

Overview

A content delivery network (CDN) is a group of servers set up in different locations worldwide to provide web content over a wide geographic area much faster.

CDN, also known as “distribution networks,” offers several points of presence (PoP) outside the origin server. This enables websites to better manage traffic by handling user requests more quickly, providing an overall better experience.

In short, you’re using a CDN every time you visit a high-traffic site such as Amazon or catch up with your friends on Facebook. Their data centers keep allows to bring such content much more quickly regardless of the geographic location of individual users or the main website server.

By spreading the delivery systems out over a large area, websites can reduce bandwidth consumption and page load times, shaving precious seconds off the time it takes to handle multiple user requests.

Read more »

Overview

The NUMA-aware architecture is a hardware design which separates its cores into multiple clusters where each cluster has its own local memory region and still allows cores from one cluster to access all memory in the system. However, if a processor needs to use memory that is not its own memory region, it will take longer to access that (remote) memory. For applications where performance is crucial, preventing the need to access memory from other clusters is critical.

  • A socket refers to the physical location where a processor package plugs into a motherboard. The processor that plugs into the motherboard is also known as a socket.
  • A core is an individual execution unit within a processor that can independently execute a software execution thread and maintains its execution state separate from the execution state of any other cores within a processor.
  • A thread refers to a hardware-based thread execution capability. For example, the Intel Xeon 7560 has eight cores, each of which has hardware that can effectively execute two software execution threads simultaneously, yielding 16 threads.
1
2
3
4
5
6
7
8
9
10
11
12
$ lscpu 
Architecture: aarch64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 128
On-line CPU(s) list: 0-127
Thread(s) per core: 1
Core(s) per socket: 128
Socket(s): 1
NUMA node(s): 2
Vendor ID: ARM
...
Read more »