Skip to content

Instantly share code, notes, and snippets.

@bluenex
Last active September 13, 2015 16:44
Show Gist options
  • Save bluenex/a778f52d6f63ab3536d2 to your computer and use it in GitHub Desktop.
Save bluenex/a778f52d6f63ab3536d2 to your computer and use it in GitHub Desktop.
Random bash commands that are useful (for me)

VS Code

Calling Visual Studio Code from command line. source

# VS Code 
## old version
code() {
    if [[ $# = 0 ]];
    then
        echo $PWD
        open -a "Visual Studio Code" $PWD
    else
        [[ $1 = /* ]] && F="$1" || F="$PWD/${1#./}"
        echo $F
        open -a "Visual Studio Code" $F
    fi
}

## newer version
code () { 
    VSCODE_CWD="$PWD" open -n -b "com.microsoft.VSCode" --args $* ;
}

Song Trimmer

Trim song using ffmpeg. source

# trimmer <song> <start at(sec)> <duration(sec)>
# trimmed file is named "cut_" as prefix of the old file name, feel free to get rid of it.
trimmer() {
  ffmpeg -i "$1" -ss "$2" -t "$3" -acodec copy cut_"$1" 
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment