Skip to content

Instantly share code, notes, and snippets.

View MahmudHasanCSE's full-sized avatar
🎯
Focusing

Hasan MahmudHasanCSE

🎯
Focusing
View GitHub Profile
## Python:
# create venv
python -m venv venv
# python -m virtualenv .
# activate venv
source venv/bin/activate
# deactivate venv
##Command line instructions##
#Git global setup
git config --global user.name "Mahmud Al Hasan"
git config --global user.email "mahmud@datashall.com"
#Create a new repository
git clone https://gitlab.com/zero.fighter/test.git
cd test
touch README.md
@MahmudHasanCSE
MahmudHasanCSE / README.md
Created January 30, 2019 10:24 — forked from hofmannsven/README.md
My simply MySQL Command Line Cheatsheet
@MahmudHasanCSE
MahmudHasanCSE / README.md
Created January 29, 2019 16:24 — forked from hofmannsven/README.md
My simply Git Cheatsheet
@MahmudHasanCSE
MahmudHasanCSE / increment.py
Created January 2, 2019 09:45
Best way to increment of 1 in python?
# recursive abacus
def inc(x,n=0): return inc(x^(1<<n),inc(0,n)) if x&(1<<n) else x|x^(1<<n)
# there are 10 type of coders ...
lambda i: i++ (lambda j: j()**j())(type(i)) #halike
# dyslexia
lambda i: (sum(range(x))*2)/x # decrement #halike
# it's all about the context
a = int(input()) # direct input with casting
a,b=input().split() # input a and b
a,b=map(int,input().split()) # input a and b with casting
import os
import configparser # configparser to read the profiles.ini file in to determine which folder to use
mozilla_profile = os.path.join(os.getenv('APPDATA'), r'Mozilla\Firefox')
mozilla_profile_ini = os.path.join(mozilla_profile, r'profiles.ini')
profile = configparser.ConfigParser()
profile.read(mozilla_profile_ini)
data_path = os.path.normpath(os.path.join(mozilla_profile, profile.get('Profile0', 'Path')))
# os.path.normpath() is used to ensure backslashes are used.
def pow(a, n): # a^n --- O(log n)
if n == 0: return 1
if n == 1: return a
if n % 2 == 1:
return a * pow(a, n-1)
else:
p = pow(a, n/2)
return p * p
print(pow(2, 2))
# a^n --- O(n)
def pow(a, n):
result = 1.0
for _ in range(n):
result = result * a
return result
print(pow(2, 2))
import os
import sqlite3
import operator
from collections import OrderedDict
import matplotlib.pyplot as plt
import webbrowser as wb
def parse(url):
try:
parsed_url_components = url.split('//')