[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

[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

Tự động đổi chế độ năng lượng (power plan) trên laptop Windows

Auto switching power plan mode on Windows laptop

Mình muốn chiếc laptop chạy Windows tự động chuyển chế độ năng lượng (power plan) tùy vào điều kiện có đang cắm sạc hay không, điều kiện như sau:

  • Nếu không cắm sạc, power plan ở chế độ Balance
  • Nếu có cắm sạc, power plan ở chế độ Performance / Plugged in

Bài viết này sẽ giúp bạn thực hiện yêu cầu trên một cách tự động với các công cụ có sẵn của Windows.

Deal with DHCP Server IP Exhausted

Recently, I have a problem with DHCP Server service run on Windows Server 2003 that use full ip address ranges, alot of IP used by strange mac address (3139…, longer than 12 charater) with type DHCP/BOOTP, even my DHCP server have mac address filter add-in and assign IP option is DHCP only. No special info in event log, Google return no clear root cause and solution.