Skip to content

Instantly share code, notes, and snippets.

View MohanSha's full-sized avatar
👨‍💻
Hello stranger looking at my work!

Mohan Sha MohanSha

👨‍💻
Hello stranger looking at my work!
View GitHub Profile
@MohanSha
MohanSha / AtomicTime.py
Created February 13, 2018 08:52
This program will get the true atomic time from an atomic time clock on the Internet
#!usr/bin/env python
# Get Atomic Time from Internet Clock
# This program will get the true atomic time from an atomic time clock on the
# Internet. There are various clocks across the world.
# Do a search for a list of them.
import urllib2
from bs4 import BeautifulSoup
@MohanSha
MohanSha / CalcArea.py
Created February 13, 2018 08:54
Create an abstract class called Shape and then inherit from it other shapes like diamond, rectangle, circle, triangle etc. Then have each class override the area and perimeter functionality to handle each shape type.
# Shape Area and Perimeter Classes
# Create an abstract class called Shape and then inherit
# from it other shapes like diamond, rectangle, circle, triangle etc.
# Then have each class override the area and perimeter functionality to handle each shape type.
import math
class Shape(object):
def __init__(self):
@MohanSha
MohanSha / Snake.py
Created February 13, 2018 10:08
Classic Snake Game
import pygame
import random
import sys
from pygame.locals import *
def collide(x1,x2,y1,y2,wh):
w1=20;
w2=wh;
h2=wh;
h1=20;
if x1+w1>x2 and x1<x2+w2 and y1+h1>y2 and y1<y2+h2:
@MohanSha
MohanSha / RockPaperScissorsLizardSpock.py
Created February 13, 2018 10:13
Based on The Big Bang Theory Sheldon's game
# Rock-paper-scissors-lizard-Spock template
# The key idea of this program is to equate the strings
# "rock", "paper", "scissors", "lizard", "Spock" to numbers
# as follows:
#
# 0 - rock
# 1 - Spock
# 2 - paper
# template for "Guess the number" mini-project
# input will come from buttons and an input field
# all output for the game will be printed in the console
"""import some modules"""
import random, simplegui
# initialize global variables used in your code
secret_number = random.randrange(0, 100)
secret_number_range = 100
# template for "Guess the number" mini-project
# input will come from buttons and an input field
# all output for the game will be printed in the console
"""import some modules"""
import random, simplegui
# initialize global variables used in your code
secret_number = random.randrange(0, 100)
secret_number_range = 100
#!/usr/bin/env python
## TODO: less mixed file types DONE
## TODO: less ramifications (truncate after a certain depth) DONE
## TODO: file/dir modification and removal DONE
from __future__ import print_function
import os, random, string, subprocess, time, shutil, md5
extensions = ['css', 'js', 'html', 'cpp', 'txt', 'png', 'c']
def make_empty_file(path, name):
@MohanSha
MohanSha / cloudMail.py
Last active July 2, 2018 15:46
Send email from a cloud server
SERVER = "outlook.office365.com"
FROM = "mohan.sha@qubecinema.com"
TO = ["mohan.sha@qubecinema.com"] # must be a list
SUBJECT = "Cloud Test mail"
TEXT = "This mail was sent from mohan.sha@qubecinema.com email"
# Prepare actual message
message = """From: %s\r\nTo: %s\r\nSubject: %s\r\n\
<?
/////////////////////
// slack2html
// by @levelsio
/////////////////////
//
/////////////////////
// WHAT DOES THIS DO?
/////////////////////
//
@MohanSha
MohanSha / slack_history.py
Created September 18, 2018 21:11 — forked from minniel/slack_history.py
Download Slack Channel/PrivateChannel/DirectMessage History
from slacker import Slacker
import json
import argparse
import os
import shutil
import copy
from datetime import datetime
# This script finds all channels, private channels and direct messages
# that your user participates in, downloads the complete history for