Skip to content

Instantly share code, notes, and snippets.

@BobCHub
BobCHub / pet-snippet.toml
Last active February 17, 2018 17:21
My Linux Snippets
[[snippets]]
description = "! - display all files including hidden"
command = "ls -a"
output = "ls -a"
[[snippets]]
description = "! - display files"
command = "ls"
output = "ls -a"
@BobCHub
BobCHub / ZSH and TMUX Setup.txt
Last active February 14, 2018 08:21
Zsh and TMUX Set up
################ Z Shell and OH-MY-ZSH #####################
Step 1: Install Updates, Git, and The Z Shell or zsh 
sudo apt-get update
sudo apt-get install zsh
sudo apt-get install git-core
install zsh
wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh
@BobCHub
BobCHub / CIDR_Conversion_Table.txt
Last active May 18, 2023 08:14
CIDR Conversion Table
CIDR Conversion Table
CIDR Dotted Number of Classfull Networks ---------|
prefix Decimal Hexidecimal Inverse |
length Netmask Netmask Netmask |
Binary | Number of Usable IPs
/1 128.0.0.0 80 00 00 00 127.255.255.255 1000 0000 0000 0000 0000 0000 0000 0000 128 As 2,147,483,646
/2 192.0.0.0 C0 00 00 00 63.255.255.255 1100 0000 0000 0000 0000 0000 0000 0000 64 As 1,073,741,822
/3 224.0.0.0 E0 00 00 00 31.255.255.255 1110 0000 0000 0000 0000 0000 0000 000
@BobCHub
BobCHub / Binary_Conversion_Chart.txt
Last active February 17, 2018 17:16
Decimal - Binary - Octal - Hex – ASCII Conversion Chart
Decimal - Binary - Octal - Hex – ASCII
Conversion Chart
Decimal Binary Octal Hex ASCII Decimal Binary Octal Hex ASCII Decimal Binary Octal Hex ASCII
Dec Binary Octal Hex ASCII Dec Binary Octal Hex ASCII Dec Binary Octal Hex ASCII Decimal Binary Octal Hex ASCII
0 00000000 000 00 NUL 32 00100000 040 20 SP 64 01000000 100 40 @ 96 01100000 140 60 `
1 00000001 001 01 SOH 33 00100001 041 21 ! 65 01000001 101 41 A 97 01100001 141 61 a
2 00000010 002 02 STX 34 00100010 042 22 “ 66 01000010 102 42 B 98 01100010 142 62 b
3 00000011 003 03 ETX 35 00100011 043 23 # 67 01000011 103 43 C 99 01100011 143 63 c
4 00000100 004 04 EOT 36 00100100 044 24 $ 68 01000100 104 44 D 100 01100100 144 6
@BobCHub
BobCHub / ufw_reference.txt
Last active September 26, 2022 18:28
ufw reference
Firewall with UFW 
sudo apt-get install ufw -------- Install ufw
sudo Vim /etc/default/ufw ------- Edit UFW configuration
sudo ufw reset ------------------ reset ufw rules
sudo ufw default deny incoming -- To set the defaults
sudo ufw default allow outgoing
sudo ufw allow https ------------ port 443 -- HTTPS connections, which is what encrypted web servers
sudo ufw allow ssh -------------- port 22 -- Configure your server to allow incoming SSH connections
sudo ufw allow 22
@BobCHub
BobCHub / Common_ports.txt
Last active April 27, 2023 21:15
Common ports
Port Numbers ---
Description
1 TCP Port Service Multiplexer (TCPMUX)
5 Remote Job Entry (RJE)
7 ECHO
18 Message Send Protocol (MSP)
20 FTP -- Data -- File Transfer Protocol (FTP): used for uploading and downloading files to and from a server.
21 FTP -- Control -- File Transfer Protocol (FTP): used for uploading and downloading files to and from a server.
22 SSH Remote Login Protocol ****
SSH
ifconfig --------------------------------------------------------------------- Find Address
sudo apt-get install openssh-server -------------------------------------------- Install the openssh-server package
sudo cp /etc/ssh/sshd_config /etc/ssh/sshd_config.factory-defaults ------------- Make a copy of the default SSH configura=on
and rename it as factory default
mkdir /home/username/.ssh ------------------------------------------------------ Created a for generated key will live
mkdir ~/.ssh ------------------------------------------------------------------- Create a directory for generated key will live
sudo chmod a-w /etc/ssh/sshd_config.factory-defaults --------------------------- modify its permissions chmod 700
@BobCHub
BobCHub / Github reference.txt
Last active February 17, 2018 17:13
Github reference
## -- Initializing a new git repository
$$ git init
## -- Useful git log commands
$$ git log --oneline ## print short sha in one line
$$ git log -3 ## show only first 3 commit
$$ git log --author="John" ## show commits only by this author
## -- Cloning a git repository
@BobCHub
BobCHub / TMUX.txt
Created February 17, 2018 17:37
TMUX Reference
#Running tmux
tmux can be run from within an terminal window by typing tmux
#Commands
tmux commands are introduced by hitting <CTRL>+b followed by the command.
# Sessions
@BobCHub
BobCHub / Bash_Reference1.txt
Created February 17, 2018 17:39
Bash_Reference1
#!/bin/bash
#####################################################
# Name: Bash CheatSheet for Mac OSX
#####################################################
# 0. Shortcuts.
CTRL+A # move to beginning of line