Skip to content

Instantly share code, notes, and snippets.

View yashketkar's full-sized avatar

Yash Ketkar yashketkar

View GitHub Profile
@yashketkar
yashketkar / fixemails.py
Created August 3, 2024 16:58
Python script to fix emails exported from Skiff for import into Proton using ProtonMail Import-Export App
import os
import re
from email.utils import format_datetime, parsedate_to_datetime
import dateutil.parser
path = os.getcwd()
emlFiles = []
for (root, subdirs, files) in os.walk(path):
@yashketkar
yashketkar / cassidoo_problem_08232020.py
Created August 24, 2020 16:39
Given a string s and a character c, return the number of occurrences of c in s.
def numChars(s, c):
count = 0
for i in s:
if c == i:
count += 1
return count
print(numChars('oh heavens', 'h'))
# -*- coding: utf-8 -*-
"""
Spyder Editor
This is a temporary script file.
"""
import numpy as np
from pandas import Series
from scipy.stats import rv_discrete
@yashketkar
yashketkar / numpad.py
Last active March 10, 2017 19:02
How many distinct 7-digit numbers can you dial on a standard phone (layout: 123\\456\\789\\*0#) if you must start at the '0' and move only as a knight does in chess (an 'L')? (Numbers mustn't include * or #.)
#!/bin/python
# How many distinct 7-digit numbers can you dial on a standard phone (layout: 123\\456\\789\\*0#)
# if you must start at the '0' and move only as a knight does in chess (an 'L')?
# (Numbers mustn't include * or #.)
successor = {}
successor[0]=[4,6]
successor[1]=[6,8]
successor[2]=[7,9]