Skip to content

Instantly share code, notes, and snippets.

View mythrex's full-sized avatar
🎯
Focusing

Shivam Kaushik mythrex

🎯
Focusing
View GitHub Profile
@denguir
denguir / cuda_install.md
Last active October 19, 2025 11:37
Installation procedure for CUDA / cuDNN / TensorRT

How to install CUDA / cuDNN / TensorRT on Ubuntu

Install NVIDIA drivers

Update & upgrade

sudo apt update && sudo apt upgrade

Remove previous NVIDIA installation

@weiaicunzai
weiaicunzai / accuracy.py
Created June 22, 2018 13:20
compute top1, top5 error using pytorch
from __future__ import print_function, absolute_import
__all__ = ['accuracy']
def accuracy(output, target, topk=(1,)):
"""Computes the precision@k for the specified values of k"""
maxk = max(topk)
batch_size = target.size(0)
_, pred = output.topk(maxk, 1, True, True)
@savsgio
savsgio / vscode_auto_activate_python_virtualenv.sh
Last active March 18, 2021 13:01
Auto-activate python virtualenv in VSCode Integrated Terminal
## File: ~/.bashrc
## Your virtualenv is in /home/.virtualenvs/
# Auto-activate python virtualenv
if [ ! -z $PYTHONVIRTUALENV ]; then
source /home/.virtualenvs/$PYTHONVIRTUALENV/bin/activate
fi
## File: .vscode/settings.json
@codehacken
codehacken / sliding_window.py
Last active June 19, 2024 21:11
Create a Sliding Window function using NumPy.
# Create a function to reshape a ndarray using a sliding window.
# NOTE: The function uses numpy's internat as_strided function because looping in python is slow in comparison.
# Adopted from http://www.rigtorp.se/2011/01/01/rolling-statistics-numpy.html
import numpy as np
# Reshape a numpy array 'a' of shape (n, x) to form shape((n - window_size), window_size, x))
def rolling_window(a, window, step_size):
shape = a.shape[:-1] + (a.shape[-1] - window + 1 - step_size + 1, window)
strides = a.strides + (a.strides[-1] * step_size,)
@iamtekeste
iamtekeste / Download Google Drive files with WGET
Created July 8, 2015 11:00
Download Google Drive files with WGET
Download Google Drive files with WGET
Example Google Drive download link:
https://docs.google.com/open?id=[ID]
To download the file with WGET you need to use this link:
https://googledrive.com/host/[ID]
Example WGET command: