From 6cf69bc190c4f821a42ab6eb057e6531fb5e2e06 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 3 Aug 2015 17:44:58 +0530 Subject: [PATCH 1/3] Git cheats: Change date of existing commit --- cheat/cheatsheets/git | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/cheat/cheatsheets/git b/cheat/cheatsheets/git index 9aa57ca..469ee5d 100644 --- a/cheat/cheatsheets/git +++ b/cheat/cheatsheets/git @@ -22,6 +22,14 @@ git commit --date="`date --date='2 day ago'`" git commit --date="Jun 13 18:30:25 IST 2015" # more recent versions of Git also support --date="2 days ago" directly +# To change the date of an existing commit +git filter-branch --env-filter \ + 'if [ $GIT_COMMIT = 119f9ecf58069b265ab22f1f97d2b648faf932e0 ] + then + export GIT_AUTHOR_DATE="Fri Jan 2 21:38:53 2009 -0800" + export GIT_COMMITTER_DATE="Sat May 19 01:01:01 2007 -0700" + fi' + # To removed staged and working directory changes git reset --hard From 196875a828ca6ac0b6e9ab00d08d5b6db21ac95a Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 3 Aug 2015 17:45:38 +0530 Subject: [PATCH 2/3] Git cheats: Shallow clones & Submodule update --- cheat/cheatsheets/git | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/cheat/cheatsheets/git b/cheat/cheatsheets/git index 469ee5d..b5c142b 100644 --- a/cheat/cheatsheets/git +++ b/cheat/cheatsheets/git @@ -94,3 +94,13 @@ git diff --no-index path/to/file/A path/to/file/B # To pull changes while overwriting any local commits git fetch --all git reset --hard origin/master + +# Update all your submodules +git submodule update --init --recursive + +# Perform a shallow clone to only get latest commits +# (helps save data when cloning large repos) +git clone --depth 1 + +# To unshallow a clone +git pull --unshallow From af354ba6a3df94e46333c55a645d637a5d26cb61 Mon Sep 17 00:00:00 2001 From: Shadab Zafar Date: Mon, 3 Aug 2015 17:48:15 +0530 Subject: [PATCH 3/3] New Sheet: ffmpeg - fast audio video encoder --- cheat/cheatsheets/ffmpeg | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 cheat/cheatsheets/ffmpeg diff --git a/cheat/cheatsheets/ffmpeg b/cheat/cheatsheets/ffmpeg new file mode 100644 index 0000000..952c45b --- /dev/null +++ b/cheat/cheatsheets/ffmpeg @@ -0,0 +1,12 @@ +# Print file metadata etc. +ffmpeg -i path/to/file.ext + +# Convert all m4a files to mp3 +for f in *.m4a; do ffmpeg -i "$f" -acodec libmp3lame -ab 320k "${f%.m4a}.mp3"; done + +# Listen to 10 seconds of audio from a video file +# +# -ss : start time +# -t : seconds to cut +# -autoexit : closes ffplay as soon as the audio finishes +ffmpeg -ss 00:34:24.85 -t 10 -i path/to/file.mp4 -f mp3 pipe:play | ffplay -i pipe:play -autoexit