Skip to content

Instantly share code, notes, and snippets.

View kobus-v-schoor's full-sized avatar

Kobus van Schoor kobus-v-schoor

View GitHub Profile
#! /usr/bin/env python3
import json
import sys
import os
import mmap
from tqdm import tqdm
log = sys.argv[1]
step = 2 if len(sys.argv) <= 2 else int(sys.argv[2])
import time
from functools import lru_cache, wraps
def ttl_cache(ttl=600):
def outer(func):
@lru_cache
def inner(*args, ttl, **kwargs):
return func(*args, **kwargs)
@wraps(func)
[Service]
Environment=STARTUP_WAIT=30s
ExecStart=/home/kobus/.local/bin/power_monitor.sh
[Install]
WantedBy=default.target
#! /bin/bash
BAT=$(echo /sys/class/power_supply/BAT*)
BAT_STATUS="$BAT/status"
BAT_CAP="$BAT/capacity"
LOW_BAT_PERCENT=20
AC_PROFILE="performance"
BAT_PROFILE="balanced"
LOW_BAT_PROFILE="power-saver"
app-id: org.openhantek.OpenHantek
runtime: org.kde.Platform
runtime-version: "5.15"
sdk: org.kde.Sdk
command: OpenHantek
finish-args:
- --socket=wayland
- --device=dri
rename-desktop-file: OpenHantek.desktop
rename-icon: OpenHantek
#! /bin/bash
# A Pacemaker resource agent that runs LXC containers using Ceph as a storage
# backend.
# Place in /usr/lib/ocf/resource.d/custom to use with your Pacemaker
# installation
LXC="/var/lib/lxc"
# Init OCF
import argparse
import socket
import socketserver
import json
import logging
from ipaddress import ip_address, IPv4Network
# parse command-line arguments
#! /bin/bash
# get icc cpu usage
cpu=$(ps -C ICC -o %cpu | tail -n 1 | sed 's/\..*//g')
# compare with threshold
THRESHOLD=50
if [[ $cpu -gt $THRESHOLD ]]; then
# kill ICC
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.