Convert Postgres data to CSV format

The Postgres conversion function is often used to instantly help PMs understand the actual status of current users and to record common commands underneath. First install the Postgres environment, this side is actually the way to use Docker to start a new Postgres DB. 1 2 3 4 5 6 7 8 9 10 11 12 13 db: image: postgres:12 restart: always volumes: - pg-data:/var/lib/postgresql/data logging: options: max-size: "100k" max-file: "3" environment: POSTGRES_USER: db POSTGRES_DB: db POSTGRES_PASSWORD: db The environment parameter above can be freely adjusted, and then the database can be started for app streaming via docker-compose up -d.

Three Ways to Manage Concurrency in Golang

When you enter the world of Go Language, you must be attracted by the powerful Concurrency, which can be used to drop tasks into the background with the simplest keyword go, but how to control Concurrency efficiently is a must-learning for Go language. This article introduces three ways to get acquainted with Concurrency, which correspond to three different terms: WaitGroup, Channel, and Context. WaitGroup Suppose you have two machines that need to upload the latest code at the same time, and the last restart step can be executed only after the two machines have finished uploading separately.

How to limit concurrency in Golang?

I recently saw a very hotly debated article, “Concurrency is still not easy”, which even made it to Hack News. If you are interested, you can take a look at it, and this article will use a real-life example to introduce why the author says that writing Concurrency is not so easy. As you know, in Go Language, you can write Concurrency easily by using the keyword go, but multiple Goroutines need to communicate by channel.

Go 1.16 Introducing Embedding Files

The Go Language official maintenance team, rsc, previously proposed in the GitHub Issue to support Embedding files directly in the go command line. Files, I didn’t expect that in a few months, it was directly implemented, and in the 2021 go 1.16 version directly support embed package. With this feature, static files or project configuration files can be wrapped up directly, which makes deployment easier. Here’s how to use it officially.

Windows high-risk 0day vulnerability: "Follina"

The Microsoft Windows Support Diagnostic Tool (MSDT) for Windows has been exposed to a high-risk 0day vulnerability, codenamed “Follina,” that could be used to remotely execute code on Windows systems. The vulnerability was first discovered and reported to Microsoft by a Shadow Chaser Group researcher in April, and proved to have been exploited by hackers in an attack. The researcher said Microsoft initially marked the vulnerability as not a “security-related issue”, but later closed the vulnerability submission report citing the existence of a remote code execution vulnerability.

Instant Performance Analysis Tool Pyroscope

When the website is online, the increase of traffic or temporary function failure will cause the user experience is quite bad, and how to find the bottleneck of performance quickly? Usually when the CPU is rushed to 100%, it is sometimes quite difficult to replicate and find out the key problem points. This article will introduce a set of tools called pyroscope, which allows developers to quickly find the code of performance bottlenecks.

Why does signal.Notify use buffered channel?

In this article, we will introduce to you why signal.Notify should use buffered channel. When we want to do graceful shutdown, we will use this function to shut down the service or connection normally. Through signal, we can detect the source of the signal and do the follow-up work (shut down DB connection, check if the job is finished … etc.). 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 package main import ( "fmt" "os" "os/signal" ) func main() { // Set up channel on which to send signal notifications.

Explore the Kubernetes API Schema

The word schema originates from the Greek word form or figure, but exactly how schema should be defined depends on the context of the application environment. There are different types of schema and their meanings are closely related to the fields of data science, education, marketing and SEO, and psychology. But schema in computing is actually very close to this interpretation, and the term schema can be found in many places, such as database, openldap, programming language, etc.

Lightweight open source alternative to Google Analytics - Umami

Umami is a simple, easy-to-use, self-hosted web analytics solution with the goal of providing you with a more user-friendly, privacy-focused alternative to Google Analytics and a free, open-source alternative to paid solutions. Umami collects only the metrics you care about, all on one page. Features Simple Analytics Umami measures only the important metrics you care about: page views, devices used, and where visitors are coming from. This data is presented on an easy-to-navigate page.

Linux free command usage and understanding

When using linux operating systems, it is a common requirement to check memory usage, for example, to analyze system health or to determine if the machine is ready to deploy more new services, etc. This is a common requirement. The solution to this problem is also very simple. Most cloud vendors provide consoles that display monitoring information for various machine metrics, and memory usage monitoring is definitely essential. For those who know a little bit about linux, you can also use the free command to view more detailed information.

How to get upload progress bar related data and implement Graceful Shutdown

Due to the project requirements, we need to develop a set of CLI tools so that users can upload large files for Model Training through the CLI, please refer to the flowchart above. The first step will be to verify the user with the API Server, and after the verification, we will start to upload the data to AWS S3 or other storage space. In addition to the upload process, the current upload progress (speed, progress and remaining time) should be uploaded to the API Server, and finally the user can see the upload progress data in real time through GraphQL Subscription in the Web UI.

The timing of new and make use in Go language

You must be familiar with new and make, but when to use new and when to use make, perhaps many new developers do not understand, this article will briefly note the differences between new and make and the timing of their use. Using the new keyword Go provides two ways to allocate memory, one is new and the other is make. These two keywords do different things and have different types of applications, which may cause some confusion for those who are just starting out, but the rules for using these two keywords are very simple.

Multiple ways to copy files and folders in nodejs

1. copyFile The copyFile() method has the simplest operation and can copy the file directly to the target directory. 1 fs.copyFile('./a.txt', './dist/b.txt'); Asynchronously copies src to dest. By default, if dest already exists, it is overwritten. No arguments are given to the callback function, except for a possible exception. Node.js does not guarantee the atomicity of the copy operation. If an error occurs after opening the target file for writing,

Hacking HCaptcha through simulated clicks

In the previous article we introduced ReCaptcha’s mock click crack tutorial, but in addition to ReCaptcha, there is another CAPTCHA that is very similar to ReCapacha’s verification process, called HCaptcha. ReCaptcha is Google’s, for some reason, we can not use ReCaptcha in China, so sometimes HCaptcha has become a better choice for some international sites. So today we’ll learn about HCaptcha and its simulated click cracking process. HCaptcha Let’s first

Gracefully shutting down services with docker-compose

You should have encountered that if the service still has jobs to be processed and the service is to be updated, you need to wait until all jobs are processed before you can stop the service. When the service receives a shutdown notification signal, it should stop accepting jobs first, and then wait for the worker to finish processing the jobs before stopping the service, and then go online again. How to stop the service by docker-compose is the focus of this article.

Building the smallest Python Docker container

Now is the era of containers, cooperation between teams must be packaged unified Docker Image to solve the problem of inconsistent environment, but the size of the container determines the time to deploy microservices, this article to introduce how to build the smallest Python container. If you need to collaborate across departments, Docker is definitely the best tool for you, so you don’t have to bother with the environment. The following Flask application shows how to write a Dockerfile.

Is the open source Drone CI/CD platform really free?

I have been implementing Drone CI/CD open source platform for many years, and many people would ask me, “Is Drone really free to use? How should I calculate the cost of using it for open source or importing it into my company’s internal team? Well, this article will take you to understand Drone used in open source or the internal team of the company need to pay attention to places, the official actually wrote a full page FAQ very detailed, the following is I organized a few points to you know.

Accelerate Sagemaker AI model training with AWS EFS or FSx Lustre

This article will introduce how to prepare the Dataset and integrate SageMaker before training AI models, and what problems and challenges are encountered in the process. The team provides an AI platform that allows users to upload their own Dataset to be used with the team’s internal default Dataset for AI model training, and then make the model available to users for download. Simply put, users only need to provide the Dataset and set the AI training parameters, and then they can get the final model for subsequent integration development.

Manage system programs with Supervisor

I’m sure you all have experience in managing Linux host processes and have used a variety of tools, but you are certainly no stranger to the Python version of Supervisor, which is a very useful tool. It can monitor different process states and can restart automatically. This article introduces the open source package “Supervisord” written in Go language, the author mentions why this tool is developed in Go language, the reason is simple.

Explore golang 1.18 generics features

Go has released version 1.18 not long ago. One of the most important features of 1.18 is generics. Before this release, the most criticized thing was that Go could not support multiple types as parameters, which caused a lot of repetitive code when writing packages. This article will teach you the basics of what generics are and how to use them. Using generic Let’s write a func to support a parameter, which can be of type int64 or float64, executed online