Skip to content

mauroao/tips

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

41 Commits
 
 
 
 

Repository files navigation

Guia rápido

✅ Link para outros sites com dicas rápidas:

✅ Windows vars and tips

Variable Description
%APPDATA% Path to the current user's Application Data folder
%TEMP% Path to the temporary folder for the current user
%USERPROFILE% Path to the current user's profile folder
%PROGRAMFILES% Path to the Program Files folder
%SYSTEMROOT% Path to the Windows installation directory
%USERNAME% Current user's username
%WINDIR% Path to the Windows directory
%HOMEPATH% Path to the current user's home folder
%LOCALAPPDATA% Path to the current user's local AppData folder
shell:startup AppData\Roaming/Microsoft/Windows/Start Menu/Programs/Startup folder
Shortcut Program
control Control Panel
sysdm.cpl System Properties
ncpa.cpl Network Connections
appwiz.cpl Programs and Features
desk.cpl Display Properties
firewall.cpl Windows Firewall
inetcpl.cpl Internet Options
timedate.cpl Date and Time
mmsys.cpl Sound
powercfg.cpl Power Options
devmgmt.msc Device Manager
compmgmt.msc Computer Management
services.msc Services
taskmgr Task Manager

✅ Linux

Listar top 10 comandos com maior uso de cpu

ps -A --format=pcpu,args --sort=-pcpu | head -n 11 | cut -c 1-100

Serviços (exemplos de comandos)

sudo service --status-all
sudo service smbd status
sudo service smbd start
sudo service smbd stop

sudo systemctl list-units | grep smbd.service
sudo systemctl list-units | grep docker.service
sudo systemctl start docker.service
sudo systemctl stop docker.service
sudo systemctl enable docker.service
sudo systemctl disable docker.service
sudo systemctl status docker.service

SCP (copy files over ssh )

Copy files from server to local:

scp [email protected]:/folder/*.* /local/folder/

Copy files from local to server:

scp /local/folder/*.* [email protected]:/folder/ 

In this example, the server IP is 192.168.1.55

CHMOD

Add read/write permissions recursivelly for all groups in all files/folders:

sudo chmod -R a+rw /path/to/folder

✅ Sintaxes de comandos nas linguagens que utilizo

Comando C# Node Python
String interpolation $"my name is {name}" `my name is ${name}` f'my name is {name}' (new)
"my name is {}".format(name)

✅ Comandos de Terminal em Windows e Linux

System Show all environment variables Show one environment variable Add new environment variables
Linux/Mac printenv or env echo $JAVA_HOME or printenv JAVA_HOME export NEW_VAR=value
PowerShell dir env: or gci env: $env:JAVA_HOME or dir env:JAVA_HOME $env:NEW_VAR="value"
Windows CMD set or `set find "JAVA"` echo %JAVA_HOME%
Comando Linux / Mac cmd or Powershell
AND operator && && (cmd), ; (ps)
Line Break \ ^ (cmd), ` (ps)
Exibir caminho which where
Localizar arquivo find ./ -iname "*teste*" dir -Recurse teste.txt
Testar uma porta Telnet 192.168.1.55 80
nc -vz 192.168.1.55 80
Telnet 192.168.1.55 80
Command substitution $(pwd) or `pwd` não tem
Flush DNS sudo killall -HUP mDNSResponder
sudo /etc/init.d/networking restart
ipconfig /flushdns
Watch file tail -f /var/log/syslog Get-Content -Path "file.txt" -Wait
remove all rm -rf folder Remove-Item -Force -Recurse folder
create file touch file.txt New-Item file.txt

✅ Git (exemplos)

Stash

Objetivo Comando
Stash one file git stash push -m "message" -- test.txt
Stash untracked git stash push -m "message" -u
Apply staged too git stash apply --index
Apply specific git stash apply stash@{0}

✅ Docker (exemplos)

Imagens

Objetivo Comando
Baixar imagem docker pull mcr.microsoft.com/dotnet/core/runtime:3.1
Listar imagens docker image list --all
Remover imagem docker image rm mcr.microsoft.com/dotnet/core/runtime:3.1
Remover unused docker image prune --all

Containers

Objetivo Comando
Criar container docker container create -it --name 31 mcr.microsoft.com/core/runtime:3.1
Listar containers docker container list --all
Iniciar container docker container start 31
Copiar arquivos docker cp bin/. 31:home/bin
Conectar container docker container exec -it 31 /bin/bash
Acompanhar logs docker logs --follow 31
Parar container docker container stop 31
Remover container docker container rm 31
Remove stopped docker container prune
Limpar tudo docker system prune --all

Docker compose

Objetivo Comando
Docker compose "iterativo" sudo docker-compose run --rm service1

Exemplo de docker-compose.yml "iterativo":

version: "3"
services:
  service1:
    image: mcr.microsoft.com//core/runtime:3.1
    stdin_open: true
    tty: true
    command: "/bin/bash"

Docker (more)

docker system prune --all
docker volume prune 

✅ dotnet core

dotnet publish --configuration release --runtime linux-x64
dotnet publish --configuration release --runtime osx-x64 --self-contained true -p:PublishSingleFile=true
dotnet publish --configuration Release --runtime win-x64 --self-contained -p:PublishSingleFile=true -p:PublishTrimmed=true
dotnet nuget locals all --clear

✅ Configuração do VS Code

Instalar os plugins:

  • EditorConfig for VS Code
  • ESLint
  • vscode-icons

Configurar o settings.json (CTRL + SHIFT + P) - Preferences - Open Settings:

{
    "editor.fontFamily": "'Source code pro', Consolas, 'Courier New', monospace",
    "editor.fontSize": 14,
    "window.zoomLevel": 0,
    "workbench.startupEditor": "newUntitledFile",
    "workbench.iconTheme": "vscode-icons",
    "vsicons.presets.foldersAllDefaultIcon": true,
    "terminal.integrated.shell.windows": "C:\\WINDOWS\\System32\\cmd.exe",
    "editor.codeActionsOnSave": {
        "source.fixAll.eslint": true
    },
    "workbench.colorCustomizations": {
        "tab.activeBorderTop": "#ff0000"
    }  
}

✅ FFMPEG

Join videos

ffmpeg -f concat -safe 0 -i .\input.txt -c copy output.mp4

input.txt

file '01.mp4'
file '02.mp4'

Music + Video => Video_with_Music

ffmpeg -i video.mp4 -i music.mp4 -map 0:v -map 1:a -c:v copy -c:a copy -shortest video_with_music.mp4

✅ Abrir VS Code no MACOS pelo prompt:

  • Open the Command Palette (Ctrl+Shift+P) and type 'shell command' to find the Shell Command:
  • Install 'code' command in PATH command.

✅ Temp (catalogar depois...)

Subnet CIDR examples:

+--------+-----------------+
| CIDR   | Subnet Mask     |
+--------+-----------------+
| /32    | 255.255.255.255 |
| /24    | 255.255.255.0   |
| /16    | 255.255.0.0     |
| /8     | 255.0.0.0       |
+--------+-----------------+

Atalhos do Windows:

  • Network connections => Win+R ncpa.cpl
  • more...
  • more...
  • etc...

Tirar o "verdão" do background da exibição dos diretórios no comando ls.
Colocar isso no .bashrc da pasta home do usuário.

LS_COLORS='ow=01;36;40'
export LS_COLORS



CTRL + D no Visual Studio igual ao Visual Studio Code: Tools => Options => Keyboard => Show Command containing string:

Edit.InsertNextMatchingCaret
Edit.Duplicate



ssh no git:

ssh-keygen -t rsa -b 4096 -C "[email protected]"

Fonte Source Code PRO https://fonts.google.com/specimen/Source+Code+Pro

Instalar Java runtime 8 no MAC (pra usar com o VSTABI): https://www.java.com/en/download/mac_download.jsp

Instalar o Java Development Kit 8 no MAC (pra desenvolver com o Eclipse): https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

Link direto para o MAC OSX Mojave: https://itunes.apple.com/us/app/macos-mojave/id1398502828?ls=1&mt=12

Muito bom: https://loading.io/css/

trocar cor da janela do windows não ativado (chipa Microsoft!!!):
https://superuser.com/questions/1245923/registry-keys-to-change-personalization-settings

remove windows 10 watermark https://www.youtube.com/watch?v=X-E7syOcPEE

https://coderwall.com/p/7smjkq/multiple-ssh-keys-for-different-accounts-on-github-or-gitlab

find ./* | xargs xattr -r -d com.apple.quarantine

Dica do Akita

As Administrator!!!!

wmic diskdrive list brief
wsl --mount \\.\PHYSICALDRIVE1
echo $env:JAVA_HOME
dotnet nuget locals all --clear

The root account is disabled by default in Ubuntu, so there is no root password, that's why su fails with an authentication error.

LSP shortcuts

Command Visual Studio VS Code LazyVim Rider
Info (Hover) K K K ????????
Go to Definition gd gd gd gd
Go to Implementation gI gI gI gI
Go to References gr gr gr gr
Navigate Back <C-o> <C-o> <C-o> <C-o>
Navigate Forward <C-i> <C-i> <C-i> <C-i>
Open Terminal Ctrl + ` Ctrl + ` <C-/> ?????????
Signature help gK gK gK gK
Rename Symbol Ctrl + R, Ctrl + R F2 <leader>cr Shift + F6
Refactoring Ctrl + R, Ctrl + R Ctrl + Shift + R <leader>ca Ctrl + Alt + Shift + T
Format Document Ctrl + K, Ctrl + D Shift + Alt + F <leader>cf Ctrl + Alt + L
Quick Fix Ctrl + . Ctrl + . <leader>ca Alt + Enter

Use sudo to become root:

sudo -i 

About

Tips

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published