Skip to content

Instantly share code, notes, and snippets.

View chck's full-sized avatar
🏠
Working from home

chck chck

🏠
Working from home
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@christippett
christippett / auth.py
Created September 13, 2018 05:16
Generate IAP token using Google service account
import google.auth
from google.auth.compute_engine.credentials import \
Credentials as ComputeEngineCredentials
from google.auth.transport.requests import Request
from google.oauth2.credentials import Credentials as OAuth2Credentials
from google.oauth2.service_account import Credentials, IDTokenCredentials
IAM_SCOPE = 'https://www.googleapis.com/auth/iam'
OAUTH_TOKEN_URI = 'https://www.googleapis.com/oauth2/v4/token'
@leimao
leimao / tqdm_download.py
Created June 12, 2018 03:41
Tqdm Download Example
"""
Tqdm Download Hook
Lei Mao
University of Chicago
Modified from https://github.com/tqdm/tqdm/blob/master/examples/tqdm_wget.py
"""
import os
@Mahedi-61
Mahedi-61 / cuda_11.8_installation_on_Ubuntu_22.04
Last active April 25, 2025 18:27
Instructions for CUDA v11.8 and cuDNN 8.9.7 installation on Ubuntu 22.04 for PyTorch 2.1.2
#!/bin/bash
### steps ####
# Verify the system has a cuda-capable gpu
# Download and install the nvidia cuda toolkit and cudnn
# Setup environmental variables
# Verify the installation
###
### to verify your gpu is cuda enable check
@korakot
korakot / exit.py
Last active July 18, 2024 12:01
Terminate kernel to restart google colab
print("Runtime is now restarting...")
print("You can ignore the error message [Your session crashed for an unknown reason.]")
sleep(0.5)
os._exit(0) # restart
@kyamagu
kyamagu / demo.ipynb
Last active February 24, 2025 17:02
Dataset class for Automatic Understanding of Image and Video Advertisements (CVPR 2017) http://people.cs.pitt.edu/~kovashka/ads/
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@datlife
datlife / mnist_tfdata.py
Last active May 24, 2023 02:03
Training Keras model with tf.data
"""An example of how to use tf.Dataset in Keras Model"""
import tensorflow as tf # only work from tensorflow==1.9.0-rc1 and after
_EPOCHS = 5
_NUM_CLASSES = 10
_BATCH_SIZE = 128
def training_pipeline():
# #############
# Load Dataset
@markph0204
markph0204 / direnv+pycharm.sh
Created December 26, 2017 21:49
direnv with pycharm
# enable direnv for python
# this will enable the commandline support as well as support pycharm
# 1 install direnv (Homebrew / pip)
# 2 edit your .bashrc, .bash_profile or .bash_aliases
function venv-here {
# you could just use 'layout python' here for 2.7.x
echo "layout python3" > .envrc
echo "ln -s .direnv/\$(basename \$VIRTUAL_ENV)/ .env" >> .envrc
}
@hayatoy
hayatoy / dataflow_shuffle_example.ipynb
Last active August 27, 2018 19:24
Dataflow Shuffle Example
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.