Skip to content

Instantly share code, notes, and snippets.

Avatar
🐼

Guy Smoilovsky guysmoilov

🐼
View GitHub Profile
@masak
masak / explanation.md
Created Apr 18, 2012
How is git commit sha1 formed
View explanation.md

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 <jnthn@jnthn.net>
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.
@debasishg
debasishg / gist:8172796
Last active May 11, 2021
A collection of links for streaming algorithms and data structures
View gist:8172796
  1. General Background and Overview
@piscisaureus
piscisaureus / pr.md
Created Aug 13, 2012
Checkout github pull requests locally
View pr.md

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 = git@github.com:joyent/node.git

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:

@mkocabas
mkocabas / nms_pytorch.py
Created Jun 1, 2018
Pytorch NMS implementation
View nms_pytorch.py
import torch
# Original author: Francisco Massa:
# https://github.com/fmassa/object-detection.torch
# 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.
Args:
boxes: (tensor) The location preds for the img, Shape: [num_priors,4].
@guysmoilov
guysmoilov / Git pre-commit hook for large files.md
Last active Mar 16, 2021
Git pre-commit hook for large files
View Git pre-commit hook for large files.md

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.

Installation

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

Usage

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
guysmoilov / gdrive_download.sh
Created Feb 28, 2019
Bash script to download large zip files from google drive while confirming the virus scan warning
View gdrive_download.sh
#!/bin/sh
# Usage: gdrive_download 123-abc ./output.zip
function gdrive_download () {
CONFIRM=$(wget --quiet --save-cookies /tmp/cookies.txt --keep-session-cookies --no-check-certificate "https://drive.google.com/uc?export=download&id=$1" -O- | sed -En 's/.*confirm=([0-9A-Za-z_]+).*/\1/p')
wget --load-cookies /tmp/cookies.txt "https://drive.google.com/uc?export=download&confirm=$CONFIRM&id=$1" -O $2
rm -f /tmp/cookies.txt
}
@hamelsmu
hamelsmu / mlops.md
Last active Jul 30, 2020
The Git + Data tool I always wanted
View mlops.md

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 https://github.com/david/ml