Skip to content

Instantly share code, notes, and snippets.


Guy Smoilovsky guysmoilov

View GitHub Profile
hamelsmu /
Last active Jul 30, 2020
The Git + Data tool I always wanted

install MLOps

brew install mlops

clone repo as usual

If metadata data.yaml is detected in the root of the repo, the plugin mlops will automatically ask user if they would like to download the data.

> git clone
guysmoilov / Git pre-commit hook for large
Last active Mar 16, 2021
Git pre-commit hook for large files
View Git pre-commit hook for large

Git pre-commit hook for large files

This hook warns you before you accidentally commit large files to git. It's very hard to reverse such an accidental commit, so it's better to prevent it in advance.

Since you will likely want this script to run in all your git repos, a script is attached to add this hook to all git repos you create / clone in the future.

Of course, you can just download it directly to the hooks in an existing git repo.


guysmoilov / .gitconfig
Last active Feb 11, 2021
My git aliases. Work in progress.
View .gitconfig
br = branch
sh = show
rb = rebase
rbi = rebase -i
st = status
ci = commit
cim = commit -m
co = checkout
rs = reset
benmccallum /
Last active Feb 1, 2021
git pre-commit hook preventing large files


You can use in two ways.

  1. Directly as the pre-commit hook in your .git/hooks folder.

  2. With Husky by updating your package.json with:

"husky": {
guysmoilov /
Created Feb 28, 2019
Bash script to download large zip files from google drive while confirming the virus scan warning
# Usage: gdrive_download 123-abc ./
function gdrive_download () {
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "$1" -O- | sed -En 's/.*confirm=([0-9A-Za-z_]+).*/\1/p')
wget --load-cookies /tmp/cookies.txt "$CONFIRM&id=$1" -O $2
rm -f /tmp/cookies.txt
mkocabas /
Created Jun 1, 2018
Pytorch NMS implementation
import torch
# Original author: Francisco Massa:
# Ported to PyTorch by Max deGroot (02/01/2017)
def nms(boxes, scores, overlap=0.5, top_k=200):
"""Apply non-maximum suppression at test time to avoid detecting too many
overlapping bounding boxes for a given object.
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].
debasishg / gist:8172796
Last active Apr 28, 2021
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
piscisaureus /
Created Aug 13, 2012
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url =

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

masak /
Created Apr 18, 2012
How is git commit sha1 formed

Ok, I geeked out, and this is probably more information than you need. But it completely answers the question. Sorry.

Locally, I'm at this commit:

$ git show
commit d6cd1e2bd19e03a81132a23b2025920577f84e37
Author: jnthn <>
Date:   Sun Apr 15 16:35:03 2012 +0200

    When I added FIRST/NEXT/LAST, it was idiomatic but not quite so fast. This makes it faster. Another little bit of masak++'s program.