Skip to content

Instantly share code, notes, and snippets.

View azilber's full-sized avatar
😴
ZZZZZzzzzzzz.......

Alexey Zilber azilber

😴
ZZZZZzzzzzzz.......
View GitHub Profile
@azilber
azilber / ipassign
Created September 5, 2021 08:04 — forked from jsianes/ipassign
Script to assign Public IP from Elastic IP pool for instances hosted in AWS. 'ec2-utils' and AWS CLI packages required. Instance role or access keys need to allow at least next EC2 actions: describe-addresses, associate-address and disassociate-address. Shell script is designed to be integrated with instance start-up
#!/bin/bash
# chkconfig: 2345 99 10
# description: Set Public IP from ElasticIP pool during instance startup
# processname: ipassign
# Provides: ipassign
# Required-Start:
# Required-Stop:
# Default-Start: 2 3 4 5
# Default-Stop:
# Short-Description: Set Public IP from ElasticIP pool during instance startup
@azilber
azilber / migrate-repos.sh
Last active July 8, 2020 04:24
Migrate Git repos to AWS CodeCommit using Multi-Accounts
#!/bin/bash
P=/home/git/repositories
ls -altrh $P/
echo -n "Directory to migrate: "
read D
@azilber
azilber / Golang-CIDR-to-IP
Last active January 20, 2020 10:21 — forked from P-A-R-U-S/Golang-CIDR-to-IP
Go: Convert CIDR to IP
// Convert CIDR to IPv4 range
func CIDRRangeToIPv4Range(cidr string) (ipStart string, ipEnd string, err error) {
var ip uint32 // ip address
var ipS uint32 // Start IP address range
var ipE uint32 // End IP address range
cidrParts := strings.Split(cidr, "/")

Keybase proof

I hereby claim:

  • I am azilber on github.
  • I am koguma (https://keybase.io/koguma) on keybase.
  • I have a public key ASAjG3PPoj8AHKAPGng0zvuZw87f7T4ZluIdkEfUObUXlwo

To claim this, I am signing this object:

#version=DEVEL
# System authorization information
auth --enableshadow --passalgo=sha512
# Use CDROM installation media
cdrom
# Use graphical install
graphical
# Run the Setup Agent on first boot
firstboot --enable
ignoredisk --only-use=sda,sdb
@azilber
azilber / hp.repo
Created June 19, 2017 09:42
HP Repo data for Centos 7
[HP-spp]
name=HP Service Pack for ProLiant
baseurl=http://downloads.linux.hpe.com/SDR/repo/spp/RHEL/7/x86_64/current/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/GPG-KEY-ssp
[HP-mcp]
name=HP Management Component Pack for ProLiant
baseurl=http://downloads.linux.hpe.com/SDR/repo/mcp/centos/7/x86_64/current/
@azilber
azilber / container-disk-use.sh
Last active February 4, 2017 02:49 — forked from jnm/container-disk-use.sh
Show OpenVZ containers' disk use in GB and as percentage of the host's total disk space. Tested with Proxmox VE.
#!/bin/bash
# jnm 20140311
TOTAL_AVAILABLE=$(df /vz | grep '/vz$' | awk '{ print $2 }')
vzlist -o ctid,numproc,status,ip,hostname,diskspace -s diskspace | awk '
{
printf $0 "\t"
if(NR==1)
{
print "in G\tas % of host"
}
@azilber
azilber / Makefile
Created June 12, 2014 06:19
sshutout Makefile for ubuntu (works n 14.x)
CC = gcc
WARNINGS = -Wall
COMPILE = -pipe -O2
#DEBUG = -ggdb
LD_OPT = -s
CFLAGS = $(DEBUG) $(WARNINGS) $(COMPILE)
SRCS = sshutout.c
OBJS = $(SRCS:.c=.o)
@azilber
azilber / sshutout
Created June 12, 2014 06:18
quick and dirty Init.d for sshutout for Ubuntu (Works with 14.x)
#!/bin/sh
#
# chkconfig: 345 99 1
# description: Start and stop script for sshutout
#
### BEGIN INIT INFO
# Provides: sshutout
# Required-Start: $local_fs $network +splash_late
# Required-Stop:
# Default-Start: 3 4 5
<source>
type tail
format /(?<c_ip>[\w\.]+):(?<c_port>\d+) \[(?<a_date>.+)\] (?<f_end>[\w-]+) (?<b_end>[\w-]+)\/(?<b_server>[\w-]+) (?<tw>\d+)\/(?<tc>\d
+)\/(?<tt>\d+) (?<bytes>\d+) (?<t_state>[\w-]+) (?<actconn>\d+)\/(?<feconn>\d+)\/(?<beconn>\d+)\/(?<srv_conn>\d+)\/(?<retries>\d+) (?<
srv_queue>\d+)\/(?<backend_queue>\d+)/
time_format %d/%B/%Y:%H:%M:%S
path /var/log/haproxy/haproxy_access.log
pos_file /opt/fluentd/var/pos/haproxy_access.pos
tag haproxy.access
</source>