Skip to content

Instantly share code, notes, and snippets.

View rojenzaman's full-sized avatar
🏴
Why?

Rojen Zaman rojenzaman

🏴
Why?
  • localhost
  • Istanbul, Turkey
  • 08:03 (UTC +03:00)
View GitHub Profile
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 / 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 / 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 / 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
@rojenzaman
rojenzaman / url-shortener.sh
Created July 15, 2020 19:30
Static Url Shortener
#!/bin/bash
if [ "$#" -lt 2 ]; then
echo "./`basename $0` <write url here> <write your site directory here> [second] [\"title\"] [\"html code or txt\"]";
exit 1;
fi
url=$1
directory=$2
if [ "$#" -gt 1 ]; then
@rojenzaman
rojenzaman / TTS.sh
Created December 10, 2020 21:09
Simple Text To Speech (Bash Script - Google TTS)
#!/bin/bash
# Author: Rojen Zaman <rojen@riseup.net>
# License: GPLv3
# Source Code: https://github.com/rojenzaman/google-translate-mp3-download
# Modified for ChildConsole
#
# Usage:
# $ TTS.sh -l en -t "Hello World!"
[ -x "$(command -v ffplay)" ] || { echo "ffplay not found, please install it." ; exit 1 ; }
@rojenzaman
rojenzaman / curl.sh
Created November 26, 2020 04:07
Bash get file from web to stdout without curl or wget as using /dev/tcp
function __curl() {
read proto server path <<<$(echo ${1//// })
DOC=/${path// //}
HOST=${server//:*}
PORT=${server//*:}
[[ x"${HOST}" == x"${PORT}" ]] && PORT=80
exec 3<>/dev/tcp/${HOST}/$PORT
echo -en "GET ${DOC} HTTP/1.0\r\nHost: ${HOST}\r\n\r\n" >&3
(while read line; do
@rojenzaman
rojenzaman / README.md
Last active December 10, 2020 21:13
Bash Style Guide and Coding Standard
@rojenzaman
rojenzaman / save_dnfLog.sh
Last active December 13, 2020 22:38
Save DNF installed packege log.
#!/bin/bash
script_dir=$(dirname $(readlink -f $0)) # script dir
function guide() {
echo "usage: ./`basename $0` [-u] [-s <app_name>]"
echo "-u update log"
echo "-s specific app log"
echo "-l list packages"
}
@rojenzaman
rojenzaman / auth.sh
Last active December 15, 2020 20:45
TTYD auth
#!/bin/bash
cat <<EOF
welcome user.
EOF
while :
do