Skip to content

Instantly share code, notes, and snippets.

@hplc
hplc / kill_slow_mysql_query.sh
Created April 1, 2020 12:34
Kill slow mysql query.
#!/bin/sh
cmd="mysql -uusername -ppassword";
$cmd -e 'show processlist\G' |\
egrep -b5 'Time: [0-9]{2,}' |\
grep 'Id:' |\
cut -d':' -f2 |\
sed 's/^ //' |\
while read id
@hplc
hplc / Kid_Monitor.py
Last active September 17, 2023 11:56
Monitor Kid using computer, just let kid using some limited programs, close other browsers. If the kid switch window, then make sound to alerm. Works for Windows system.
# To run this program in backgorund, run it on command line: pythonw Kid_Monitor.py
# SoundVolumeView.exe is a simple tool for Windows that adjust system volume level.
# Can be downloaded from https://www.nirsoft.net/utils/sound_volume_view.html.
import win32gui
import time
import winsound
import os
i = 0
while i<=1: