Skip to content

Instantly share code, notes, and snippets.

View YatinAdityaT's full-sized avatar
🙃
Learning...

Sabito YatinAdityaT

🙃
Learning...
View GitHub Profile
@YatinAdityaT
YatinAdityaT / clean.py
Created June 11, 2021 11:22
Remove all comments from a .py file
# use python clean.py -f <filename>
# not meant to be very smart (can't distinguish "a = "#test"" for example...)
import os
import argparse
import re
parser = argparse.ArgumentParser()
parser.add_argument('-f', '--file', type=str)
args = parser.parse_args()

Keybase proof

I hereby claim:

  • I am yatinadityat on github.
  • I am yatin_so (https://keybase.io/yatin_so) on keybase.
  • I have a public key ASCyPknqEcCXoEV2W0_PewP7ziMSNrSc8zBF3srWGxCNFAo

To claim this, I am signing this object:

@YatinAdityaT
YatinAdityaT / multiprocessing.py
Created July 21, 2020 02:03 — forked from thorsummoner/multiprocessing.py
python multiprocessing example
#!/usr/bin/env python3
""" Example multiprocess based python file
"""
import multiprocessing
import argparse
import itertools
ARGP = argparse.ArgumentParser(
@YatinAdityaT
YatinAdityaT / so.md
Last active August 2, 2020 03:48
Cool things people over at Stack Overflow say

"should realistically not play any role at all." And this is the disconnect: people have this annoying habit of acting like… well, humans. Messy, squishy, organic, fallible wetware that is exceptionally prone to both acting and reacting based on a combination of both emotion and rational thought with a highly variable balance, even with the same individual, depending on a wide (and wild) variety of factors. StackOverflow's largest collective sin is, in fact, not expecting humans to act like humans.

Hi, Andy. It is my hope that this message finds you in good health and better cheer! I'm waiting out a rainstorm here, the sort of fast and heavy summer rains common to the southern parts of Colorado - you may be familiar with them. But enough of these matters: I write to you today for a singular purpose, that of expressing my disagreement with your reasoning in the above answer. While I can certainly appreciate the desire for familiarity among peers on SO, ultimately I feel it serves only to distract casual r

@YatinAdityaT
YatinAdityaT / socp
Last active May 13, 2021 08:01 — forked from jforberg/socp
Stack Overflow copy pasta
<USEFUL LINKS>
MSE FAQ https://meta.stackexchange.com/questions/7931/faq-for-stack-exchange-sites
http://idownvotedbecau.se/
MSE answer for common terms used: https://meta.stackexchange.com/questions/40353/stack-exchange-glossary-dictionary-of-commonly-used-terms
Canonical answer for python files with same names as import files: https://stackoverflow.com/a/36250354/11573842
start()
value = 40
start_time = time.time()
readings = []
offset = 28876
x_offset = 0
starttime = time.time()
@YatinAdityaT
YatinAdityaT / dino.py
Created June 20, 2020 07:12
selenium dino game
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import StaleElementReferenceException
driver = webdriver.Firefox(executable_path=r'D:\Installers\geckodriver.exe') # path of your geckodriver and change firefox to Chrome....
driver.get('https://chromedino.com/')
driver.maximize_window()
driver.switch_to.window(driver.current_window_handle)
canvas = driver.find_element_by_css_selector('.runner-canvas')
if cv2.waitKey() == ord('q'):
cv2.destroyAllWindows()
PATH = 'Real Life Violence Dataset/Violence/V_10.mp4'
cap = cv2.VideoCapture(PATH)
fps = cap.get(cv2.CAP_PROP_FPS)
frame_count = cap.get(cv2.CAP_PROP_FRAME_COUNT)
duration = frame_count / fps
mid_point = frame_count//2
starting_point = mid_point-20
time_stamp = starting_point/fps
cap.set(cv2.CAP_PROP_POS_MSEC, time_stamp * 1000)