Skip to content

Instantly share code, notes, and snippets.

View rojenzaman's full-sized avatar
🏴
Why?

Rojen Zaman rojenzaman

🏴
Why?
  • localhost
  • Istanbul, Turkey
  • 16:41 (UTC +03:00)
View GitHub Profile
@rojenzaman
rojenzaman / parse.sh
Created September 6, 2020 19:04
/var/log/auth.log parse
grep -o "[0-9]\+\.[0-9]\+\.[0-9]\+\.[0-9]\+" auth.log | sort | uniq -c | sort -n
rsync -av -f"+ */" -f"- *" "$source" "$target"
@rojenzaman
rojenzaman / create_wp_db.sh
Last active September 6, 2024 12:20
with mysql root
#!/bin/bash
if [ "$#" -lt 4 ]; then
echo "`basename $0` <mysql-root-passwd> <db user> <ip> <db password>";
exit 1;
fi
mysql --user=root --password=$1 <<EOF
CREATE DATABASE wordpress;
CREATE USER '$2'@'$3' IDENTIFIED BY '$4';
@rojenzaman
rojenzaman / ptsConsole.sh
Last active September 8, 2024 21:07
PTS SSH - Execute a command at another PTS Device - Not SSL :)
#!/bin/bash -e
tty=$(/bin/tty)
ttyRemote="$1"
ptsprogram="/root/bin/ptsSSH"
while :
do
read -p "$ttyRemote> " input
$ptsprogram -n $ttyRemote "$input > $tty";
done
@rojenzaman
rojenzaman / README.md
Last active December 10, 2020 21:13
Bash Style Guide and Coding Standard
var mediaJSON = { "categories" : [ { "name" : "Movies",
"videos" : [
{ "description" : "Big Buck Bunny tells the story of a giant rabbit with a heart bigger than himself. When one sunny day three rodents rudely harass him, something snaps... and the rabbit ain't no bunny anymore! In the typical cartoon tradition he prepares the nasty rodents a comical revenge.\n\nLicensed under the Creative Commons Attribution license\nhttp://www.bigbuckbunny.org",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/BigBuckBunny.mp4" ],
"subtitle" : "By Blender Foundation",
"thumb" : "images/BigBuckBunny.jpg",
"title" : "Big Buck Bunny"
},
{ "description" : "The first Blender Open Movie from 2006",
"sources" : [ "http://commondatastorage.googleapis.com/gtv-videos-bucket/sample/ElephantsDream.mp4" ],
@rojenzaman
rojenzaman / tempuser.sh
Created November 18, 2020 13:52
sudo ./tempuser.sh
tempuser=`echo "$RANDOM"| md5sum| head -c 10`;
useradd -e `date -d "1 days" +"%Y-%m-%d"` $tempuser;
su - $tempuser
@rojenzaman
rojenzaman / common-ip.sh
Last active November 21, 2020 14:53
List most repeated IP addresses.
awk '{a[$1]++} END {for (i in a) print a[i],i | "sort -rnk1"}' $1
@rojenzaman
rojenzaman / dynmotd
Last active May 16, 2024 21:55 — forked from cha55son/dynmotd
RHEL (Centos/Fedora) dynamic motd
#!/bin/bash
# Installation:
#
# 1. nano /etc/ssh/sshd_config
# PrintMotd no
#
# 2. nano /etc/profile
# /usr/bin/dynmotd # Place at the bottom
#
@rojenzaman
rojenzaman / install.sh
Last active November 21, 2020 20:46
Fedora - Install All Groups and Environments
#!/bin/bash
# For pure Fedora 33 server:
# Total download size: 5.8 G
# Installed size: 21 G
# Installed packages count: 5117
cat <<EOF
Following groups are will be installed:
"Fedora Custom Operating System" "Minimal Install" "Fedora Server Edition" "Fedora Workstation" "Fedora Cloud Server" "KDE Plasma Workspaces" "Xfce Desktop" "LXDE Desktop" "LXQt Desktop" "Cinnamon Desktop" "MATE Desktop" "Sugar Desktop Environment" "Deepin Desktop" "Development and Creative Workstation" "Web Server" "Infrastructure Server" "Basic Desktop" "3D Printing" "Administration Tools" "Audio Production" "Authoring and Publishing" "C Development Tools and Libraries" "Cloud Infrastructure" "Cloud Management Tools" "Compiz" "Container Management" "D Development Tools and Libraries" "Design Suite" "Development Tools" "Domain Membership" "Fedora Eclipse" "Editors" "Educational Software" "Electronic Lab" "Engineering and Scientific" "FreeIPA Server" "Games and Entertainment" "Headless Management" "LibreOffice" "MATE Applications" "Mi