All New

user:thomas gists created by user

title:mygist gists with given title

filename:myfile.txt gists having files with given name

extension:yml gists having files with given extension

language:go gists having files with given language

topic:homelab gists with given topic

Login


All New Login

All gists

Recently created
Least recently created
Recently updated
Least recently updated
LittleGreenCat's Avatar

LittleGreenCat / Search all man pages by keyword

0 likes
0 forks
1 files
Last active 7 months ago
Поиск всех man страничек по ключевому слову
man

man -K <command>

(последовательно выводит все найденные маны с этим словом) Полезно для поиски редких кулябек.

Добавка от Andrew

еще и команда apropos только удобнее

Опубликовано в GitGate

LittleGreenCat's Avatar

LittleGreenCat / Proxy only for apt, not for the whole system

0 likes
0 forks
1 files
Last active 7 months ago
Прокси только для apt, но не для системы в целом
apt
cat <<EOF | sudo tee /etc/apt/apt.conf.d/90curtin-aptproxy
Acquire::http::Proxy "http://10.20.30.40:3128";
Acquire::https::Proxy "http://10.20.30.40:3128";
EOF

Альтернативный способ, чтобы не прописывать прокси в систему (мы же за безопасность) можно ее прям команде скормить, например:

http_proxy=http://10.20.30.40:3128  https_proxy=http://10.20.30.40:3128  HTTP_PROXY=http://10.20.30.40:3128  HTTPS_PROXY=http://10.20.30.40:3128 apt update
LittleGreenCat's Avatar

LittleGreenCat / Arithmetic operations in bash

0 likes
0 forks
1 files
Last active 7 months ago
Арифметические операции в bash
bash
1 # Returns true if the numbers are equal
2 [[ ${arg1} -eq ${arg2} ]]
3
4 # Returns true if the numbers are not equal
5 [[ ${arg1} -ne ${arg2} ]]
6
7 # Returns true if arg1 is less than arg2
8 [[ ${arg1} -lt ${arg2} ]]
9
10 # Returns true if arg1 is less than or equal arg2
LittleGreenCat's Avatar

LittleGreenCat / Conditional expressions for string variables in bash

0 likes
0 forks
1 files
Last active 7 months ago
Условные выражения для строковых переменных в bash
bash
1 # True if the shell variable varname is set (has been assigned a value).
2 [[ -v ${varname} ]]
3
4 # True if the length of the string is zero.
5 [[ -z ${string} ]]
6
7 # True if the length of the string is non-zero.
8 [[ -n ${string} ]]
9
10 # True if the strings are equal. = should be used with the test command for POSIX conformance. When used with the [[ command, this performs pattern matching as described above (Compound Commands)
LittleGreenCat's Avatar

LittleGreenCat / Conditional expressions for files in bash

0 likes
0 forks
1 files
Last active 7 months ago
Условные выражения для файлов в bash
bash
1 ## True if file exists.
2 [[ -a ${file} ]]
3
4 ## True if file exists and is a block special file.
5 [[ -b ${file} ]]
6
7 ## True if file exists and is a character special file.
8 [[ -c ${file} ]]
9
10 ## True if file exists and is a directory.
LittleGreenCat's Avatar

LittleGreenCat / Sound signal in console

0 likes
0 forks
1 files
Last active 7 months ago
Звуковой сигнал в консоли заданного тона и длительности. Например для оповещений об ошибках.
console

Звуковой сигнал в консоли заданного тона и длительности. Например для оповещений об ошибках.

TONE=3500 #от 500 до 3500
(speaker-test -t sine -f $TONE) & pid=$!;sleep 0.1s;kill -9 $pid

Вообще интересная утилитка, позволяющая проигрывать и WAV, и раздельно левый правый канал и много чего еще.

LittleGreenCat's Avatar

LittleGreenCat / Grep variations

0 likes
0 forks
1 files
Last active 7 months ago
Разные варианты команды grep и ключи для смены режимов в базовом grep
grep
1 grep = grep -G # базовое регулярное выражение (BRE)
2 fgrep = grep -F # фиксированный текст, игнорирующий мета-символы
3 egrep = grep -E # расширенное регулярное выражение (ERE)
4 rgrep = grep -r # рекурсивный
5
6 # Опубликовано в https://t.me/gitgate
LittleGreenCat's Avatar

LittleGreenCat / Correct increase disc VM

0 likes
0 forks
1 files
Last active 7 months ago
Быстро и корректно увеличить диск в виртуалке системными средствами.
vm disc
  1. Добавить свободное место в блочное устройство в гипервизоре

  2. Внутри VM перечитать размер диска

echo 1>/sys/class/block/sdb/device/rescan

  1. Установить пакет cloud-guest-utils в составе которого находится нужная нам утилита growpart

apt-get install cloud-guest-utils

LittleGreenCat's Avatar

LittleGreenCat / Cgroups - Memory Limits

0 likes
0 forks
1 files
Last active 7 months ago
Ограничение памяти с помощью cgroups
cgroups

Control Groups (cgroups) позволяют ограничивать объем памяти, доступной для группы процессов.

Для начала необходимо создать группу для ограничения памяти:

sudo cgcreate -g memory:/mygroup

Далее настраиваются ограничение на использование памяти для группы mygroup. Например, ограничение на 512 MB:

LittleGreenCat's Avatar

LittleGreenCat / Using Jumphost

0 likes
0 forks
1 files
Last active 7 months ago
Как попасть на узел в закрытой сети через jumphost по ssh.
ssh jumphost
1 ssh -J user1@hostname1:port1 user2@hostname2:port2
2 # Где hostname1 - промежуточный jump узел с доступом извне, hostname2 узел изолированный от внешних каналов, но с сетевой связаностью с hostname1
3
4 # Для удобства можно прописать алиасом в файле ~/.bashrc
5 alias jump='ssh -J user1@hostname1:port1'
6 # И просто вызывать командой
7 jump user2@hostname2:port2
8
9 Опубликовано в https://t.me/gitgate
Newer Older

Powered by Opengist ⋅ Load: 93ms⋅

English
Čeština Deutsch English Español Français Magyar Italiano 日本語 Polski Português Русский Türkçe Українська 中文 繁體中文
⋅ Telegram ⋅ Git collection