Skip to content

Instantly share code, notes, and snippets.


Block or report user

Report or block YaYaB

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
YaYaB /
Last active Jan 15, 2020
This script allows to automate installation of DeepDetect (
# This is for Ubuntu 18.04, 16.04, 14.04
# Make sure Nvidia Drivers, cuda and cudnn are well installed in the machine on which you want to install DeepDetect
# Prefer cuda 10.1 instead of cuda 10.2 (cuda 10.2 is not well supported).
# Install dependencies based on version of ubuntu
unbuntu_version=$(echo "$(lsb_release -r)" | cut -f2 | cut -d '.' -f1)
if [ $unbuntu_version = 18 ]
# Prepare temp folder
YaYaB / .zshrc
Created Jan 14, 2020
Personal zshrc
View .zshrc
# If you come from bash you might have to change your $PATH.
#export PATH=/bin:/usr/bin:/usr/local/bin:/home/yassine.bezza/.local/bin:${PATH}
# Path to your oh-my-zsh installation.
export ZSH="/home/yassine.bezza/.oh-my-zsh"
# Set name of the theme to load --- if set to "random", it will
# load a random theme each time oh-my-zsh is loaded, in which case,
# to know which specific one was loaded, run: echo $RANDOM_THEME
# See
YaYaB /
Last active Jan 10, 2020
Transform a json document to a ljson document (one json per line)
import json
import os
from glob import glob
input_doc = "TODO" # can be a json doc or a folder containing only jsons
output_ljson = "{}_output.ljson".format('.'.join(input_doc.split('.')[:-1]))
def transform_input_to_dumpable(input_doc):
YaYaB /
Created Dec 2, 2019
Sort a list of string in an alphanumerical way
import re
def atoi(text):
return int(text) if text.isdigit() else text
def natural_keys(text):
alist.sort(key=natural_keys) sorts in human order
(See Toothy's implementation in the comments)
YaYaB /
Created Oct 30, 2019
Download an image from url
import urllib.request
import shutil
def downloader(image_url, basename, index=None):
req = urllib.request.Request(image_url, headers={'User-Agent': 'Mozilla/5.0'})
if index:
full_file_name = basename + '-' + str(index) + '.jpg'
full_file_name = basename + '.jpg'
with urllib.request.urlopen(req) as response, open(full_file_name, 'wb') as out_file:
YaYaB /
Last active Oct 22, 2019
Detect identical files
import hashlib
from glob import glob
from pathlib import Path
import argparse
import os
def get_args():
parser = argparse.ArgumentParser(
"Detect identical files."
YaYaB /
Last active Sep 13, 2019
Merge bounding boxes together.
import copy
import cv2
import os
def merge_bboxes(bboxes, delta_x=0.1, delta_y=0.1):
bboxes {list} -- list of bounding boxes with each bounding box is a list [xmin, ymin, xmax, ymax]
delta_x {float} -- margin taken in width to merge
YaYaB / untrack_file
Created Aug 30, 2019
Untrack file in git (when add file to gitignore and file already tracked)
View untrack_file
git update-index --assume-unchanged ${file_path}
YaYaB /
Created Aug 28, 2019
Download website
wget --mirror \
--convert-links \
--adjust-extension \
--page-requisites \
--no-parent \
--random-wait \
-r -p -e robots=off -U mozilla \
You can’t perform that action at this time.