Skip to content

Instantly share code, notes, and snippets.

View Joshua1989's full-sized avatar

Mengke Lian Joshua1989

  • Google
  • Mountain View
View GitHub Profile
@Joshua1989
Joshua1989 / ngrok_tboard.py
Created January 13, 2019 12:50
Using tensorboard with ngrok tunneled Jupyter notebook
from collections import namedtuple
import json
import psutil
import requests
import re
import subprocess
class ngrok_tboard_manager:
def __init__(self, port=None):
@Joshua1989
Joshua1989 / Bangumi_Average_Rating_By_Company.ipynb
Last active October 9, 2018 20:18
Bangumi_Average_Rating_By_Company.ipynb
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Joshua1989
Joshua1989 / remote_setup.py
Last active August 14, 2018 21:41
Setup remote jupyter and tensorboard for Duke ECE pfisterlab machines
#!/srv/apps/anaconda3/bin/python
import os
import time
HOME = os.environ.get('HOME')
# edit bashrc
with open(HOME + '/.bashrc', 'w') as f:
ngrok_key1 = input('Enter the first ngrok authtoken > ')
ngrok_key2 = input('Enter the second ngrok authtoken > ')
@Joshua1989
Joshua1989 / remote_setup
Created August 14, 2018 06:18
Setup remote jupyter and tensorboard for Duke ECE pfisterlab machines:
#!/srv/apps/anaconda3/bin/python
import os
import time
HOME = os.environ.get('HOME')
# edit bashrc
if 'Added by remote_setup.sh' not in open(HOME + '/.bashrc', 'r').read():
with open(HOME + '/.bashrc', 'a') as f:
ngrok_key1 = input('Enter the first ngrok authtoken > ')
@Joshua1989
Joshua1989 / Jupyter nested tqdm fixing.ipynb
Created June 14, 2018 22:55
Solution of unexpected spacing on nested tqdm progressbars by adding a VBox container
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@Joshua1989
Joshua1989 / Transferring files between Google Colab and Google Drive.md
Last active October 12, 2023 08:38
file transferring between Google Colab VM and Google Drive

There are several approaches

  • Mount Google Drive in local Colab VM
  • Upload and download via browser
  • Use colab_util.py in python script
@Joshua1989
Joshua1989 / A.markdown
Created April 2, 2018 17:45 — forked from umpirsky/A.markdown
Sublime Text Monokai Sidebar Theme.
@Joshua1989
Joshua1989 / nvidia-reinstall.sh
Created March 29, 2018 17:36 — forked from morgangiraud/nvidia-reinstall.sh
Script to reinstall manually nvidia drivers,cuda 9.0 and cudnn 7.1 on Ubuntu 16.04
# Remove anything linked to nvidia
sudo apt-get remove --purge nvidia*
sudo apt-get autoremove
# Search for your driver
apt search nvidia
# Select one driver (the last one is a decent choice)
sudo apt install nvidia-370
@Joshua1989
Joshua1989 / fg_helper.py
Last active April 2, 2019 19:23
Fast tikz Factor Graph drawing based on python3+tkinter, just run it, build your graph by clicking and hit return, then the tikz code is in your clipboard
from tkinter import *
from string import Template
import clipboard
root = Tk()
# Make the window transparent, bring it to topmost
root.wait_visibility(root)
root.attributes('-alpha', 0.5)
# Note sometimes this causes other windows to hide, still figuring what happened
root.attributes('-topmost', True)