This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
To limit to 20% of 1 CPU | |
$ podman run --cpu-quota=20000 <IMAGE> # shares of --cpu-period, default 100000 | |
$ systemd-run --user --scope -u your-scope-name.scope -p CPUQuota='20%' <CMD> | |
Manually: | |
1) create a directory (new cgroup) in /sys/fs/cgroup | |
- ideally under some existing cgroup if applicable | |
- directory might differ: see `mount|grep cgroup2` - you can mount it by yourself if it's missing | |
2) write "cpu" to underlying cgroup.controllers (all higher cgroups must have that as well) | |
3) write "20000 100000" into cpu.max (it's share and granularity) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# some useful notes | |
# - -F does not work in compgen, so does many of -o args | |
# - docs about competion: `info bash`, last three chapters of "Command Line Editing" | |
# - bash-completions helpers are not very well documented | |
# - -G is useless, somehow it does not trigger filling the command line, use -A file -X "!<glob>" | |
# example/template using bash-completion helpers | |
# Assigned variable by _init_completion. | |
# cur Current argument. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# substitute the default terminal for one of your choosing | |
[[ -z $TERMINAL ]] && TERMINAL=alacritty | |
# if there is an any parameter added, sleep after the evaluation | |
[[ -n $1 ]] && SUFFIX="; sleep 2" | |
if [[ ! -t 1 ]]; then | |
$TERMINAL -e sh -c "bash ${BASH_SOURCE[1]}${SUFFIX}" | |
exit 0 | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![no_std] | |
#![no_main] | |
// requires: | |
// [profile.dev] | |
// panic = "abort" | |
// [profile.release] | |
// panic = "abort" | |
// | |
// [dependencies.libc] | |
// version = "0.2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# This work is licensed under the Creative Commons Public Domain Mark 1.0 License. To view a copy of | |
# this license, visit http://creativecommons.org/publicdomain/mark/1.0/ or send a letter to Creative | |
# Commons, PO Box 1866, Mountain View, CA 94042, USA. | |
# usage ./readini.sh <file> <block> <key> | |
# returns a value of a key in ini file, or nothing if not found | |
if [ "$1" = "" ] || [ "$2" = "" ] || [ "$3" = "" ]; then | |
echo "insufficient parameters" 1>&2 |