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 / 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, "/")
@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"
}
<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>