Skip to content

Instantly share code, notes, and snippets.

View zhum's full-sized avatar

Zhumatiy Sergey zhum

View GitHub Profile
@zhum
zhum / TelegramIdWith Bot.md
Created September 3, 2021 11:38
Как получить telegram id группы, если есть бот
  1. Добавить бота в нужную группу;
  2. Написать хотя бы одно сообщение в неё;
  3. Отправить GET-запрос: curl https://api.telegram.org/bot<YourBOTToken>/getUpdates
  4. Взять значение "id" из объекта "chat". Это и есть идентификатор чата. Для групповых чатов он отрицательный, для личных переписок положительный.
@zhum
zhum / gitproxy-socat
Created April 19, 2021 09:57 — forked from sit/gitproxy-socat
A simple wrapper around socat to use as a git proxy command
#!/bin/sh
# Use socat to proxy git through an HTTP CONNECT firewall.
# Useful if you are trying to clone git:// from inside a company.
# Requires that the proxy allows CONNECT to port 9418.
#
# Save this file as gitproxy somewhere in your path (e.g., ~/bin) and then run
# chmod +x gitproxy
# git config --global core.gitproxy gitproxy
#
# More details at http://tinyurl.com/8xvpny
@zhum
zhum / ruseng2.sh
Created April 17, 2021 12:32
Исправление раскладки выделенного текста
#!/bin/bash
# Необходимые программы; всё доступно через apt.
# ╔════╦═══════╦══════╦═════════╗
# ║xsel║xdotool║xmacro║setxkbmap║
# ╚════╩═══════╩══════╩═════════╝
# ╔═══════════════════════════════════════════════════════════════════════════════╗
# ║ 1.)Данные для скрипта исправляющего раскладку выделенного текста… ║
# ╚═══════════════════════════════════════════════════════════════════════════════╝
@zhum
zhum / zbx-exim-stats.sh
Last active November 28, 2020 13:03 — forked from crashdump/zbx-exim-stats.sh
A simple Zabbix statistics pusher for Zabbix-5. zbx-exim-stats.sh should be set to crontab, template should be imported.
#!/bin/bash
# Set Variables
EXIMLOG=/var/log/exim4/mainlog
MYLOG=/tmp/exim_status.log
OFFSETFILE=/tmp/eximstatusoffset.dat
EXIMSTATS="/usr/sbin/eximstats -emptyok"
LOGTAIL=/usr/sbin/logtail
ZABBIX_SENDER=/usr/bin/zabbix_sender
ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
@zhum
zhum / flags-howto.txt
Created October 27, 2020 16:51
Флаги на раскладке
1. Create ~/.icons/flags
2. Put ru.png and en.png images
3. execute dconf-editor, go to org/mate/desktop/peripherals/keyboard/xkb/indicator/show-flags, set YES, apply.
@zhum
zhum / update_pubkey.sh
Created October 25, 2020 08:39
Fix "NO_PUBKEY XXXXXXX" problen on apt repo add
#!/bin/sh
while [ "x$1" != x ]; do
apt-key adv --recv-keys --keyserver keyserver.ubuntu.com "$1"
shift
done
@zhum
zhum / mysql-trouble-fix.sh
Last active July 27, 2021 06:48
Reset password fro ANY mysql/mariadb installation
# PASSWORD RESET
#!/bin/sh
service mysql stop
sudo mysqld_safe --skip-grant-tables &
mysql_secure_installation
mysql -u root -p shutdown
service mysql start
###########################################
# Fix error like 'nnoDB: Error: Attempted to open a previously opened tablespace. Previous tablespace mysql/innodb_index_stats uses space ID'
@zhum
zhum / 20-natural-scrolling.conf
Created July 20, 2020 04:46 — forked from kakra/20-natural-scrolling.conf
xorg.conf.d/20-natural-scrolling.conf
Section "InputClass"
Identifier "Enable natural scrolling by default"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
MatchDriver "libinput"
Option "NaturalScrolling" "on"
EndSection
user www-data;
worker_processes auto;
pid /run/nginx/nginx.pid; # only line changed from default
include /etc/nginx/modules-enabled/*.conf;
events {
worker_connections 768;
# multi_accept on;
}
@zhum
zhum / bash-cheatsheet.sh
Last active April 24, 2025 22:07
Bash script sheatsheet
#!/usr/bin/env bash
# latest version is here: https://gist.github.com/zhum/b00b6c55e0559d0684796191eecf21d9
# shellcheck disable=all
#-------------- options --------------
set -e # stop on any command fail
set -E # generate ERR exception on aliases, functions, and commands in if/while/until conditions
set -u # stop on any unbound variable
set -o pipefail # stop on any fail with pipe