Skip to content

Instantly share code, notes, and snippets.

View dbannik's full-sized avatar

Dmitry Bannik dbannik

  • Piesoft
  • Belarus
View GitHub Profile
@dbannik
dbannik / create-default-bucket.sh
Created November 30, 2022 13:55
[MINIO] Create default bucket
#!/usr/bin/env bash
set -e
HOST=${HOST:-'http://localhost:9001'}
COOKIE='/tmp/curl_s3_cookie'
DEFAULT_BUCKET=${DEFAULT_BUCKET:-''}
ACCESS_KEY_ID=${MINIO_ROOT_USER:-''}
SECRET_ACCESS_KEY=${MINIO_ROOT_PASSWORD:-''}
@dbannik
dbannik / qemu.sh
Last active March 28, 2021 23:56
Host port forwarding to kvm /etc/libvirt/hooks/qemu.sh
#!/bin/bash
set -e
IPTABLES=/usr/sbin/iptables
IPTABLES_SAVE=/usr/sbin/iptables-save
VIRT_NAME=${1}
VIRT_STATUS=${2}
function portForwarding() {
@dbannik
dbannik / iptables-drop-private-network.sh
Created December 24, 2020 09:04
Drop private network
#!/bin/bash
iptables -t mangle -N DROP_PRIVATE
iptables -t mangle -A DROP_PRIVATE -d 10.0.0.0/8,172.16.0.0/12,192.168.0.0/16,100.64.0.0/10,169.254.0.0/16 -j DROP
iptables -t mangle -A POSTROUTING -o br0 -j DROP_PRIVATE
@dbannik
dbannik / ssh-authorized-keys.sh
Created August 23, 2020 01:12
Import github ssh user keys to user authorized
#!/usr/bin/env bash
username=$1
if [[ "$username" == "" ]];
then
echo "Please set 1 parameter"
echo "$0 username"
exit 1
fi
@dbannik
dbannik / edit-hostname.sh
Last active August 23, 2020 01:10
Modify hostname
#!/usr/bin/env bash
newHostname=$1
if [[ "$newHostname" == "" ]];
then
echo "Please set 1 parameter"
echo "$0 hostname"
exit 1
fi
@dbannik
dbannik / backup.php
Last active December 9, 2018 04:51
Backup script
#!/usr/bin/env php
<?php
declare(strict_types=1);
/**
* Created by PhpStorm.
* User: dmitry
* Date: 11.11.18
* Time: 20:41.
*/
@dbannik
dbannik / install-zabbix_agent_active_mod.sh
Last active October 23, 2018 22:47
zabbix-agent Active mod
#/bin/bash
ZabbixServer=127.0.0.1
ServersName=$(hostname)
apt install zabbix-agent
sed -i \
-e 's/^.*StartAgents=.*$/StartAgents=0/' \
-e 's/^Server=.*$/Server='${ZabbixServer}'/' \
-e 's/^ServerActive=.*$/ServerActive='${ZabbixServer}'/' \
@dbannik
dbannik / zabbix-install.sh
Last active March 29, 2023 13:37
Install zabbix 3.2 for ubuntu 16.04
#!/bin/sh
apt update && apt install wget htop curl nano ssh -y
wget http://repo.zabbix.com/zabbix/3.2/ubuntu/pool/main/z/zabbix-release/zabbix-release_3.2-1+xenial_all.deb
dpkg -i zabbix-release_3.2-1+xenial_all.deb && apt-get update
export DEBIAN_FRONTEND=noninteractive
apt install zabbix-server-mysql zabbix-frontend-php -y
@dbannik
dbannik / steam-check.php
Last active May 12, 2022 22:16
autoupdate game servers (steam)
<?php
if(!array_key_exists(1, $argv)) exit();
$appid = (int) $argv[1];
$version = (int) preg_replace("/[^0-9]+/","",$argv[2]);
$url = "http://api.steampowered.com/isteamapps/uptodatecheck/v0001?appid=$appid&version=$version";
$data = file_get_contents($url);
@dbannik
dbannik / utorrent-install.sh
Last active September 5, 2016 23:04
utorrent-install.sh
#!/bin/sh
UT_URL='http://download.ap.bittorrent.com/track/beta/endpoint/utserver/os/linux-x64-ubuntu-12-04'
UT_USER='utorrent'
CONTACT='[email protected]'
crontab=/var/spool/cron/crontabs/$UT_USER
if [ -z "$(which curl)" ]; then
echo Eroor: is not curl.
echo apt install curl