Skip to content

Instantly share code, notes, and snippets.

View mickeyouyou's full-sized avatar
🌏
searching and reading

Zongbao Feng mickeyouyou

🌏
searching and reading
View GitHub Profile
@josemarcosrf
josemarcosrf / easy_install_cuda_ubuntu-1804.sh
Last active November 10, 2021 08:24
Install NVIDIA drivers and CUDA for Ubuntu 18.04 LTS
CUDA_REPO_PKG=cuda-repo-ubuntu1804_10.2.89-1_amd64.deb
CUDA_URL=http://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64
wget -O /tmp/${CUDA_REPO_PKG} ${CUDA_URL}/${CUDA_REPO_PKG}
sudo dpkg -i /tmp/${CUDA_REPO_PKG}
sudo apt-key adv --fetch-keys ${CUDA_URL}/7fa2af80.pub
rm -f /tmp/${CUDA_REPO_PKG}
@sbarratt
sbarratt / torch_jacobian.py
Created May 9, 2019 19:40
Get the jacobian of a vector-valued function that takes batch inputs, in pytorch.
def get_jacobian(net, x, noutputs):
x = x.squeeze()
n = x.size()[0]
x = x.repeat(noutputs, 1)
x.requires_grad_(True)
y = net(x)
y.backward(torch.eye(noutputs))
return x.grad.data
@korakot
korakot / bucket.py
Last active September 29, 2022 21:40
Mount GCS bucket on Colab
from google.colab import auth
auth.authenticate_user()
!echo "deb http://packages.cloud.google.com/apt gcsfuse-bionic main" > /etc/apt/sources.list.d/gcsfuse.list
!curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add -
!apt -qq update
!apt -qq install gcsfuse
!mkdir co-lab
!gcsfuse co-lab /content/co-lab
@edro15
edro15 / ForceUSBtoTTY.md
Last active April 23, 2024 00:11
[How To] Force a specific USB device to a certain TTY

Scenario:

  • multiple USB devices plugged via hub to a host (Linux OS based),
  • multiple services/programs interacting with TTY running on top (e.g. GPSd)

Problem:

At boot TTY are randomly assigned to devices causing depending services/programs instabilities. They could indeed fail to start because of different TTY configurations.

Solution:

@sonots
sonots / nvvp.md
Last active April 24, 2024 13:54
How to use NVIDIA profiler

Usually, located at /usr/local/cuda/bin

Non-Visual Profiler

$ nvprof python train_mnist.py

I prefer to use --print-gpu-trace.

@vertexclique
vertexclique / cracking.md
Last active April 8, 2024 18:24
Cracking guide for Sublime Text 3 Build 3059 / 3065 ( Mac / Win x86_64 / Windows x86 / Linux x64 / Linux x86 )

MacOS

Build 3059

MD5: 59bab8f71f8c096cd3f72cd73851515d

Rename it to: Sublime Text

Make it executable with: chmod u+x Sublime\ Text

@jwage
jwage / SplClassLoader.php
Last active April 9, 2024 21:04
Add MIT license.
<?php
/*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,