1. upgrade to jest 28 The main dependencies and versions of jest in package.json after the upgrade are as follows. 1 2 3 4 5 6 7 8 9 10 { "devDependencies": { "@jest/types": "^28.1.1", "@types/jest": "^28.1.1", "jest": "^28.1.1", "jest-environment-jsdom": "^28.1.1", "jest-extended": "^2.0.0", "ts-jest": "^28.0.5", } } Compared to the dependencies associated with jest@27, you need to add the jest-environment-jsdom library dependency separately if you need a jsdom execution environment,
Extending Grafana Loki with Read-Write Separation Patterns
Built from multiple microservice components that can run as a horizontally scalable distributed system, Loki is uniquely designed to compile the code of an entire distributed system into individual binaries or Docker images, with the behavior of the individual binaries controlled by the -target command line flag.
Standalone mode The simplest mode of operation is to set -target=all, which is the default way and does not need to be specified. This is the monolithic mode, which runs all of Loki’s microservice components in a single process in the form of a single binary or Docker image.
Talking about Go's two soon-to-be-obsolete GC optimization strategies
This article was supposed to talk about how Go Memory Ballast and Go GC Tuner adjust GC, how they are implemented, and how they work. But in the process of writing it, I found out that Go 1.19 is out and there is a new feature that makes these two optimizations history after all. Overview First let’s take a brief look at what is done in Go GC and what
What is mock testing and the use of gomock
What is mock testing In normal unit testing, you often rely on external systems, which makes it difficult to write unit tests. For example, if there is a function UpdateUserInfo in the business system to update user information, if you do unit tests on this function, you need to connect to the database, create the base data needed for the test, then execute the test, and finally clear the data update caused by the test.
From Reactive programming to Combine Practices
This article will introduce the concepts and best practices of Combine from the basic idea of reactive programming and step by step, hoping to help more people to get started and practice reactive programming successfully. Reactive Programming In computing, reactive programming is a declarative programming paradigm oriented to data flow and change propagation. –wiki Declarative Programming Declarative and imperative programming are common programming paradigms. In imperative programming, the developer makes
In-depth understanding of eBPF|7 core issues you need to know
Over the past year, ARMS has built Kubernetes monitoring based on eBPF technology, providing multi-language non-intrusive application performance, system performance, and network performance observation capabilities, validating the effectiveness of eBPF technology. eBPF technology and ecology are developing well, and the future prospects are vast. As a practitioner of this technology, the goal of this paper is to introduce eBPF technology by answering 7 core questions itself, to unravel the eBPF
New vulnerabilities found in Intel, AMD CPUs! Hackers can steal encryption keys through "Hertzbleed" attack|x86 CPU power saving mode are hit
On Tuesday, researchers discovered a new vulnerability in microprocessors from Intel, AMD and other companies that targets the power-conservation mode on nearly all modern CPUs and can be exploited by remote attackers to steal cryptographic keys through a power-side channel attack.
A group of researchers from the University of Texas, the University of Illinois at Urbana-Champaign and the University of Washington named this attack Hertzbleed, which centers on dynamic voltage and frequency scaling (DVFS), the power and thermal management function used to conserve energy and reduce heat generated by the chip.
Debian 11 Unattended Automatic Update System
This article will guide you on how to set up unattended automatic system updates under Debian 11.
Preparation Unless you are a physical server, and a VPS or cloud host with a KVM architecture that has not used an oddly customized or modified kernel, there is a certain chance that upgrading the system to update the kernel will cause the Grub load to fail.
Remember to back up your important data!
Goodbye, IE
A year ago, Microsoft announced that IE would be officially retired today, and now the clock is ticking towards the last second, and the IE era has officially come to an end.
Goodbye, Internet Explorer!
We have selected the noteworthy historical events since the birth of IE. We hope it will give you a glimpse of memories.
On August 16, 1995, the first version of Internet Explorer (known as Internet Explorer 1) debuted as a software package for Windows 95.
Suggestions for error handling in Golang
1. Overview Golang’s error handling has been a topic of much discussion. When I first started working with Golang, I read some documentation about error handling, but I didn’t really care about it. After using Golang for a while, I felt that I might not be able to ignore this issue. So, this article is mainly to organize some common error handling tips and principles in Golang.
2. Techniques and principles of error handling 2.
Interpreting go's panic messages
Overview As a programmer who writes a lot of go, I’m sure you see panic messages from go from time to time. Usually we can easily locate the number of lines of code in error based on the message, but because of this reason, we often overlook other information. This article is to analyze how to understand the error message output when go program panic?
Analysis by example We start with a very simple example below.
Learning IPv6
Overview IPv6 is called Internet Protocol Version 6, but although it is called Version 6, it is actually the second generation standard protocol of network layer protocol. The main reason for its emergence is to solve some shortcomings of IPv4 in practical application scenarios. Comparison of advantages and disadvantages with IPv4 Issues IPv4 Defects IPv6 Advantages Address Space IPv4 addresses are only 32 bits, so the total number of addresses
Python Generics
One of the new features of Python 3.10 is TypeAlias. The example given is as follows.
1 2 StrCache = 'Cache[str]' # a type alias LOG_PREFIX = 'LOG[DEBUG]' # a module constant It can be written as.
1 2 StrCache: TypeAlias = 'Cache[str]' # a type alias LOG_PREFIX = 'LOG[DEBUG]' # a module constant This makes StrCache more of a type alias than a string variable that clearly looks like Cache[str] (which it is).
Solve the problem that Prometheus can't collect data
Before the eBPF-based next-generation observation facility was mature, we used the industry-established Prometheus+Grafana scheme to collect node and application metrics. Such a scheme is known to be invasive to the application, i.e., it requires a client package embedded inside the application to collect metrics and communicate with Prometheus.
Prometheus officially provides and maintains client packages for major languages, including Go, Java, Python, Ruby, Rust, etc., as follows.
The go client side of Prometheus is not too complicated to use and consists of two steps.
AlloyDB's Storage Layer Analysis
At the Google I/O 2022 conference, Google Cloud released AlloyDB, a cloud-native database compatible with PostgreSQL standard, which claims to be twice as fast as its Amazon counterpart (Aurora?). This slogan should not be enough for old users to migrate, but for new users, it does have some appeal.
Since I mainly do storage, here’s a breakdown of AlloyDB storage based on this Google article introducing the AlloyDB storage layer blog post, I will analyze the AlloyDB storage architecture and see what the highlights of its design are.
Configuring React + TypeScript Development Environment
Create React project https://create-react-app.dev/docs/adding-typescript/.
Create a React + TypeScript project using the following command.
1 yarn create react-app my-app --template typescript For resource referencing purposes, add the baseUrl attribute to tsconfig.json.
1 2 3 4 5 { "compilerOptions": { "baseUrl": "src", "target": "es5", ... Configure ESLint and Prettier Install ESLint 1 yarn add -D eslint ESLint is a code checking tool to check whether your code conforms to a specified specification.
Use native Windows Docker containers
When it comes to Docker containers, according to the usual thinking, that is Linux containers (LXC), not much to do with Windows, at best, is to run Docker containers in the Windows Linux virtual machine.
However, since Windows Server 2016, there are Windows-native Docker containers, which are no longer just for Linux, and Docker containers can now run Windows systems, with each Windows container sharing the host Windows kernel (–isolation= process,) or use a Windows kernel in a highly optimized virtual machine (–isolation=hyperv).
Traversing folders with Bash
1. Overview It is often necessary to use bash to batch process file formats, and it is troublesome to query some basic syntax every time.
So this article summarizes some common syntax when using Bash to traverse a folder directory to process images as an example.
2. Iteration Bash traversal is relatively simple and not significantly different from the for loops of most programming languages.
1 2 3 4 5 6 7 8 9 10 #/bin/sh #author: chancel.
Linux Eventfd
eventfd definition The eventfd() function creates an “eventfd object” that can be used by the user-state program as an event waiting/notification mechanism and the kernel can notify the user-state program of the event.
1 2 #include <sys/eventfd.h> int eventfd(unsigned int initval, int flags); Initialization parameters initval The eventfd object contains a uint64_t counter, which is saved by the kernel. The value of this counter can be initialized by the initval parameter when initializing eventfd.
One letter less, multiple PyPI packages introduce malicious dependencies
According to a recent report by BleepingComputer, several PyPI packages have been found to contain backdoors due to malicious request dependencies in some versions of these packages, including pyanxdns, api-res-py, and keep.
Keep, for example, uses the legitimate Python module requests for HTTP requests, but keep v.1.2 includes a module named request (note: the latter is missing the letter s at the end), and request without the letter s is considered a malicious dependency, although there is only a one-letter difference.