Skip to content

Instantly share code, notes, and snippets.

@ggirou
Last active January 6, 2019 21:07
Show Gist options
  • Save ggirou/07423d3fb5fe7ff58024 to your computer and use it in GitHub Desktop.
Save ggirou/07423d3fb5fe7ff58024 to your computer and use it in GitHub Desktop.
Linux commands
# Rename files with a sequential prefix number in modification date order
ls -1tr | nl -n rz -w 2 | sed -r 's/^([0-9]+)\t(.+)$/"\2" "\1 - \2"/' | xargs -l1 mv
# Export existing commit dates in `commit_dates` file
git log --pretty='if test $GIT_COMMIT = %H; then export GIT_AUTHOR_DATE="%ai" GIT_COMMITTER_DATE="%ci"; fi;' > commit_dates
# Update `commit_dates` file to whatever you want...
nano commit_dates
# Apply new dates on commits
git filter-branch --env-filter "`cat commit_dates`"
#!/bin/bash
sudo mount -t cifs -o user=my-user,vers=1.0 //my-nas/Volume_1 /home/me/my-nas
# https://github.com/rg3/youtube-dl
# Download playlist videos
youtube-dl https://www.youtube.com/playlist?list=....
# Download playlist videos with custom filename
youtube-dl -o '%(playlist_index)s - %(title)s.%(ext)s' https://www.youtube.com/playlist?list=....
# Rename downloaded files from default filname template to new one
youtube-dl --get-filename -o '"%(title)s-%(id)s.%(ext)s" "%(playlist_index)s - %(title)s.%(ext)s"' | xargs -l1 mv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment