Skip to content

Instantly share code, notes, and snippets.

View islander's full-sized avatar

kiba islander

  • Innova Distribution
  • Moscow | Saint Petersburg
View GitHub Profile
#!/bin/bash
#
# Info:
# Add static route on interface up.
# Suitable for CentOS 7.
# $DHCP4_ROUTERS is dispatcher environment variable.
# Others can be found by switching DEBUG mode.
#
# Install:
@islander
islander / docker-wrapper.sh
Created August 2, 2019 05:27
Docker wrapper script to deploy CLI applications
#!/bin/sh
# docker-wrapper script.
# A wrapper script for invoking cli tools with docker.
#
# For example we'll use it for Bash Automated Testing System.
# Put this script in $PATH as `bats`.
PROGNAME="$(basename $0)"
IMAGE="bats/bats"
@islander
islander / README.md
Created July 15, 2019 01:33
Deploy Portainer without docker

Deploy Portainer without docker

Install

Run install-portainer.sh. SystemD required.

Nginx reverse proxy

Add upstream and locations to your config.

@islander
islander / clear_intermidiate_docker_images.md
Last active July 4, 2019 05:25
Clear intermidiate docker images

Clear intermidiate docker images

Problem

Show images:

# docker images -a
REPOSITORY          TAG                 IMAGE ID            CREATED             SIZE
imgname             latest              da197d993277        2 hours ago         202MB
@islander
islander / add-apt-proxy.sh
Created June 17, 2019 06:42
Add apt proxy to docker container
#!/bin/bash -ex
#
# Add to your Dockerfile:
#
# RUN chmod +x add-apt-proxy.sh && ./add-apt-proxy.sh
#
# For additional information see:
#
# https://github.com/sameersbn/docker-apt-cacher-ng
# https://gist.github.com/dergachev/8441335
@islander
islander / zbx-exim-stats.sh
Last active May 16, 2019 01:00 — forked from crashdump/zbx-exim-stats.sh
A simple Zabbix statistics pusher. It check and report these values: - Number of running processes exim4 (trigger if 0) - Mails Queue Size (trigger if >500 and >1000) - Mails Received - Mails Error - Mails Received Size in Bytes - Mails Delivered - Mails Delivered Size in BytesImport the template. Assign to you hosts. Cron the .sh.. You're good …
#!/bin/bash
# Set Variables
EXIMLOG=/var/log/exim4/mainlog
MYLOG=/tmp/exim_status.log
OFFSETFILE=/tmp/eximstatusoffset.dat
EXIMSTATS=/usr/sbin/eximstats
LOGTAIL=/usr/sbin/logtail
ZABBIX_SENDER=/usr/bin/zabbix_sender
ZABBIX_CONF=/etc/zabbix/zabbix_agentd.conf
@islander
islander / pf.conf
Created April 13, 2019 02:24
FreeBSD firewall (pf) sample file
# vim: set ft=pf
# /etc/pf.conf
# Required order: options, queueing, translation and filtering.
ext_if="vtnet0"
# default openvpn settings for the client network
openvpn_clients = "10.8.0.0/24"
# put your tunnel interface here, it is usually tun0
@islander
islander / golang_read_password.go
Created April 5, 2019 04:20
Golang read password
#!/usr/bin/env gorun
package main
import (
"fmt"
"syscall"
"golang.org/x/crypto/ssh/terminal"
)
func main() {
@islander
islander / firewalld-asterisk.sh
Created April 1, 2019 23:38
Open Asterisk in CentOS7 firewalld
#!/bin/bash
PORTS=('5060/tcp' '5060/udp' '5061/tcp' '5061/udp' '4569/udp' '5038/tcp' '10000-20000/udp')
SERVICE_FILE="/etc/firewalld/services/asterisk.xml"
if [ ! -e "${SERVICE_FILE}" ]; then
firewall-cmd --permanent --new-service=asterisk
fi
for PORT in ${PORTS[@]}; do
@islander
islander / asterisk_get_missed_calls.sql
Created September 7, 2018 01:31
Aggregate Asterisk CDR by disposition and dst peers
DELIMITER $$
DROP PROCEDURE IF EXISTS getMissedCalls $$
CREATE PROCEDURE getMissedCalls(IN day VARCHAR(10))
LANGUAGE SQL
SQL SECURITY INVOKER
COMMENT 'Aggregate Asterisk CDR by disposition and dst peers'
BEGIN
DECLARE cols TEXT;
DECLARE done BOOLEAN DEFAULT FALSE;
-- make columns with peer names: