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
files = []
files = sorted(files , key = lambda x:x.split("_")[-1].replace(".ts",""))
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)
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"
@deepwilson
deepwilson / get_timestamp_ist
Last active February 8, 2019 08:29
Get current timestamp in IST
# 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))
@deepwilson
deepwilson / get_duration.py
Last active October 20, 2018 06:48
Get duration of a video using 'ffprobe'
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()