Skip to content

Instantly share code, notes, and snippets.

View rojenzaman's full-sized avatar
🏴
Why?

Rojen Zaman rojenzaman

🏴
Why?
  • localhost
  • Istanbul, Turkey
  • 18:29 (UTC +03:00)
View GitHub Profile
@rojenzaman
rojenzaman / site-archiver.sh
Created July 15, 2020 19:26
Site Archiver Script - For simple manage HTTRACK
#!/bin/bash
###config###
dir="~";
############
#variables
url=$1;
title=$2;
filename=archive-$(date +"%Y-%m-%d_%H-%M_%S").log;
@rojenzaman
rojenzaman / htaccess.sh
Created July 25, 2020 15:55
Set .htaccess file on bitnami dokuwiki (FOR PODMAN, NOT DOCKER)
#!/bin/bash
echo "ONLY FOR PODMAN"
conf_file=$(find ~/.local/share/containers/storage -name dokuwiki-htaccess.conf 2>/dev/null)
podman exec dokuwiki cat /opt/bitnami/dokuwiki/.htaccess.dist > /tmp/.htaccess
cat >> /tmp/.htaccess << EOF
@rojenzaman
rojenzaman / loweraccents.php
Created July 27, 2020 14:25
a little update for "Dokuwiki URL Slug". (especial for Turkish chracters)
<?php
/**
* UTF-8 lookup table for lower case accented letters
*
* This lookuptable defines replacements for accented characters from the ASCII-7
* range. This are lower case letters only.
*
* @author Andreas Gohr <andi@splitbrain.org>
* @see \dokuwiki\Utf8\Clean::deaccent()
*/
#!/bin/bash
curl -s ifconfig.co/json | jq -r "[.ip,.country,.city,.time_zone,.region_name,.asn,.asn_org,.hostname] | @tsv" > .tmp
while IFS=" " read -r ip country city time_zone region_name asn asn_org hostname; do
cat <<EOF
IP : $ip
Country : $country
City : $city
Time Zone : $time_zone
@rojenzaman
rojenzaman / lang-code-table.md
Last active August 22, 2020 20:21
Google Translate Language Codes Table
Afrikaans
Language ISO-639-1 Code
@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 / global404
Last active September 30, 2020 01:21
location = /404.html {
root /usr/share/nginx/error;
}
error_page 404 /404.html;
location = /50x.html {
root /usr/share/nginx/error;
}
error_page 500 502 503 504 /50x.html;
@rojenzaman
rojenzaman / create_wp_db.sh
Last active October 2, 2020 23:23
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 October 4, 2020 14:52
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