{{ message }}

Instantly share code, notes, and snippets.

🏠
Working from home

🏠
Working from home
Created Oct 25, 2020
Created Apr 7, 2020
Bash function to help manage multiple github identities in your ssh config
View gist:ddce0bfb1f7bfb3754acc0b6f2a9affe
 #~/.ssh/config _____________________________________________________________________________ # Instructions: # --------------------------------------------- # the way this works is that you have to use the Host value with the ssh call # Host="github.com-paulegradie" # git clone git@\${Host}:paulegradie/SeqPyPlot.git # The default here is github.com - this is what comes with the copy/paste from github when you click # the clone or download button.
Created Aug 8, 2019
View word_math.py
 # assigns the row from the embedding matrix to the named variable king = embed_matrix[word_to_index['king']] male = embed_matrix[word_to_index[‘male’]] female = embed_matrix[word_to_index[‘female']] queen = embed_matrix[word_to_index['queen']] # the formula now uses the vectors from the embedding matrix assert (king - man) + woman ≈ queen
Last active Aug 20, 2019
A sample word2index generated in python.
View word2index.py
 """ # The map word | idx ---------------- king | 0 male | 1 queen | 2 female | 3 """
Last active Aug 8, 2019
A sample embedding matrix
View sample_embeddings.txt
 idx | embed_matrix 0 [[ 0.21143426, 1.2885487 , 0.98160927, 0.17858341], 1 [-0.38735983, 0.06507064, 1.31839592, -0.91412724], 2 [ 1.13726889, 0.48327542, 0.65075236, 0.93818869], 3 [1.73606298, 1.70675348, 0.31396571, 2.03089933]]
Created Aug 4, 2019
TestGist
View make_blob.py
 import numpy as np def make_blob_part(mean, cov, num_points=500): x, y = np.random.multivariate_normal(mean, cov, num_points).T return np.hstack((x.reshape(-1, 1), y.reshape(-1, 1))) mean1 = [-10, 10] mean2 = [-15, 5] mean3 = [-9, 3]
Created Oct 24, 2018
How to find all new files you've added to a branch
View find_new_files.txt
 git diff {old_branch}...{new_branch} --name-status --diff-filter=A e.g. to find a enw file added since branching from master: git diff master...gradie/sandbox --name-status --diff-filter=A Options for `--diff-filter Added (A) Copied (C)
Created Apr 3, 2018
Force pull - overwrite with content from origin
View reset_branch.txt
 git fetch --all git reset --hard origin/{branch_name}