Put this in your .bashrc or .zshrc :
function abspath() {
if [ -d "$1" ]; then
# dir
(cd "$1"; pwd)
elif [ -f "$1" ]; then
# file
if [[ $1 = /* ]]; then| # https://stackoverflow.com/a/7715690 | |
| # try it on : https://repl.it/languages/python3 | |
| # print('ok', end='\r ', flush=True) | |
| for i in range(100): | |
| print(f'\t string {i}', end='\r ', flush=True) |
| # please use python3 and flask > 1.0 | |
| # run this with : python3 flask_separate_thread.py | |
| # https://web.archive.org/web/20210329135424/https://pymotw.com/3/threading/ | |
| # https://web.archive.org/web/20210329135553/https://eli.thegreenplace.net/2011/08/22/how-not-to-set-a-timeout-on-a-computation-in-python | |
| import time | |
| import threading | |
| from flask import Flask | |
| app = Flask(__name__) |
| import asyncio | |
| async def c1(): | |
| print("c1 begin") | |
| await asyncio.sleep(1) | |
| print("c1 end") | |
| return | |
| async def c2(): | |
| print("c2 begin") |
Put this in your .bashrc or .zshrc :
function abspath() {
if [ -d "$1" ]; then
# dir
(cd "$1"; pwd)
elif [ -f "$1" ]; then
# file
if [[ $1 = /* ]]; then| #!/usr/bin/env bash | |
| set -euo pipefail | |
| input="$*" | |
| length="${#input}" | |
| charindex=0 | |
| spongebob_str="" | |
| while [ $charindex -lt $length ]; do |
| MIT License | |
| Copyright (c) 2021 Grégoire MOLVEAU | |
| Permission is hereby granted, free of charge, to any person obtaining a copy | |
| of this software and associated documentation files (the "Software"), to deal | |
| in the Software without restriction, including without limitation the rights | |
| to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | |
| copies of the Software, and to permit persons to whom the Software is | |
| furnished to do so, subject to the following conditions: |
| # always use single quote for PROMPT and RPROMPT | |
| # PROMPT = '' on the left | |
| # RPROMPT = '' on the right | |
| # see every numeric color : for code in {000..255}; do print -P -- "$code: %F{$code}Color%f"; done | |
| # text colors : %F{cyan}text%f | |
| # background color : %K{white}%k | |
| # unicode caracter (eg. star) : \u2b50 | |
| # Reset both text and background color: %{$reset_color%} | |
| # exit code : %(?.ok.%F{red}nok%f) | |
| # standout : %Stext%s |
ModuleNotFoundError: No module named '_tkinter'
Fix :
brew install python-tk