Skip to content

Instantly share code, notes, and snippets.

@Jipok
Jipok / amdgpu_power_control2.py
Created February 11, 2024 14:41
TUI with chart for radeon power cap control, temp monitoring. SIGSTOP python if overheated
#!/usr/bin/env python3
import plotext as plt
from subprocess import check_output
import psutil
import time
import math
CMD = "sensors amdgpu-pci-0500 | grep PPT | grep -oP '(?<=cap =) *(.?\d+)'"
TARGET_TEMP_MAX = 91
TARGET_TEMP_MIN = 87
@Jipok
Jipok / amdgpu-power-control.py
Last active February 3, 2024 06:57
TUI with chart for radeon power cap control, temp monitoring
#!/usr/bin/env python3
import plotext as plt
from subprocess import check_output
import psutil
import time
CMD = "sensors amdgpu-pci-0500 | grep PPT | grep -oP '(?<=cap =) *(.?\d+)'"
TARGET_TEMP = 83
CRITICAL_TEMP = 92
CAP_MIN = 2
@Jipok
Jipok / send.sh
Created October 7, 2023 15:25
Send messages to telegram via bash
#!/bin/bash
# Example: echo "Hello" | send.sh
#
message=$( cat )
apiToken=123456:ABC-DEF1234ghIkl-zyx57W2v1u123ew11
chatId=354339153 # Reciever ID
send() {
curl -s \
#!/usr/bin/env bash
export FZF_DEFAULT_OPTS="--reverse --info inline --no-clear"
export data=$(dirname $(realpath $0))/data
export list=/tmp/facts-list
export query=/tmp/facts-query
function xe() {
while read tmp; do
echo "$tmp" | xargs -n 1 -I [] bash -c "$@"
@Jipok
Jipok / mpd-notifications
Last active December 3, 2018 20:17
Show music info(with cover) for mpd. Will show gray cover, when paused
#!/bin/bash
expireTime="3200"
mpddir="$HOME/Music/"
defaultimage="$HOME/music.png"
update_cover() {
path=$mpddir$(mpc -f %file% current)
album=$(mpc -f %file% current)
ffmpeg -loglevel quiet -y -i "$path" /tmp/cover
@Jipok
Jipok / mpd-select
Last active December 18, 2018 18:08
Select mpd track via dmenu
#!/bin/sh
mpc -f "[[%artist% - ][%album% - ]%title%]|[%file%]" playlist | \
cat -n | sed "s/\t/: /" | \
cut -c 1-120 | dmenu -i | cut -d ':' -f 1 \
| xargs -r mpc play > /dev/null
@Jipok
Jipok / btrfs-undelete
Created November 13, 2017 16:11 — forked from Changaco/btrfs-undelete
btrfs-undelete
#!/bin/bash
# btrfs-undelete
# Copyright (C) 2013 Jörg Walter <info@syntax-k.de>
# This program is free software; you can redistribute it and/or modify it under
# the term of the GNU General Public License as published by the Free Software
# Foundation; either version 2 of the License, or any later version.
if [ ! -b "$1" -o -z "$2" -o -z "$3" ]; then
echo "Usage: $0 <dev> <file/dir> <dest>" 1>&2
echo
@Jipok
Jipok / diff.nim
Created September 27, 2017 11:50
import os, sets, strutils
if paramCount() != 2:
echo "mydiff file1 file2"
quit()
let file1 = open(paramStr(1))
let file2 = open(paramStr(2))
let old_lines = file1.readAll().splitLines()