Skip to content

Instantly share code, notes, and snippets.

View Himan10's full-sized avatar
🎧
The Armored Entity

Himan10

🎧
The Armored Entity
View GitHub Profile
"""
Read/Extract Mails using python
Requirements :
1. imaplib, 2. OS, 3. base64, 4. email
5. emai.parser -> BytesParser (for parsing the data
stored inside a file or variable).
"""
import imaplib # For reading messages
import logging # For catching logs
@Himan10
Himan10 / basic_bot.py
Created February 18, 2020 20:10
Checking basic functionality of discord bot
#/home/hi-man/anaconda3/bin/python
import os
import discord
from dotenv import load_dotenv
load_dotenv()
token = os.getenv('DISCORD_TOKEN')
guild = os.getenv('CONSTRUCT_CODES')
client = discord.Client()
@Himan10
Himan10 / LinkedBinaryTree.py
Created January 24, 2020 10:40
Implementation of Linked Binary Tree DS
# Implementing Linked Binary Tree
# ____________
# |L |PARENT|R_|
# |L_|_DATA_|R_|
from tree import BinaryTree
class LinkedBinaryTree(BinaryTree):
class _Node:
@Himan10
Himan10 / matrices.py
Last active January 14, 2020 08:33
codathon Day2 Matrix Problem ...
# creating n*n matrix
# Partially solved
import numpy as np
from sys import stdin, stdout
def printDiagonalSum(mat, n):
sum_ = 0
for i in range(0, n):
sum_ += mat[i,i]
@Himan10
Himan10 / aoc_day4.py
Last active December 4, 2019 13:07
Solution for Advent of code.. Day4 problem.
class Stack:
def __init__(self, n):
self.array = []
self.n = n
def __len__(self):
return len(self.array)
def is_empty(self):
@Himan10
Himan10 / blackjack.py
Last active November 9, 2019 07:13
Hand of Black_Jack (command line card game)
import random
suits = ('Hearts', 'Diamonds', 'Spades', 'Clubs')
ranks = ('Two', 'Three', 'Four', 'Five', 'Six', 'Seven', 'Eight', 'Nine', 'Ten', 'Jack', 'Queen', 'King', 'Ace')
values = {'Two':2, 'Three':3, 'Four':4, 'Five':5, 'Six':6, 'Seven':7, 'Eight':8, 'Nine':9, 'Ten':10, 'Jack':10, 'Queen':10, 'King':10, 'Ace':11}
playing = True
class Card:
def __init__(self, suits, ranks):
@Himan10
Himan10 / tic_tac_toe_tie.py
Last active August 1, 2019 11:48
TIC TAC TOE - Making a game TIE
""" Playing Tic Tac Toe with Computer """
import random
BOARD_VALUE = {}
for number in range(1, 10):
BOARD_VALUE[number] = " "
COMP_MOVES = BOARD_VALUE.keys()
COMP_MOVES = list(COMP_MOVES)
import string
import time
# pattern = r'[\W_ ]' - regex pattern
def convert(data):
new_data = ''
for i in range(0, len(data)):
if data[i] in string.ascii_letters:
@Himan10
Himan10 / remove_punctuations.py
Last active July 5, 2019 14:22
Several methods for removing punctuations from items inside list
import time
import re
import string
pattern = r".*?[\W]+"
# 1 - enumerate and methods
data = [
"Correct,",
@Himan10
Himan10 / filesearching.py
Last active June 14, 2019 15:54
Regex and OS based searching from any location/path.
# Regex -> Searching , Sending
import os
import re
import shutil
import sys
from time import sleep
from pprint import pprint
found_files = []