Skip to content

Instantly share code, notes, and snippets.

View INF800's full-sized avatar
🍁
For truth we seek infinite and beyond.

Asapanna Rakesh INF800

🍁
For truth we seek infinite and beyond.
View GitHub Profile
@INF800
INF800 / multipro_template.py
Created March 9, 2022 19:13 — forked from blaylockbk/multipro_template.py
Template for Python multiprocessing and multithreading
import multiprocessing #:)
def do_this(number):
print number
return number*2
# Create a list to iterate over.
# (Note: Multiprocessing only accepts one item at a time)
some_list = range(0,10)
@INF800
INF800 / fastapi_websocket_redis_pubsub.py
Created January 19, 2022 17:40 — forked from timhughes/fastapi_websocket_redis_pubsub.py
FastAPI Websocket Bidirectional Redis PubSub
"""
Usage:
Make sure that redis is running on localhost (or adjust the url)
Install uvicorn or some other asgi server https://asgi.readthedocs.io/en/latest/implementations.html
pip install -u uvicorn
Install dependencies
@INF800
INF800 / uninstall_python3.MD
Created October 9, 2021 22:31 — forked from zhensongren/uninstall_python3.MD
How to uninstall python3 from Ubuntu

To list all python versions in default locations

ls /usr/bin/python*

To remove just python3 package

sudo apt-get remove python3.5

plus it's dependent packages

sudo apt-get remove --auto-remove python3.5

plus configuration and/or data files of python3

sudo apt-get purge python3.5

1WBllCh7h5NjY09cvDby-amOO2FN0HbOA
@INF800
INF800 / cpu_bound_vs_io_bound.py
Last active September 12, 2021 23:33
multiprocessing vs multithreading for cpu-bound and io-bound tasks
# source: https://www.geeksforgeeks.org/difference-between-multithreading-vs-multiprocessing-in-python/
import time, os
from threading import Thread, current_thread
from multiprocessing import Process, current_process
COUNT = 200000000
SLEEP = 10
def io_bound(sec):
@INF800
INF800 / test.py
Last active August 14, 2021 22:57
test
def f(*, a):
pass
f(1) # raises error
f(a=1) # works
@INF800
INF800 / commands.sh
Last active June 24, 2021 18:23
Docker commands
# ========================================================================================
# setup image
# ========================================================================================
# download or build image
docker build .
# ========================================================================================
# setup container
# ========================================================================================
@INF800
INF800 / crime-det.ipynb
Created February 20, 2021 11:22
Crime-det.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

I wanted to find a different method that didn't require me to read the json file or to have to upload it to root while using Colab. I instead wanted to just store the json in my drive somewhere and let the kaggle cli know where it is.

As it turns out, there's a way to do that, which is set the environment variable KAGGLE_CONFIG_DIR

If you don't have the json file yet, check the docs for how to get that: link Then upload it to your drive. Mine happens to be at /content/drive/My Drive/fastai-v3/.kaggle/kaggle.json. (ayyy shoutout to the FastAI courses 👌 ) Now in colab you can just run:

import random, math
import numpy as np
import matplotlib.pyplot as plt
import matplotlib.patheffects as mpe
"""
dataset
"""