This file contains 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
python -m pip freeze | cut -d= -f1 | xargs python -m pip uninstall |
This file contains 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
ncdu | |
is the command to help view those big files |
This file contains 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
viewbigfile() { | |
# ref https://www.plesk.com/kb/support/how-to-find-directories-files-that-take-up-the-most-disk-space-on-a-plesk-for-linux-server/ | |
find / -type f -size +200M -exec du -h {} + 2>/dev/null | sort -r -h | |
# / +200M <- find it | |
} | |
reduce_journal_log() { | |
# ref https://www.sitelint.com/blog/how-do-i-clear-a-big-var-log-journal-folder#:~:text=You%20can%20safely%20clean%20%2Fvar,cannot%20delete%20the%20directory%20itself. | |
sudo journalctl --vacuum-size=100M |
This file contains 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
# before | |
completions = openai.ChatCompletion.create( | |
model="gpt-3.5-turbo", | |
messages=[ | |
{"role": "system", "content": prompt}, | |
], | |
temperature=0.4, | |
max_tokens=999, | |
) | |
res = completions['choices'][0]['message']['content'] |
This file contains 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
if [ -z "$BASH" ]; then bash $0; exit; fi # forced run w/ bash shell ref. https://stackoverflow.com/a/15731952/248616 | |
SH=$(dirname `realpath $BASH_SOURCE`) | |
### | |
SH aka SCRIPT_HOME ie the home folder of the running/executed script file - aka containing folder of .sh script file | |
ref. https://stackoverflow.com/a/11114547/248616 | |
SH=$(dirname `realpath -s "$0"`) # this works for shell :sh ; CAUTION $0 will always store the FIRST executed .sh ie f0.sh call f1.sh, f2.sh, and $0 always pointing to f0.sh --> must use $BASH_SOURCE to have SH point to the current-script | |
SH=$(cd `dirname $BASH_SOURCE` && pwd) # this only works for shell :bash and NOT working for :sh |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains 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
extract commit as patch | |
https://stackoverflow.com/a/6658352/248616 | |
``` | |
cd $source_repo | |
git format-patch -1 $sha | |
``` | |
apply the patch | |
https://stackoverflow.com/a/2250170/248616 | |
``` |
This file contains 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
dockerclearall() { | |
docker ps --format '{{.Names}}' | xargs -I {} bash -c 'echo "removing {} ..."; docker update --restart=no "{}"; docker stop -t1 "{}"; docker rm -f "{}"'; | |
yes | docker container prune; | |
yes | docker network prune; | |
yes | docker volume prune | |
} | |
dockerstoprm() { | |
c=$1 # c aka container_name | |
docker stop -t1 $c; docker rm -f $c; |
This file contains 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
curl -s -o /dev/null -w "%{http_code}" -X POST https://reqbin.com/echo/post/json <<EODATA | |
{ | |
"Id": 78912, | |
"Customer": "Jason Sweet", | |
"Quantity": 1, | |
"Price": 18.00 | |
} | |
EODATA | |
shoud_have=' |
NewerOlder