Skip to content

Instantly share code, notes, and snippets.

View sharuzzaman's full-sized avatar
🛠️
Building

Sharuzzaman Ahmat Raslan sharuzzaman

🛠️
Building
View GitHub Profile
@sharuzzaman
sharuzzaman / genpassword.sh
Created July 16, 2024 00:40
This script will create a password with 12 alphanumeric character, split into 3 parts of 4 character each, and using dash "-" as the separator
#!/bin/bash
#
# This script will create a password with 12 alphanumeric character, split into 3 parts of 4 character each, and using dash "-" as
# the separator
#
# Example: pyYq-gFcn-jRa3
#
generate_password () {
@sharuzzaman
sharuzzaman / friday_13th.py
Created July 6, 2022 16:33
friday the 13th
from datetime import datetime
from datetime import timedelta
from datetime import date
def friday_the_13th():
today = date.today()
current_month = today.month
current_year = today.year
@sharuzzaman
sharuzzaman / check_ssl_cert.py
Created February 17, 2022 06:48
python get info for expired SSL cert
#!/bin/env python3
# check_ssl_cert.py - python get info for expired SSL cert
# Copyright 2022 Sharuzzaman Ahmat Raslan <sharuzzaman@gmail.com>
# This program is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
# This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
# You should have received a copy of the GNU Lesser General Public License along with this program. If not, see https://www.gnu.org/licenses/.
from cryptography import x509
@sharuzzaman
sharuzzaman / pdf_decrypt.sh
Created August 14, 2021 12:08
decrypt pdf file and save into new pdf file / remove pdf password
qpdf.exe --password=<password> --decrypt ./encrypted_pdf_file.pdf ./decrypted_pdf_file.pdf
@sharuzzaman
sharuzzaman / get_devices_in_running_ec2_instance.sh
Last active May 19, 2020 09:23
Get a list of devices for each running EC2 instances sorted by name
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '[.Reservations[]|.Instances[]|{Name: .Tags[]|select(.Key == "Name").Value,DeviceName: [.BlockDeviceMappings[]|.DeviceName]}]|sort_by(.Name)' ec2.json
@sharuzzaman
sharuzzaman / get_ec2_instance_sort_by_name.sh
Created May 6, 2020 20:47
Get a list of EC2 instances that is currently running, and sort its output by name
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '.Reservations[]|.Instances[]|{InstanceId,PrivateIpAddress,Name: .Tags[]|select(.Key == "Name").Value}' | jq -n '[inputs]|sort_by(.Name)'
@sharuzzaman
sharuzzaman / get_ec2_instance.sh
Created May 6, 2020 16:30
Get a list of EC2 instance which are running
aws ec2 describe-instances --filters "Name=instance-state-name,Values=running" | jq '.Reservations[]|.Instances[]|{InstanceId,PrivateIpAddress,Name: .Tags[]|select(.Key == "Name").Value}'
@sharuzzaman
sharuzzaman / sunday_in_year.py
Created January 13, 2020 08:40
last sunday of the month for the year
#!/bin/env python3
import calendar
import datetime
now = datetime.datetime.now()
cal = calendar.Calendar()
month = 1
@sharuzzaman
sharuzzaman / convert_A4.sh
Created December 16, 2019 11:16
converting Gimp exported PDF to A4 size PDF
#!/bin/bash
ps2pdf -sPAPERSIZE=a4 -dFIXEDMEDIA -dPDFFitPage input.pdf output.pdf
@sharuzzaman
sharuzzaman / quick_bash_esolat_my.sh
Last active November 26, 2019 03:13
Quick bash script to get the solat time
#!/bin/bash
curl "https://www.e-solat.gov.my/index.php?r=esolatApi/TakwimSolat&period=today&zone=SGR01" 2>/dev/null| sed 's/,/,\n/g' | egrep 'imsak|fajr|syuruk|dhuhr|asr|maghrib|isha' | tr -dc '[:alnum:]\n:' | sed 's/:/ /'