mkdir -p ~/.oh-my-zsh/plugins/docker/
curl -fLo ~/.oh-my-zsh/plugins/docker/_docker https://raw.githubusercontent.com/docker/cli/master/contrib/completion/zsh/_docker
- Add
docker
toplugins
section in~/.zshrc
exec zsh
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ideally, we would manage async access to stdin/stdout/stderr *without* | |
# setting them to non-blocking mode, because that can break other processes. | |
# (See https://github.com/python-trio/trio/issues/174 for much more detail.) | |
# Of course we can call read/write in a separate thread, but then we lose | |
# cancellation support. | |
# This file demonstrates a weird hack to make blocking read/write cancellable, | |
# and thus at least theoretically possible to integrate into Trio as ordinary | |
# first-class operations. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import Flask | |
from flask_restful import Resource, Api, reqparse | |
import pandas as pd | |
import ast | |
app = Flask(__name__) | |
api = Api(app) | |
class Users(Resource): | |
def get(self): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.feature_extraction.text import TfidfVectorizer | |
from sklearn.metrics.pairwise import linear_kernel | |
from nltk import word_tokenize | |
from nltk.stem import WordNetLemmatizer | |
import nltk | |
from nltk.corpus import stopwords | |
# Download stopwords list | |
nltk.download('punkt') | |
stop_words = set(stopwords.words('english')) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def install_pdb_handler(): | |
"""Signals to automatically start pdb: | |
1. CTRL+\\ breaks into pdb. | |
2. pdb gets launched on exception. | |
""" | |
import signal | |
import pdb | |
def handler(_signum, _frame): |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
import torch.nn as nn | |
import torch.nn.functional as F | |
import torchvision.models as tmodels | |
from functools import partial | |
import collections | |
# dummy data: 10 batches of images with batch size 16 | |
dataset = [torch.rand(16,3,224,224).cuda() for _ in range(10)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import torch | |
from torch import LongTensor | |
from torch.nn import Embedding, LSTM | |
from torch.autograd import Variable | |
from torch.nn.utils.rnn import pack_padded_sequence, pad_packed_sequence | |
## We want to run LSTM on a batch of 3 character sequences ['long_str', 'tiny', 'medium'] | |
# | |
# Step 1: Construct Vocabulary | |
# Step 2: Load indexed data (list of instances, where each instance is list of character indices) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import io | |
from flask import Flask, send_file | |
app = Flask(__name__) | |
@app.route('/logo.jpg') | |
def logo(): | |
"""Serves the logo image.""" | |
with open("logo.jpg", 'rb') as bites: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# problem: when presenting, I want to obscure | |
# my prompt to act like it's at root of file system | |
# and be very basic with no git info, etc. | |
# solution: this theme lets you set a ENV to the path | |
# of your presentation, which will help remove unneeded prompt | |
# features while in that path | |
# oh-my-zsh theme for presenting demos | |
# based off the default rubbyrussell theme |
How do I dropdown?
This is how you dropdown.
<details> <summary>How do I dropdown?</summary> <br> This is how you dropdown.