Skip to content

Instantly share code, notes, and snippets.

View SharafatKarim's full-sized avatar
🎯
focusing...

Sharafat Karim SharafatKarim

🎯
focusing...
View GitHub Profile

linux-server

Initial Linux Server Setup Guide

This guide covers the initial setup process for a new Linux server, focusing on basic security and maintenance tasks.

1. Update and Upgrade System Packages (Must-Do)

Keeping your system packages up to date is crucial for security and stability.

@SharafatKarim
SharafatKarim / IUPC contest sites blocking script.bat
Created November 30, 2024 01:36
A simple windows batch script to block every single unwanted websites, except one!
@echo off
setlocal enabledelayedexpansion
:menu
cls
echo Site-Blocker
echo -----------------
echo 1. Block everything except toph.co and its subdomains
echo 2. Restore hosts file from backup
echo 3. Exit
@SharafatKarim
SharafatKarim / break.sh
Created July 24, 2023 09:30
A bash script to remind you to take a break once in 20 minutes! (128K average ram usage)
#!/bin/bash
# Function to display the break reminder notification
function show_notification()
{
notify-send "Take a Break" "It's time for a 20-minute break!"
}
# Main loop to remind every 20 minutes
while true; do
# sharafat specials
# bash script to automate running a single c file
#
# to use, just put those lines in your bashrc/ zshrc,
# restart your shell or source from bashrc/ zshrc
# in any directory you can just type
# cl file_path/file_name.cpp
#
# (c file compile and run and then delete the compiled binary, all in one)
# it should work out of the box for c and c++
@SharafatKarim
SharafatKarim / pymongo_to_csv.py
Created January 22, 2023 13:05
A simple program to convert pymongo data to csv file by using 'pymongo' and 'pandas'
# @Author: Sharafat Karim
# @Date: 6:59 PM Sunday, 22 January 2023
# @Email: [email protected]
# @Last modified time: 6:59 PM Sunday, 22 January 2023
# @Credit: https://kb.objectrocket.com/mongo-db/export-mongodb-documents-as-csv-html-and-json-files-in-python-using-pandas-347
# Pip packages import
try:
# library import
import pymongo
@SharafatKarim
SharafatKarim / tic_tac_toe.py
Last active November 4, 2023 08:39
Tick-tack-toe game with python. Supports singleplayer (easy mode for now) and multiplayer!
# Global variables
one = "1"
two = "2"
three = "3"
four = "4"
five = "5"
six = "6"
seven = "7"
eight = "8"
nine = "9"
@SharafatKarim
SharafatKarim / simple_two_cipher.py
Created November 16, 2022 04:08
Caesar Cipher and The Vigenère Cipher - encoder or decoder
# Caesar Cipher!
def decoder(message, offset):
result=""
for i in range(len(message)):
if not(ord("a")<=ord(message[i])<=ord("z")):
result+=message[i]
continue
elif ord(message[i])+offset>ord("z"):
result += chr(ord(message[i])-26+offset)
@SharafatKarim
SharafatKarim / best_value.py
Created November 16, 2022 04:05
A simple program to help to find the best item! Suppose first column refers to the price, second one amount and the third refers to validity. Validity (third column) is an optional thing and may not be present. You have to find the best value (Amount divided by price) out of all of them. Then sort them.
Price = [9,13,7,18,10,76,10,76,33,63,113,19,49,23,49,23,19,31,51,42,66,29,30,36,116,91]
Value = [100,100,150,200,250,300,250,300,300,300,300,300,400,400,400,400,500,512,512,512,512,512,1000,1000,1000,1000]
Validity = []
Price = []
Value = []
def Validity_to_store():
print("Do you also want to store validity data? ")
k = input()[0]
@SharafatKarim
SharafatKarim / linked_list_python.py
Last active December 23, 2022 12:19
Linked List with python (inspired from Md. Redwan Hossain)
class Node:
def __init__(self, value=None):
self.val = value
self.next_val = None
class Link:
def __init__(self):
self.primary_value = Node()
def append_to_list(self,value=None):
@SharafatKarim
SharafatKarim / Reading Speed Test.py
Created October 28, 2022 14:06
This code will detect your reading speed and also can help you to increase your reading speed! Give it a try...
# variables
text= """
Reading is becoming more and more important in the new knowledge economy and remains the most effective human activity for transforming information into knowledge.
If top readers read at speeds of above 1000 words per minute (wpm) with near 85% comprehension, they only represent 1% of readers. Average readers are the majority and only reach around 200 wpm with a typical comprehension of 60%. This seems surprising since most readers, actively reading work documents, newspapers, magazines, books or the contents of a computer display are practicing daily for at least one hour. With such an intense training everyone should be close to top performances.
Unfortunately, this is far from the real situation. The average reader is five times slower than the good reader. Things are even worse if we consider reading efficiency as well as speed. Reading efficiency is reading speed weighted by comprehension rate and it amounts to 200 x 60% or 120 efficient words per minute (ewpm) for the average re