Skip to content

Instantly share code, notes, and snippets.

View firedynasty's full-sized avatar

StanT_ firedynasty

View GitHub Profile
@firedynasty
firedynasty / change_func.md
Last active September 8, 2021 18:28
Change and store directories that you have been
function cd_func () {
  local x2 the_new_dir adir index
  local -i cnt

  if [[ $1 ==  "--" ]]; then
    cat -n /Users/username/desktop/macbook_pro_scripts/echo_files/test_3.txt
    return 0
  fi
function copy() {
    if [[ $# -eq 0 ]]; then
        echo 'first argument: file'
        echo 'second argument: line number'
    else
    sed -n $2p $1 | pbcopy 
    fi
}
@firedynasty
firedynasty / bash_multiple_files.md
Last active September 3, 2021 05:13
Bash to open multiple files
function opens(){
      if [[ $# -eq 0 ]]; then
      elif [[ $# -eq 1 ]]; then
        open "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$1 | tail -1)"
      else
        hello_var=$(echo -n "$1")
        minus_var=$(echo -n "$2")
        count_=0
@firedynasty
firedynasty / rclone_dropbox.md
Created August 27, 2021 02:14
rclone_dropbox
function dropbox () {
    if [[ $# -eq 0 ]]; then
        echo 'need parameter'
        echo 'dropbox_delete_screenshots_2'
    else
        rclone copy $@ dropbox:screenshots_macbook2
    fi 
function p() {
     if [[ $# -eq 0 ]]; then
        hello_var=$(cat /Users/username/desktop/macbook_pro_scripts/echo_files/count_open.txt)  
        second=$hello_var
        let second++
        echo -n $second > /Users/stanleytan/desktop/macbook_pro_scripts/echo_files/count_open.txt
        open "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$second | tail -1)"
        echo "$(find . -type f -maxdepth 2 -not -path '*/\.*' | sort | head -$second | tail -1)"
    else