📆 Artigo escrito dia: 03/09/2020 📆 Artigo atualizado dia: 10/10/2020
Minhas especificações: Microsoft Windows 10 Enterprise Versão 2004 (Compilação 19041.450). WSL2 - Ubuntu 20.04.
export function getExcerpt(htmlString, length) { | |
const span = document.createElement("span"); | |
span.innerHTML = htmlString; | |
const outputString = span.textContent || span.innerText; | |
if (outputString.length > length) { | |
// obtendo os *length* primeiros caracteres sem quebrar palavras | |
// usando flag s para tratar a string como single line | |
const exp = new RegExp(`^(.{${length}}[^\\s]*).*`, "s"); |
# For mysql use root/root as user/password | |
# For ftp use admin/123 as user/password | |
version: "3.3" | |
services: | |
db: | |
image: mysql | |
container_name: mysql | |
command: --default-authentication-plugin=mysql_native_password | |
restart: always |
netsh interface portproxy add v4tov4 listenport=3333 listenaddress=0.0.0.0 connectport=3333 connectaddress=<YOUR_IP>
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit, working tree clean" ]] && echo "*" | |
} | |
function parse_git_branch { | |
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/(\1$(parse_git_dirty))/" | |
} | |
export PS1='\[\e[\033[01;34m\]\u@\h \[\e[38;5;211m\]\W\[\e[\033[38;5;48m\] $(parse_git_branch)\[\e[\033[00m\]\$ ' |
docker exec -i [container_name] sh -c 'exec mysql -u root -p"$MYSQL_ROOT_PASSWORD" [database_name]' < /path/to/dump.sql |