Skip to content

Instantly share code, notes, and snippets.

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

Sabito YatinAdityaT

🙃
Learning...
View GitHub Profile
@YatinAdityaT
YatinAdityaT / draw_neural_net.py
Created July 30, 2019 14:08 — forked from craffel/draw_neural_net.py
Draw a neural network diagram with matplotlib!
import matplotlib.pyplot as plt
def draw_neural_net(ax, left, right, bottom, top, layer_sizes):
'''
Draw a neural network cartoon using matplotilb.
:usage:
>>> fig = plt.figure(figsize=(12, 12))
>>> draw_neural_net(fig.gca(), .1, .9, .1, .9, [4, 7, 2])
---------------------------------------------------------------------------
KeyError Traceback (most recent call last)
~\.conda\envs\gpu2\lib\site-packages\tensorflow_core\python\eager\context.py in __enter__(self)
1508 try:
-> 1509 new_device_name, new_device_spec = _device_parsing_cache[cache_key]
1510 except TypeError:
KeyError: ('', '/job:localhost/replica:0/task:0/device:GPU:0')
During handling of the above exception, another exception occurred:
@YatinAdityaT
YatinAdityaT / tensorflow_serving
Created April 29, 2020 02:00
Getting “bash: syntax error near unexpected token `|'” when trying to install tensorflow serving
echo "deb [arch=amd64] http://storage.googleapis.com/tensorflow-serving-apt stable tensorflow-model-server tensorflow-model-server-universal" | sudo tee /etc/apt/sources.list.d/tensorflow-serving.list && \
curl https://storage.googleapis.com/tensorflow-serving-apt/tensorflow-serving.release.pub.gpg | sudo apt-key add -
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)
if cv2.waitKey() == ord('q'):
cv2.destroyAllWindows()
@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')
start()
value = 40
start_time = time.time()
readings = []
offset = 28876
x_offset = 0
starttime = time.time()
@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
@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