Skip to content

Instantly share code, notes, and snippets.

View ayushkumarshah's full-sized avatar
🏠
Working from home

Ayush Kumar Shah ayushkumarshah

🏠
Working from home
View GitHub Profile
@ayushkumarshah
ayushkumarshah / csv.py
Created February 9, 2021 12:31 — forked from cccntu/csv.py
python mmap to concatenate csv files
❯ rm out.csv
❯ cat 1.py
from glob import glob
import mmap
files = glob("data/*")
files.sort(key=lambda x: int(x.split("/")[-1].split(".")[0]))
write_f = open("out.csv", "w+b")
def my_function():
print('Hi')
print(my_function)
# <function my_function at 0x7efea5c36050>
def send_email_ses(email_message):
print(f'Send email using AWS SES: {email_message}')
@ayushkumarshah
ayushkumarshah / install_latex_dependencies.sh
Created August 27, 2020 16:10
Install necessary latex dependencies
sudo tlmgr install pgf
sudo tlmgr install titling
sudo tlmgr install xcolor
sudo tlmgr install environ
sudo tlmgr install trimspaces
sudo tlmgr install mathpazo
sudo tlmgr install parskip
sudo tlmgr install adjustbox
sudo tlmgr install collectbox
sudo tlmgr install eurosym
@ayushkumarshah
ayushkumarshah / airpaint.py
Last active August 27, 2020 10:22
Code for running an air painter application using OpenCV
import cv2
import numpy as np
from collections import deque
class Airpainter(object):
"""
An airpainter application.
The application takes video feed as input and outputs lines tracked.
Attributes
import argparse
import os, glob
parser = argparse.ArgumentParser()
def dir_path(string):
if os.path.isdir(string):
return string
else:
@ayushkumarshah
ayushkumarshah / processing.py
Last active June 1, 2020 14:44
Pandas pipeline
import numpy as mp
import pandas as pd
import datetime as dt
def df_info(f):
def wrapper(df, *args, **kwargs):
tic = dt.datetime.now()
result = f(df, *args, **kwargs)
toc = dt.datetime.now()
print("\n\n{} took {} time\n".format(f.__name__, toc - tic))