Skip to content

Instantly share code, notes, and snippets.

@rafzei
rafzei / example_firewall_config.sh
Created March 13, 2018 09:35
Firewall config (example)
#!/bin/bash
IPT="/sbin/iptables"
INT_INTERFACE="eth0"
LOO_INTERFACE="lo"
IPADDR=""
SUBNET_BASE=""
SUBNET_BROADCAST=""
MY_ISP=""
@rafzei
rafzei / wintounix_eol.sh
Last active October 16, 2017 09:47
WINDOWS -> UNIX EOL bash script
#!/bin/bash
#Functiond used for ensuring that file passed as argument has UNIX EOL
ensure_unix_eol(){
local file=$1
if [[ $# -eq 0 ]]; then
echo -e "\nERROR: No arguments passed. Script cannot continue. Exiting...\n"
exit 1
elif [[ $# -gt 1 ]]; then
@rafzei
rafzei / color_function.sh
Last active October 16, 2017 09:48
bash (scripting) colors
#!/bin/sh
add_color(){
#colors declaration
NORMAL='\\033[0m'
GREEN='\\033[0;32m'
RED='\\033[0;31m'
YELLOW='\\033[0;33m'
#recognize INFO,ERROR,SUCCESS
@rafzei
rafzei / ifcfg-eth0
Last active May 23, 2018 09:29
RHEL 6/7 static IP - eth0
#eth0 interface configuration
TYPE=Ethernet
NAME=eth0
DEVICE=eth0
ONBOOT=yes
BOOTPROTO=static
IPADDR=192.168.0.100
DEFROUTE=yes
IPV4_FAILURE_FATAL=no
MTU=1462