Skip to content

Instantly share code, notes, and snippets.

@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
@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 / 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 / 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 / Vagrantfile
Last active March 29, 2018 07:46
Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure("2") do |config|
# Every Vagrant development environment requires a box. You can search for
@rafzei
rafzei / settings.screen
Last active April 24, 2023 08:19
screen configuration under linux host
# no welcome message
startup_message off
# lines buffor
defscrollback 5000
# 256 colors
attrcolor b ".I"
termcapinfo xterm 'Co#256:AB=\E[48;5;%dm:AF=\E[38;5;%dm'
@rafzei
rafzei / mount_bitlocker_secured_disk.sh
Last active July 2, 2020 16:51
Easy mount/umount Bitlocker encrypted disk with bash script
#!/bin/bash
vars(){
echo "Setting up vars"
dir_bitlocker="/media/bitlocker"
file_dislocker="dislocker-file"
dir_bitlocker_mount="/media/bitlocker_mount"
dislocker="/usr/bin/dislocker"
}
ensure_dislocker(){
@rafzei
rafzei / sources.list_18.04
Last active August 10, 2020 08:28
Repositories for Ubuntu (18.04, 20.04)
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted
## Major bug fix updates produced after the final release of the
## distribution.
deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
# deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted
## N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
## team. Also, please note that software in universe WILL NOT receive any
@rafzei
rafzei / set-ssh-permissions.sh
Created August 11, 2020 19:32
Correct ssh permisions
chmod 700 ~/.ssh
chmod 644 \
~/.ssh/id_rsa.pub \
~/.ssh/known_hosts \
~/.ssh/authorized_keys \
~/.ssh/config
chmod 600 ~/.ssh/id_rsa
@rafzei
rafzei / crictl-commands.txt
Last active October 12, 2022 10:28
crictl commands
# crictl documentation: https://kubernetes.io/docs/tasks/debug-application-cluster/crictl/
# Runtime endpoints:
sudo crictl --runtime-endpoint unix:///run/containerd/containerd.sock
sudo crictl --runtime-endpoint unix:///var/run/dockershim.sock
sudo crictl --runtime-endpoint unix:///run/crio/crio.sock
## Containers
# Get all containers