Skip to content

Instantly share code, notes, and snippets.

View goffinet's full-sized avatar

goffinet

View GitHub Profile
@goffinet
goffinet / pyscript.py
Created March 6, 2021 17:53 — forked from n8henrie/pyscript.py
Python script template
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""pyscript.py
A simple python script template.
http://ajminich.com/2013/08/01/10-things-i-wish-every-python-script-did/
"""
import argparse
@goffinet
goffinet / pyscript.py
Created March 6, 2021 17:53 — forked from nhoffman/pyscript.py
Python script template
#!/usr/bin/env python3
"""A simple python script template.
"""
import os
import sys
import argparse
@goffinet
goffinet / zabbix_migration.md
Created March 5, 2021 06:55 — forked from mwalczak/zabbix_migration.md
Migrating Zabbix with MySQL backend to a new machine

Today I've solved the problem of one server being to slow to handle the growth of my zabbix configuration. I'm using zabbix-server 2.2.2 with MySQL/Debian backend and around 20 zabbix-agents with Debian installed.

Let's say old Zabbix server IP is: A.B.C.D and new is: U.X.Y.Z. The domain name for the instalation will be: http://zbx.newmachine.com

Below you will find all steps to migrate your configuration:

Ensure all agents will accept connections from the new IP Modify each agent configuration file (in debian: /etc/zabbix/zabbix_agentd.conf) and add new IP

@goffinet
goffinet / subnet.py
Created February 21, 2021 16:20 — forked from vndmtrx/subnet.py
Python 3 simple subnet calculator
#!/usr/bin/env python3
# Use: ./subnet.py <ip/cidr>
# Alt: ./subnet.py <ip> <mask>
import sys
if __name__=="__main__":
addr = [0, 0, 0, 0]
mask = [0, 0, 0, 0]
cidr = 0
@goffinet
goffinet / install.sh
Last active February 4, 2021 21:13
Install useful Linux tools for labs libvirt/kvm terraform packer docker
#!/bin/bash
# Install useful Linux tools for labs
# libvirt/kvm terraform packer docker
# Todo
#- Fix tools list: `$apt`,`$yum` vars
#- use `$OPTARG` var for custom packages
tf_version="0.14.5"
tools_installation () {
@goffinet
goffinet / Password_cracking_in_the_cloud.md
Created December 27, 2020 18:38 — forked from 7MinSec/Password_cracking_in_the_cloud.md
Password cracking in the cloud
@goffinet
goffinet / main.yml
Created December 23, 2020 19:08 — forked from Akasurde/main.yml
Automate CentOS 7 installation using Kickstart and vmware_guest module
---
- hosts: localhost
gather_facts: no
vars_files:
- vcenter_vars.yml
vars:
hostname: kickstart_vm
tasks:
- name: Boot VM with CentOS 7 installation iso in CDROM
vmware_guest:
@goffinet
goffinet / main.yml
Created December 23, 2020 19:08 — forked from Akasurde/main.yml
Automate CentOS 7 installation using Kickstart and vmware_guest module
---
- hosts: localhost
gather_facts: no
vars_files:
- vcenter_vars.yml
vars:
hostname: kickstart_vm
tasks:
- name: Boot VM with CentOS 7 installation iso in CDROM
vmware_guest:
# this is a copay/paste combination of https://gist.github.com/nictuku/13afc808571e742d3b1aaa0310ee8a8d & https://gist.github.com/Rahul91/f051a391fac62ccebb581370b0ac644d
# so that we can install virtualbox via apt-get
for x in xenial xenial-security xenial-updates; do
egrep -qe "deb-src.* $x " /etc/apt/sources.list || echo "deb-src http://archive.ubuntu.com/ubuntu ${x} main universe" | sudo tee -a /etc/apt/sources.list
done
echo "deb http://download.virtualbox.org/virtualbox/debian xenial contrib" | sudo tee -a /etc/apt/sources.list.d/virtualbox.list
wget -q https://www.virtualbox.org/download/oracle_vbox_2016.asc -O- | sudo apt-key add -
# allow us to make a kernel
# Bash best practices and style-guide
Just simple methods to keep the code clean.
Inspired by [progrium/bashstyle](https://github.com/progrium/bashstyle) and [Kfir Lavi post](http://www.kfirlavi.com/blog/2012/11/14/defensive-bash-programming/).
## Quick big rules
* All code goes in a function
* Always double quote variables