Skip to content

Instantly share code, notes, and snippets.

View ms1995's full-sized avatar

Wenyu Wang ms1995

View GitHub Profile
@ms1995
ms1995 / parallel-cpuset.py
Last active March 24, 2022 22:52
Runs each command on a single, dedicated CPU. Useful when `isolcpus` is enabled and need to run many single-threaded programs.
import os
import sys
import concurrent.futures
import threading
import subprocess
import random
# Runs each command on a single, dedicated CPU.
# Useful when `isolcpus` is enabled and need to run many single-threaded programs.
CPUS = list(range(12, 24)) + list(range(36, 48))
import sys
import psutil
import random
CPUSET = [int(x) for x in sys.argv[1].split(',')]
PID = int(sys.argv[2])
threads = []
for p in psutil.Process(PID).children(recursive=True):
if 'qemu-system' in p.name():
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Python wrapper for Android uiautomator tool."""
import sys
import os
import subprocess
import time
import itertools
@ms1995
ms1995 / auto-rerun.sh
Last active May 26, 2018 22:19
Automatically re-run a process after it exits. Usage: auto-rerun.sh INTERVAL CMD [ARGS...]
#!/bin/bash
running=1
finish() {
running=0
}
trap finish SIGINT