This file contains 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
# Discrete Card as Primary GPU, internal Intel Card as Secondary | |
Section "ServerLayout" | |
Identifier "layout" | |
Screen 0 "nouveau" | |
Inactive "intel" # use *randr for config after login | |
EndSection | |
Section "Device" | |
Identifier "nouveau" |
This file contains 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 | |
# get temperature and on thresholds change system frequencies to lower or higher | |
# tested only on Orange Pi 3 LTS | |
TEMPPATH="/sys/devices/virtual/thermal/thermal_zone*" | |
TEMPFILENAME="temp" | |
TEMP_MAX=84000 | |
TEMP_MIN=77000 |
This file contains 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
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
This file contains 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
// (C) https://habr.com/ru/post/515018/#comment_21971060 | |
//Возвращаемый результат - 32 бита, т.к. для | |
//больших входных чисел вроде 65536*65536-1,-2,... | |
//с учетом максимальной ошибки по модулю не более 0.5 | |
//возвращаемый результат должен быть равен 65536, | |
//что не укладывается в 16 бит. | |
uint32_t isqrt(uint32_t x) | |
{ | |
if (x == 0) return 0; |
This file contains 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
... | |
### .onion and "Flibusta" via TOR | |
ipset=/onion/tor | |
ipset=/flibusta.net/tor | |
ipset=/flibusta.is/tor | |
... |
This file contains 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 -eu | |
# set max cpu scaling frequency | |
# get limits in MHz | |
declare -r MIN_KHZ=$( cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_min_freq ) | |
declare -r MAX_KHZ=$( cat /sys/devices/system/cpu/cpufreq/policy0/cpuinfo_max_freq ) | |
declare -r MIN_MHZ=$(( MIN_KHZ / 1000 )) | |
declare -r MAX_MHZ=$(( MAX_KHZ / 1000 )) |
This file contains 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
#!/usr/bin/python | |
import sys, yaml | |
yaml.safe_dump_all(yaml.load_all(sys.stdin), sys.stdout, default_flow_style=False) |
This file contains 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
import ctypes | |
import os | |
def mount(source, target, fs, options='', flags=0): | |
ret = ctypes.CDLL('libc.so.6', use_errno=True).mount(source, target, fs, flags, options) | |
if ret < 0: | |
errno = ctypes.get_errno() | |
raise RuntimeError("Error mounting {} ({}) on {} with options '{}': {}". | |
format(source, fs, target, options, os.strerror(errno))) |
This file contains 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
#!/usr/bin/wish | |
array set fonts { | |
main {-*-fixed-bold-r-*-*-13-*-*-*-*-*-iso10646-1} | |
} | |
# default command: | |
set command exec | |
lappend command curl | |
lappend command -s |
This file contains 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 | |
SENTRY_KEY= | |
SENTRY_SECRET= | |
SENTRY_PROJECTID=1 | |
SENTRY_HOST=sentry.example.com | |
SCRIPT_ARGUMENTS=$@ | |
capture_error() | |
{ |