Skip to content

Instantly share code, notes, and snippets.

@SerendipityNL
Last active January 7, 2020 13:12
Show Gist options
  • Save SerendipityNL/c7db53c544903b26246fb39b988a4ad1 to your computer and use it in GitHub Desktop.
Save SerendipityNL/c7db53c544903b26246fb39b988a4ad1 to your computer and use it in GitHub Desktop.
Terminal functions

Functions written for the terminal

All these functions are written by SerendipityNL for the terminal on MacOS. Some of them are already ported to Z shell, but not all.

Extract a gzip file and import the result into a locally hosted database

function import_gzip_to_mysql {
  read "gzipfilename?gzip filename [~/Development/database.gz]: "
  gzipfilename=${gzipfilename:-~/Development/database.gz}
  read "database?Target database: "
  pv $gzipfilename | gunzip | mysql -u root --password=root $database
}

Automatically source the new .zprofile

function resource {
  source ~/.zprofile
}

Edit the .zprofile in sublime

function edit_profile {
  sublime ~/.zprofile
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment