Skip to content

Instantly share code, notes, and snippets.

View phyodev's full-sized avatar
💭
I may be slow to respond.

Phyo Pyae Sone phyodev

💭
I may be slow to respond.
View GitHub Profile
@phyodev
phyodev / note.txt
Created May 20, 2026 03:09
Useful Tools & Software Windows10+
Windirstat
Process Lasso
@phyodev
phyodev / stack.py
Last active March 26, 2025 05:11
deque is optimized for fast appends and pops.
from collections import deque
stack = deque()
stack.append(10)
stack.append(20)
stack.append(30)
print(stack.pop()) # Output: 30
print(stack)
@phyodev
phyodev / ping_redis.py
Created March 24, 2025 09:44
pinging redis locally
import redis
r = redis.Redis(host='localhost', port=6379, db=0)
print(r.ping())
@phyodev
phyodev / clear-output.py
Created February 27, 2025 07:29
clear output after print
import sys
import time
for i in range(5):
print(f"\rIteration {i+1}", end='', flush=True) # Print the new value
sys.stdout.write("\r") # Clear the line first
time.sleep(0.2)
print("\nDone!") # Move to a new line after the loop
@phyodev
phyodev / special_decorator.py
Created December 5, 2024 05:07
This code implementation is like requesting to the server with credentials and checking authorization.
MY_TOKEN = 'TESTING123@#$'
class Request:
def __init__(self, token, method) -> None:
self.token = token
self.method = method
def check_authentication(func):
def wrapper(*args, **kwargs):
@phyodev
phyodev / binary_search.py
Created January 14, 2024 18:26
Algorithms implementation with my own idea.
target_element = 1
li = [1, 2, 5, 6, 7, 8, 10, 12, 9, 3, 4, 11, 13, 17, 17, 16, 14, 15]
li = sorted(li)
count = 0
li_len = len(li)
while True:
index = len(li) // 2
if li[index] == target_element:
@phyodev
phyodev / assignment3.py
Created August 1, 2023 10:55
Coding for Assignment 3
# Assignment 3
@phyodev
phyodev / main.py
Created April 2, 2023 11:02
This program is really simple which is for employee data with simple data table from terminal.
# from prettytable import PrettyTable
from tabulate import tabulate
# https://pyneng.readthedocs.io/en/latest/book/12_useful_modules/tabulate.html
class Employee:
def __init__(self, id, first_name, last_name, joined_date, position, pay) -> None:
self.id = id
self.first_name = first_name
self.last_name = last_name
@phyodev
phyodev / main.py
Created March 13, 2023 16:39
solve the problem
T = int(input())
if T > 0 and T < 10:
for i in range(T):
try:
a, b = map(int, input().split())
print(a//b)
except ZeroDivisionError as e:
print("Error Code:", e)
except ValueError as e:
@phyodev
phyodev / main.py
Created January 25, 2023 09:37
find runner up in scores
if __name__ == '__main__':
n = int(input())
arr = map(int, input().split())
print(sorted(set(list(arr)), reverse=True)[1])