Skip to content

Instantly share code, notes, and snippets.

View azhar22k's full-sized avatar
🐚
Seek and ye shall find

Azhar Khan azhar22k

🐚
Seek and ye shall find
View GitHub Profile
@azhar22k
azhar22k / gist:42d76b6c56c31f447b84dbeafbe8b7e6
Created February 28, 2018 05:00 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup

People

:bowtie: :bowtie: 😄 :smile: 😆 :laughing:
😊 :blush: 😃 :smiley: ☺️ :relaxed:
😏 :smirk: 😍 :heart_eyes: 😘 :kissing_heart:
😚 :kissing_closed_eyes: 😳 :flushed: 😌 :relieved:
😆 :satisfied: 😁 :grin: 😉 :wink:
😜 :stuck_out_tongue_winking_eye: 😝 :stuck_out_tongue_closed_eyes: 😀 :grinning:
😗 :kissing: 😙 :kissing_smiling_eyes: 😛 :stuck_out_tongue:
@azhar22k
azhar22k / sqlServerConnection.py
Created May 15, 2017 11:31
Sample code to connect to MS SQL Server using python3
#!/usr/bin/python3
def sqlServerConnect(driverType,pip, pdbname, pusername="", ppwd=""):
from pyodbc import connect
try:
#trying to create a cnnection
connection = connect(driver=driverType, host=pip, database=pdbname, user=pusername,password=ppwd)
print("Connection successful : "+driverType+" "+pip+" "+" "+pdbname+" "+pusername)
return connection
except Exception as e:
#connection creation failed
@azhar22k
azhar22k / Numpy.json
Created September 1, 2016 14:57
Numpy Array Practice via introduction
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@azhar22k
azhar22k / mapit.py
Created August 21, 2016 16:46
Python script to open google maps of a place, either using clipboard or command line arguments
#webbrowser module helps in open default web browser of os
from webbrowser import open
#sys contains command line arguments
from sys import argv
#pyperclip is a third party module used to access clipbord
#pip3 install pyperclip
#python3 -m pip install pyperclip
from pyperclip import paste
if len(argv)>1:
address = " ".join(argv[1:])
import pyperclip
c=input('Enter text you want to copy: ')
pyperclip.copy(c)
print('\n'+c+" is on your clip board now, press any key to paste it on stdoutput")
input('')
print(pyperclip.paste())
@azhar22k
azhar22k / birthdayProgram.py
Created June 30, 2016 11:44
Program to read birthdate and display birthday month and calculate days till next birthday
#Read birthdate and display birthday manth
import datetime
birthday=input("What is your birthday date['yyyy-mm-dd' format] ")
birthday=datetime.datetime.strptime(birthday,"%Y-%m-%d").date()
print("Birthday month is "+birthday.strftime('%B'))
@azhar22k
azhar22k / DirectorySize.py
Created June 30, 2016 10:21
The following script tells the size of directory in which it is run. Tested on Unix but should also work with with Windows
import os
totalSize = 0
for filename in os.listdir(os.getcwd()):
if not os.path.isfile(os.path.join(os.getcwd(),filename)):
continue
totalSize = totalSize + os.path.getsize(os.path.join(os.getcwd(),filename))
print("Total Size of current working directory is {0:.2f} Kilo bytes".format(totalSize/1024))