Skip to content

Instantly share code, notes, and snippets.

View wamonite's full-sized avatar

Warren Moore wamonite

View GitHub Profile
@wamonite
wamonite / processes_by_oom_score.sh
Last active August 8, 2023 13:50
find one-liner to list processes by their oom_score
#!/usr/bin/env bash
find /proc/ -maxdepth 2 -name oom_score -exec bash -c 'pid=$(cut -d '/' -f 3 <<< $1) ; echo -n "$pid " ; cat /proc/$pid/oom_score | tr "\n" " " ; head -n 1 /proc/$pid/cmdline | tr "\000" " " ; echo' func {} \; 2> /dev/null | sort -k2nr -k1nr
@wamonite
wamonite / mp.py
Created August 2, 2017 13:44
Python multiprocessing return value and timeout example
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Python multiprocessing return value and timeout example
"""
from __future__ import print_function
import argparse
import sys
import multiprocessing
@wamonite
wamonite / piot_test.py
Created February 24, 2017 19:11
ModMyPi PiOT example code
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# https://www.modmypi.com/raspberry-pi/breakout-boards/modmypi/modmypi-piot-relay-board
from __future__ import print_function, unicode_literals
import sys
import RPi.GPIO as GPIO
import time