# setting global Git Username and Email
git config --global user.name "Your Name"
git config --global user.email "[email protected]"
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from subprocess import check_output | |
import re | |
file_name = "movie.mp4" | |
#For Windows | |
a = str(check_output('ffprobe -i "'+file_name+'" 2>&1 |findstr "Duration"',shell=True)) | |
#For Linux | |
#a = str(check_output('ffprobe -i "'+file_name+'" 2>&1 |grep "Duration"',shell=True)) a = a.split(",")[0].split("Duration:")[1].strip() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Python3 | |
from datetime import datetime | |
from pytz import timezone | |
curent_timestamp_ist = int(datetime.now(timezone('Asia/Kolkata')).timestamp()) | |
# Convert to HH:M:SS | |
import time | |
curent_timestamp_ist += 19800 | |
time.strftime("%H:%M:%S", time.gmtime(curent_timestamp_ist)) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Using the git reflog command to identify the last-known-good state of your repo | |
Then, git reset --hard <commit> to revert back to it | |
Then, another git push --force to reset the remote repository back to that state | |
"https://community.atlassian.com/t5/Sourcetree-questions/GitHub-repo-lost-much-history-after-forced-push-how-to-restore/qaq-p/254183" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
directory = r"C:\Users\deep1\audio_segments/" | |
files_concat = ["audio_136","audio_062","audio_008","audio_009","audio_045","audio_050","audio_055","audio_114"] | |
ffmpeg_command = "ffmpeg -i \"concat:" | |
for file in files_concat: | |
ffmpeg_command += file+".mp3|" | |
ffmpeg_command = ffmpeg_command.rstrip("|") | |
ffmpeg_command = ffmpeg_command+"\" music_concat.mp3" | |
os.system(ffmpeg_command) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
files = [] | |
files = sorted(files , key = lambda x:x.split("_")[-1].replace(".ts","")) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'''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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
OlderNewer