Skip to content

Instantly share code, notes, and snippets.

YaYaB

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
YaYaB / install_deepdetect.sh
Last active Jan 15, 2020
This script allows to automate installation of DeepDetect (https://www.deepdetect.com/)
View install_deepdetect.sh
# 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).
# https://www.deepdetect.com/
# Install dependencies based on version of ubuntu
unbuntu_version=$(echo "$(lsb_release -r)" | cut -f2 | cut -d '.' -f1)
if [ $unbuntu_version = 18 ]
then
# Prepare temp folder
@YaYaB
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 https://github.com/ohmyzsh/ohmyzsh/wiki/Themes
ZSH_THEME="refined"
@YaYaB
YaYaB / json_to_ljson.py
Last active Jan 10, 2020
Transform a json document to a ljson document (one json per line)
View json_to_ljson.py
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
YaYaB / sort_alphanumerical.py
Created Dec 2, 2019
Sort a list of string in an alphanumerical way
View sort_alphanumerical.py
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
http://nedbatchelder.com/blog/200712/human_sorting.html
(See Toothy's implementation in the comments)
@YaYaB
YaYaB / download_image_web.py
Created Oct 30, 2019
Download an image from url
View download_image_web.py
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'
else:
full_file_name = basename + '.jpg'
with urllib.request.urlopen(req) as response, open(full_file_name, 'wb') as out_file:
@YaYaB
YaYaB / detect_identical_files.py
Last active Oct 22, 2019
Detect identical files
View detect_identical_files.py
import hashlib
from glob import glob
from pathlib import Path
import argparse
import os
def get_args():
parser = argparse.ArgumentParser(
"Detect identical files."
@YaYaB
YaYaB / merge_bboxes.py
Last active Sep 13, 2019
Merge bounding boxes together.
View merge_bboxes.py
import copy
import cv2
import os
def merge_bboxes(bboxes, delta_x=0.1, delta_y=0.1):
"""
Arguments:
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
YaYaB / untrack_file
Created Aug 30, 2019
Untrack file in git (when add file to gitignore and file already tracked)
View untrack_file
file_path=""
git update-index --assume-unchanged ${file_path}
@YaYaB
YaYaB / dl_website.sh
Created Aug 28, 2019
Download website
View dl_website.sh
NAME_WEBSITE=""
COOKIES=""
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.