Skip to content

Instantly share code, notes, and snippets.

View jsirianni's full-sized avatar

Joseph Sirianni jsirianni

  • observIQ, Inc
  • Grand Rapids Michigan
View GitHub Profile
@jsirianni
jsirianni / slack_nagios.sh
Created May 13, 2017 21:12 — forked from matt448/slack_nagios.sh
Script to post Nagios notifications into a Slack channel
#!/bin/bash
# This script is used by Nagios to post alerts into a Slack channel
# using the Incoming WebHooks integration. Create the channel, botname
# and integration first and then add this notification script in your
# Nagios configuration.
#
# All variables that start with NAGIOS_ are provided by Nagios as
# environment variables when an notification is generated.
# A list of the env variables is available here:
@jsirianni
jsirianni / go-ssh-reverse-tunnel.go
Created May 31, 2017 18:06 — forked from codref/go-ssh-reverse-tunnel.go
Go SSH reverse tunnel implementation (SSH -R)
/*
Go-Language implementation of an SSH Reverse Tunnel, the equivalent of below SSH command:
ssh -R 8080:127.0.0.1:8080 operatore@146.148.22.123
which opens a tunnel between the two endpoints and permit to exchange information on this direction:
server:8080 -----> client:8080
@jsirianni
jsirianni / slack_webhook_post.py
Created August 11, 2017 14:34 — forked from devStepsize/slack_webhook_post.py
POST a JSON payload to a Slack Incoming Webhook using Python requests
'''
This is an example of how to send data to Slack webhooks in Python with the
requests module.
Detailed documentation of Slack Incoming Webhooks:
https://api.slack.com/incoming-webhooks
'''
import json
import requests
@jsirianni
jsirianni / centos-vpn
Last active September 19, 2017 18:07
sudo sh -c 'echo "* hard nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "* soft nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "root hard nofile 64000" >> /etc/security/limits.conf'
sudo sh -c 'echo "root soft nofile 64000" >> /etc/security/limits.conf'
pritunl setup-key
@jsirianni
jsirianni / pysyslog.py
Created October 24, 2017 14:40 — forked from marcelom/pysyslog.py
Tiny Python Syslog Server
#!/usr/bin/env python
## Tiny Syslog Server in Python.
##
## This is a tiny syslog server that is able to receive UDP based syslog
## entries on a specified port and save them to a file.
## That's it... it does nothing else...
## There are a few configuration parameters.
LOG_FILE = 'youlogfile.log'
[Unit]
Description=repopull service
After=network.target
[Service]
ExecStart=/usr/local/bin/repopull
[Install]
WantedBy=multi-user.target
@jsirianni
jsirianni / vault.service
Created April 28, 2018 02:03 — forked from yunano/vault.service
/etc/systemd/system/vault.service
[Unit]
Description=vault server
Requires=network-online.target
After=network-online.target consul.service
[Service]
EnvironmentFile=-/etc/sysconfig/vault
Restart=on-failure
ExecStart=/usr/local/sbin/vault server $OPTIONS -config=/etc/vault.d
ExecStartPost=/bin/bash -c "for key in $KEYS; do /usr/local/sbin/vault unseal $CERT $key; done"
@jsirianni
jsirianni / ubuntu-14.04.json
Created May 18, 2018 11:39 — forked from bunchc/ubuntu-14.04.json
packer template for ubuntu
{
"variables": {
"vsphere_host": "vcenter65-1.vghetto.local",
"vsphere_user": "administrator@vghetto.local",
"vsphere_pass": "VMware1!",
"vsphere_datacenter": "Datacenter",
"vsphere_cluster": "\"VSAN-Cluster\"",
"vsphere_datastore": "virtual_machines",
"vsphere_network": "\"VM Network\""
},
@jsirianni
jsirianni / lucid_python_logging.md
Created June 13, 2018 12:28 — forked from lucid281/lucid_python_logging.md
Add simple, useful, logging functions to your Python3 code!

Lucid Logging v1

Programatically create a reasonably intelligent logger.

  • Generates functions for log levels
  • Logs user, calling filename, co_name's caller, and co_name of the code calling the debug message.
import os
import sys
import logging
from pathlib import Path
@jsirianni
jsirianni / zfs_health.sh
Created September 13, 2018 01:40 — forked from petervanderdoes/zfs_health.sh
ZFS Health Check Script
#! /usr/local/bin/bash
#
# Calomel.org
# https://calomel.org/zfs_health_check_script.html
# FreeBSD 9.1 ZFS Health Check script
# zfs_health.sh @ Version 0.15
# Check health of ZFS volumes and drives. On any faults send email. In FreeBSD
# 10 there is supposed to be a ZFSd daemon to monitor the health of the ZFS
# pools. For now, in FreeBSD 9, we will make our own checks and run this script