Skip to content

Instantly share code, notes, and snippets.

View vmanyushin's full-sized avatar

Viktor Manyushin vmanyushin

View GitHub Profile
@vmanyushin
vmanyushin / gist:228b5b6449fb9dc1d6bab3b726c23d7d
Created February 22, 2019 10:17
dump php-fpm unix sock data
socat -t100 -v UNIX-LISTEN:/var/run/php-fpm.sock,mode=777,reuseaddr,fork UNIX-CONNECT:/var/run/php-fpm.sock.original
@vmanyushin
vmanyushin / sender.sh
Created February 20, 2019 22:27
send values to zabbix without sender
#!/bin/bash
# ver 0.1
# emulate zabbix_sender -z zabbix -s eol.lan -k systemd.abandoned -v 35
ZBX=zabbix.lan
NUM=$(echo -n "35" | perl -e 'foreach$c(split(//,<STDIN>)){printf"%x",ord($c);}')
echo -n "5a425844015c000000000000007b2272657175657374223a2273656e6465722064617461222c2264617461223a5b7b22686f7374223a22656f6c2e6c616e222c226b6579223a2273797374656d642e6162616e646f6e6564222c2276616c7565223a22${NUM}227d5d7d" | xxd -r -p | nc $ZBX 10051
@vmanyushin
vmanyushin / strrnd.pl
Created October 23, 2018 15:10
Random string generator
perl -e 'sub rndStr{ join"",@_[ map{rand @_}1..shift]};for($i=0;$i<$ARGV[0];$i++){ print rndStr($ARGV[1],'A'..'Z')."\n";}' 1 254
<?php
class Row {
public function __construct(array $attributes = [])
{
foreach ($attributes as $name => $value) {
$this->{$name} = $value;
}
}
}
<dictionaries>
<dictionary>
<name>asn</name>
<layout>
<hashed />
</layout>
<source>
<file>
<path>/opt/ASN.csv</path>
<format>CSV</format>
#!/usr/bin/awk -f
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
/\}/{ctx--}
{id="";for(i=idx;i<ctx;i++)id=sprintf("%s%s", id, "\t");printf "%s%s\n", id, $0}
#!/usr/bin/awk -f
# 4 space edition
{sub(/^[ \t]+/,"");idx=0}
/\{/{ctx++;idx=1}
@vmanyushin
vmanyushin / dump.sh
Last active August 29, 2018 11:02
Dump http request with headers
tcpdump -i any port 80 -A | grep -A 10 -P '(GET|POST|OPTIONS|PUT|DELETE).*?HTTP/1.[01]' | perl -ne 's/^.*?(?=(GET|POST|OPTIONS|PUT|DELETE))//g; print;'
@vmanyushin
vmanyushin / leaflet.js
Created July 23, 2018 10:07
leaflet click on polygon
// http://jsfiddle.net/guspersson/yfe1g5zs/
// Create the map
var map = L.map('map').setView([79, -100], 5);
// Set up the OSM layer
L.tileLayer(
'http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png',
{maxZoom: 18}).addTo(map);
//Handle click on polygon
# find next free ip address
# fping required
#
export SUBNET=25; echo $(for i in $(seq 10 253); do ip="172.16.${SUBNET}.${i}"; fping -c 1 -t 500 $ip &> /dev/null; if [ $? -eq 1 ]; then echo $ip; break; fi; done)
@vmanyushin
vmanyushin / gist:cc37c84e7ae05a23a55f09e13fa7cef3
Created October 26, 2017 12:25
enable automatic host inventory for all hosts
insert into host_inventory (hostid, inventory_mode) SELECT hostid, 1 FROM hosts;