This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| #usage: mysql-drop-all-tables -d database -u dbuser -p dbpass | |
| TEMP_FILE_PATH='./drop_all_tables.sql' | |
| while getopts d:u:p: option | |
| do | |
| case "${option}" | |
| in |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function pwdx { | |
| # note: NF is the number of columns, so $NF gives us the last column | |
| lsof -a -p $1 -d cwd -n | tail -1 | awk '{print $1, "\t", $NF}' | |
| } | |
| function portpwdx { | |
| # pid=$(lsof -i :5858 | tail -1 | perl -pe 's/[^\s]+\s+([^\s]+)\s.*/$1/') | |
| pid=$(lsof -i :$1 | tail -1 | perl -pe 's/[^\s]+\s+([^\s]+)\s.*/$1/') | |
| if [[ ! -z $pid ]]; then | |
| echo $pid |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # first: | |
| lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done | |
| sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.* | |
| # To recap, the best way (I've found) to completely uninstall node + npm is to do the following: | |
| # go to /usr/local/lib and delete any node and node_modules | |
| cd /usr/local/lib | |
| sudo rm -rf node* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # This gist contains pre-commit hooks to prevent you from commiting bad code or to the wrong branch. | |
| # There are six variants that I have built: | |
| # - pre-commit: stops commits to master/main/develop branches. | |
| # - pre-commit-2: also includes a core.whitespace check. | |
| # - pre-commit-3: the core.whitespace check and an EOF-newline-check. | |
| # - pre-commit-4: only the core.whitespace check. | |
| # - pre-commit-5: elixir formatting check. | |
| # - pre-commit-6: prettier formatting check. | |
| # Set the desired version like this before proceeding: |