Skip to content

Instantly share code, notes, and snippets.

Avatar
🏴‍☠️
Why?

Rojen Zaman rojenzaman

🏴‍☠️
Why?
  • Anarchism
  • Istanbul, Turkey
  • 01:39 (UTC +03:00)
View GitHub Profile
@rojenzaman
rojenzaman / stack.yml
Last active Oct 17, 2022
Amusewiki Play With Docker
View stack.yml
# docker swarm-based
version: '3.8'
services:
app:
# texlive-base and texlive-full not supported due to size
image: rojen/amusewiki:package
environment:
#- PWD_HOST_FQDN=${PWD_HOST_FQDN}
- PWD_HOST_FQDN=labs.play-with-docker.com
- SESSION_ID=${SESSION_ID}
View dekstop-file-find.sh
#!/bin/bash
if [ "$#" -lt 1 ]; then
echo "$(basename "${0}") <name>"
exit 1
fi
find / -type f -name "*.desktop" -exec grep -Hn "${1}" "{}" \;
@rojenzaman
rojenzaman / myweechat.md
Created Apr 22, 2022 — forked from pascalpoitras/myweechat.md
My always up-to-date WeeChat configuration (weechat-dev)
View myweechat.md

WeeChat Screenshot

The squares in the chanmon buffer at the top of weechat in the gif above are there only to hide the nicknames and the messages in the gif to respect users privacies

You need at least WeeChat 3.5-dev

Enable mouse

/mouse enable
View Private_File_Sharing_Services.md
@rojenzaman
rojenzaman / emerg_open_error.sh
Created Feb 5, 2022
Solve: nginx: [emerg] open() error
View emerg_open_error.sh
mkdir -vp $(dirname "$(nginx -t |& grep '\[emerg\]' | awk '{print $4}' | sed 's/"//g')")
@rojenzaman
rojenzaman / merge_nginx_logrotated.sh
Last active Jan 16, 2022
Bash script to merge NGINX logrotate files.
View merge_nginx_logrotated.sh
#!/bin/bash
print_cron_rules() { echo "ClNFVCBDUk9OVEFCOgoKQGhvdXJseSAvdXNyL2Jpbi9tZXJnZV9uZ2lueF9sb2dyb3RhdGVkLnNoIC92YXIvbG9nL25naW54IGhvdXIKQGRhaWx5IC91c3IvYmluL21lcmdlX25naW54X2xvZ3JvdGF0ZWQuc2ggL3Zhci9sb2cvbmdpbnggZGF5CkB3ZWVrbHkgL3Vzci9iaW4vbWVyZ2VfbmdpbnhfbG9ncm90YXRlZC5zaCAvdmFyL2xvZy9uZ2lueCB3ZWVrCkBtb250aGx5IC91c3IvYmluL21lcmdlX25naW54X2xvZ3JvdGF0ZWQuc2ggL3Zhci9sb2cvbmdpbnggbW9udGgKCg==" | base64 -d; }
usage() { echo "Usage: ${BASH_SOURCE[0]} [DIR] [ hour | day | week | month ] <error>"; print_cron_rules; exit 1; } ; if [[ "$#" -lt 1 ]]; then usage; fi
DIR="$(realpath "${1}")"
TIME="${2:-hour}"
ERROR_LOG="${3:-false}"
ZSTD_LEVEL="19"
MERGE_ROTATED_LOCKFILE="/tmp/MERGE_ROTATED_IS_RUNNING.${TIME}.lock"
hour() { date +hour.%d-%m-%Y_%Hh%Mm%Ss.%A ; }
day() { date +day.%d-%m-%Y_%Hh%Mm.%A ; }
@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 / 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"