Skip to content

Instantly share code, notes, and snippets.

View deepwilson's full-sized avatar
🏠
Working from home

Deep Wilson deepwilson

🏠
Working from home
View GitHub Profile

If you want to move WSL2 Linux distro(Ubuntu) from C: drive D: below are the steps.

Export Ubuntu

mkdir D:\backup wsl --export Ubuntu D:\backup\ubuntu.tar Unregister the same distribution to remove it from the C: drive:

wsl --unregister Ubuntu Import Ubuntu

pip install jupyter_contrib_nbextensions
pip install jupyter_nbextensions_configurator
jupyter contrib nbextension install --user
jupyter nbextensions_configurator enable --user
# create env
conda create -n env_name
conda activate env_name
# remove env
conda env remove -n env_name
# list all versions from diff channels
conda search package_name
"""Resize all images in a folder"""
from tqdm.notebook import tqdm
import os
import glob
input_folder = r"" #os.getcwd()
output_folder = r""
resize_width = 512
resize_height = 512

Git Branches:


# setting global Git Username and Email 
git config --global user.name "Your Name"
git config --global user.email "youremail@yourdomain.com"
git config --list
# The command saves the values in the global configuration file, ~/.gitconfig
# If you want to use a different username or email address for a specific repository, run the git config command without the --global option from within the repository directory
from tqdm.notebook import tqdm
import os
# TF Records
dest_path = './tf_records_of_images.tfrecords'
file_writer = tf.io.TFRecordWriter(dest_path)
# source dir
@deepwilson
deepwilson / Scrape "awesome repos" for ArXiv papers to send to Kindle
Created October 28, 2020 14:46
Download ArXiv papers from "awesome" repos related to DL and CV
'''Modified from Source -----> "https://github.com/jyguo1729/web-scraping-for-PDF-file" '''
import requests
from bs4 import BeautifulSoup
def get_title(url):
# url = 'https://arxiv.org/abs/1108.3525'
html = requests.get(url)
soup = BeautifulSoup(html.text,'html.parser')
title = soup.select_one('h1.title.mathjax').text.replace('Title:', '')
return title
from subprocess import check_output
import sys
import os
def rough_frequency_check(file):
freq = str(check_output('sox \"' +file+ '\" -n stat 2>&1 |findstr "Rough frequency" ',shell=True)) #Windows
# RMS = str(check_output('sox \"' +file+ '\" -n stat 2>&1 |grep "RMS" ',shell=True)) #ubuntu
freq=freq.split(":")[1]
freq=freq.split("\\")[0]
freq=int(freq)
# freq=round(freq,5)
import os
def convert_to_mp3(file,source_dir = "",dest_dir = "",reduce_noise = False):
"""Converts file to mp3
Creates source_dir if required
Returns ffmpeg exit code"""
file_ext = file.split(".")[-1]
if not os.path.isdir(dest_dir):
os.mkdir(dest_dir)