Skip to content

Instantly share code, notes, and snippets.

@Jipok
Jipok / backup.sh
Created March 7, 2025 09:45
Backup HOME with restic, exclude trash, caches and other useless data
#!/usr/bin/env bash
echo -e "\033[0;32mПароль в keepass под именем restic\033[0m"
# Each element is the exclusion path
excludes=(
"$HOME/.local" # Local configuration and application files
"$HOME/.cache" # Temporary cache files
"$HOME/Downloads" # Downloads folder
import os
#flag -I/usr/include
#include <sys/socket.h>
#include <sys/un.h>
#include <unistd.h>
#include <string.h>
// Объявляем необходимые C функции и структуру
fn C.socket(domain int, type_ int, protocol int) int
@Jipok
Jipok / dark.js
Last active January 21, 2025 19:17
// ==UserScript==
// @run-at document-body
// ==/UserScript==
(function() {
'use strict';
const darkModeCSS = `
html {
filter: invert(90%) hue-rotate(180deg) !important;
@Jipok
Jipok / jsv.sh
Created December 6, 2024 19:30
Automaticly create tmux service for runit for each linux user
#!/usr/bin/env bash
USERS_DIR="/home"
SERVICES_DIR="/etc/sv"
RUNIT_DIR="/var/service"
create_tmux_service() {
user="$1"
service_name="tmux-${user}"
service_dir="${SERVICES_DIR}/${service_name}"
@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 January 26, 2025 04:27
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