Skip to content

Instantly share code, notes, and snippets.

Avatar
🏴
revolution

Rojen Zaman rojenzaman

🏴
revolution
View GitHub Profile
@rojenzaman
rojenzaman / rss-pubdate.sh
Created Jan 19, 2021
Create RSS pubDate with BASH
View rss-pubdate.sh
#format: Tue, 19 Jan 2021 19:07:07 +0300
TZ=`date +"%z"`
TIME=`date +"%H:%M:%S"`
WEEKDAY=`date +"%a"`
DATE=`date +"%d"`
MONTH=`date +"%b"`
YEAR=`date +"%Y"`
FORMATED_DATE_TIME="$WEEKDAY, $DATE $MONTH $YEAR $TIME $TZ"
echo "Formated time: $FORMATED_DATE_TIME"
@rojenzaman
rojenzaman / count_ip.sh
Created Aug 11, 2021
Count IP address in Nginx access logs
View count_ip.sh
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "Usage: `basename $0` <access.log>"
exit 1
fi
awk '{print $1}' "${1}" | sort | uniq -c | sort -nr
@rojenzaman
rojenzaman / dynmotd
Last active Aug 3, 2021 — forked from cha55son/dynmotd
RHEL (Centos/Fedora) dynamic motd
View dynmotd
#!/bin/bash
# Installation:
#
# 1. nano /etc/ssh/sshd_config
# PrintMotd no
#
# 2. nano /etc/profile
# /usr/bin/dynmotd # Place at the bottom
#
@rojenzaman
rojenzaman / README.md
Created Jun 18, 2021
Spotify Adblock Fedora 34
View README.md

Spotify Adblock Fedora 34

Install Spotify

First install the spotify package from negativo17's repository.

Enable negativo17 repo:

dnf config-manager --add-repo=https://negativo17.org/repos/fedora-spotify.repo
@rojenzaman
rojenzaman / parse-url.sh
Created Jul 16, 2021
Parse URL in bash script
View parse-url.sh
#!/bin/bash
#SOURCE: https://janikvonrotz.ch/2021/03/09/parse-url-in-shell-script/
set -e
# Get script name
SCRIPT=$(basename "$0")
# Display Help
Help() {
@rojenzaman
rojenzaman / date.txt
Last active Jul 13, 2021
date command: W3C "complete date plus hours, minutes and seconds" format
View date.txt
date +"%Y-%m-%dT%H:%M:%S%:z"
@rojenzaman
rojenzaman / answerfile
Last active Jul 1, 2021 — forked from oofnikj/answerfile
Install Docker on Termux
View answerfile
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@rojenzaman
rojenzaman / systemctl
Created Jul 1, 2021
Emulate systemctl for runit installed termux
View systemctl
#!/bin/bash
# Emulate systemctl for runit installed termux.
function check_command() { [ -x "$(command -v ${1})" ] || { echo -e "\e[31m${1} not found, please install it.\e[0m" ; return 1 ; } }
if ! check_command sv; then
if ! check_command sv-enable; then
if ! check_command sv-disable; then
exit 1
fi
@rojenzaman
rojenzaman / telegram-send.sh
Created Jun 30, 2021
Send mp3 files via telegram with checking their hashsums.
View telegram-send.sh
#!/bin/bash
cd "$(dirname "${BASH_SOURCE[0]}")"
LIST=".nosend"
[ -f ${LIST} ] || touch ${LIST}
shopt -s expand_aliases
SLEEP="2"
USAGE="--send | --dry"
function check_command() { [ -x "$(command -v ${1})" ] || { echo -e "\e[31m${1} not found, please install it.\e[0m" ; return 1 ; } }
@rojenzaman
rojenzaman / httpstatus
Last active Jun 27, 2021 — forked from rsvp/httpstatus
httpstatus : bash script to get HTTP response code with optional status message (includes return true or false)
View httpstatus
#!/bin/bash
URL="${1}"
UserAgent="[HTTPSTATUS]:[https://git.io/JcTUF]"
if [ "$#" -lt 1 ]; then
echo "Usage: ./`basename $0` URL"
exit 1
fi
function unknown_status() {