[Python] Graceful stop FFMPEG recording process on Windows

Problem

When we want to stop ffmpeg stream recording on Windows programmatically, these sollution will not work:

# asume p is the subprocess.Popen command call ffmpeg
os.kill(p.pid, signal.CTRL_C_EVENT)  # parent process get kill too, recording file is not playable
# or 
p.terminate()  # not good, recording file is not playable
# or
p.send_signal(signal.CTRL_C_EVENT) # parent process get kill too, recording file is not playable

[Learning] Should I define methods on values or pointers?

Stack Overflow: https://stackoverflow.com/questions/25382073/defining-golang-struct-function-using-pointer-or-not

Can someone explain to me why appending to an array works when you do this:

func (s *Sample) Append(name string) {
    d := &Stuff{
        name: name,
    }
    s.data = append(s.data, d)
}

But not when you do this:

func (s Sample) Append(name string) {
    d := &Stuff{
        name: name,
    }
    s.data = append(s.data, d)
}

Is there any reason at all why you would want to use the second example.

[Learning] Odoo super call dependency test

A test logs how Odoo process modules dependency with different install order

Test source code: https://github.com/NothingCtrl/odoo_super_dep_test

[BugFix] Python return incorrect MimeType for Js file under Windows 10

For unkown reason, python webserver return MimeType text/plain for all .js file when running under Windows 10

[Learning] The dangers of assert in Python (a.k.a know what you're doing!)

There are many ways to find bugs in Python code: the built-in debugger (pdb), a healthy amount of unit tests, a debugger in an IDE like Pycharm or Visual Studio, try/catch statements, if/else statements, assert statements, or the tried and true practice of covering every inch of your codebase in print() statements like it’s going out of style.

Assert statements can help us catch bugs quickly and are far less intrusive than copious amounts of print statements. However, unlike print statements, assert statements can be unexpectedly risky to use!

This article explores how to use asserts safely and what causes them to be unsafe. By the end of this article, you’ll know how to use assert most optimally without inadvertently opening yourself up to security issues.

[DiveIn] Deciphering Python: How to use Abstract Syntax Trees (AST) to understand code

Let’s get a little “meta” about programming.

How does the Python program (better know as the interpreter) “know” how to run your code? If you’re new to programming, it may seem like magic. In fact, it still seems like magic to me after being a professional for more than a decade.

The Python interpreter is not magic (sorry to disappoint you). It follows a predictable set of steps to translate your code into instructions that a machine can run.

Server / hosting benchmark backlog

Một số kết quả các dịch vụ hosting và in-house hosting

Benchmark script: curl -LsO bench.monster/speedtest.sh; bash speedtest.sh -asia