Skip to content

Instantly share code, notes, and snippets.

Avatar
🐚
Seek and ye shall find

Azhar Khan azhar22k

🐚
Seek and ye shall find
View GitHub Profile
@azhar22k
azhar22k / birthdayProgram.py
Created Jun 30, 2016
Program to read birthdate and display birthday month and calculate days till next birthday
View birthdayProgram.py
#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 Jun 30, 2016
The following script tells the size of directory in which it is run. Tested on Unix but should also work with with Windows
View DirectorySize.py
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))
View ClipBoard.py
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 / mapit.py
Created Aug 21, 2016
Python script to open google maps of a place, either using clipboard or command line arguments
View mapit.py
#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:])
@azhar22k
azhar22k / Numpy.json
Created Sep 1, 2016
Numpy Array Practice via introduction
View Numpy.json
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"metadata": {
"collapsed": true
},
"outputs": [],
"source": [
@azhar22k
azhar22k / sqlServerConnection.py
Created May 15, 2017
Sample code to connect to MS SQL Server using python3
View sqlServerConnection.py
#!/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 / gist:42d76b6c56c31f447b84dbeafbe8b7e6
Created Feb 28, 2018 — forked from rxaviers/gist:7360908
Complete list of github markdown emoji markup
View gist:42d76b6c56c31f447b84dbeafbe8b7e6

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: