Skip to content

Instantly share code, notes, and snippets.

@yusufhm
yusufhm / logstash-ossec-alerts.conf
Last active May 22, 2017 16:54
Logstash configuration for reading OSSEC alerts files and send to Elasticsearch (credits to https://mig5.net)
input {
file {
type => "ossec"
path => "/var/ossec/logs/alerts/alerts.log"
sincedb_path => "/opt/logstash/"
codec => multiline {
pattern => "^\*\*"
negate => true
what => "previous"
}
@drax68
drax68 / gist:2412600
Created April 18, 2012 10:01
Zabbix phone notification
Шаг №1 — Пререквизиты. Ставим festival и pjsip
sudo aptitude install festival
Загружаем и собираем pjsip:
wget http://www.pjsip.org/release/1.10/pjproject-1.10.tar.bz2
tar xfv pjproject-1.10.tar.bz2
cd pjproject-1.10
./configure --disable-sound
@denji
denji / OCSP-generate.sh
Last active February 23, 2018 06:12
Priming the OCSP cache in Nginx
#!/bin/sh
ISSUER_CER=$1
SERVER_CER=$2
URL=$(openssl x509 -noout -ocsp_uri -in "$SERVER_CER")
openssl ocsp -noverify -no_nonce -respout ocsp.resp -issuer "$ISSUER_CER" -cert "$SERVER_CER" -url "$URL"
# Where "ocsp.resp" is whatever file you have configured in Nginx for the "ssl_stapling_file".
@belgattitude
belgattitude / install_phpexcel_php7.sh
Last active February 17, 2019 17:24
Install libxl, php_excel extension on PHP7.1 (ondrej/ppa)
#!/bin/bash
#
# ilia/php_excel extension example install script for PHP7+
#
# usage:
# > sudo ./install_phpexcel_php7.sh
# > (optionally) sudo service php7.1-fpm restart)
#
# requirements:
# - Ubuntu 64bits (trusty/xenial)
#!/usr/bin/env python3
import sys
import os
import smtplib
from email.mime.text import MIMEText
mail_host = 'email-smtp.eu-west-1.amazonaws.com'
mail_port = 465
@HowardMei
HowardMei / gist:4350896
Last active May 16, 2020 16:30
python bash integration
A collection of python & shell integration attempts:
pysh:Write shell scripts in Python
https://github.com/yunabe/pysh
lshell:function limited shell
https://github.com/ghantoos/lshell
sh:similar to plumbum but has builtin features
https://github.com/amoffat/sh
@davisford
davisford / gist:5039064
Last active February 9, 2022 13:39
git clone into non-empty directory

Let's say you start a project locally, and do some editing.

$ mkdir -p ~/git/foo && cd ~/git/foo
$ touch NEWFILE

Now you decide you want to create a new github repo and track it, but the directory is non-empty so git won't let you clone into it. You can fix this, thusly:

@sakalajuraj
sakalajuraj / auditd.conf
Last active May 24, 2022 17:26
Logstash configuration for auditd messages received via syslog
# Content of the file /etc/logstash/conf.d/auditd.conf
# Tested on the CentOS 7 auditspd logs forwarded to logstash via rsyslog
input {
syslog {
type => AUDITD
port => xxxx
host => "xxx.xxx.xxx.xxx"
}
}
@sirsquidness
sirsquidness / proxy.conf
Created September 22, 2016 12:42
How to have nginx proxy_pass follow upstream 302 redirects (eg, when you're running a steam cache and you're behind Cox's layer 7 interception stuff)
# This config came around after a friend had problems with a Steam cache on his
# Cox internet connection. Cox would intercept any requests to Steam content
# servers and return a 302 to Cox's servers. The cache would return the 302
# to the Steam client, and the Steam client would go directly to Cox, bypassing
# the cache.
# This config makes nginx follow the 302 itself, and caches the result of the
# redirect as if it was the response to the original request. So subsequent
# requests to the URL that returned a 302 will get the file instead of a 302.
@jayjanssen
jayjanssen / gist:5697813
Created June 3, 2013 12:33
Testing multicast with iperf
this is a sample of output:
root@percona-db-2:~# iperf -s -u -B 226.94.1.1 -i 1
------------------------------------------------------------
Server listening on UDP port 5001
Binding to local address 226.94.1.1
Joining multicast group 226.94.1.1
Receiving 1470 byte datagrams
UDP buffer size: 122 KByte (default)
------------------------------------------------------------