Skip to content

Instantly share code, notes, and snippets.

@nicolkill
Last active September 25, 2023 18:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nicolkill/9c42274615d8f95de2a9cb906c3b330f to your computer and use it in GitHub Desktop.
Save nicolkill/9c42274615d8f95de2a9cb906c3b330f to your computer and use it in GitHub Desktop.
commands

docker tasks

some task that you can do using docker instead install the tool directly in your computer

commands

dump data from external database, important add the network of the container

docker run -it --rm -v ${PWD}:/tmp --network project_network_default postgres pg_dump -c -f /tmp/dump.sql postgresql://postgres:postgres@postgres:5432/postgres

dump just a table as inserts file, also on conflict do nothing so if found existent values would continue the script

docker run -it --rm -v $PWD:/tmp --network project_network_default postgres pg_dump --table=proof --column-inserts --data-only --on-conflict-do-nothing -f /tmp/table_data_patch.sql postgresql://postgres:postgres@postgres:5432/postgres

Deletes all the data, compilations, dumps, networks, its like a clean brand new docker installation, use with safety

docker system prune -a

mixed formats

download file from a ssh remote server

with certificate file

# to download the file
scp -i ./ssh/id_rsa user@192.168.0.0:/remote/dir/foobar.txt /local/dir

# to upload the file
scp -i ./ssh/id_rsa /local/dir/foobar.txt user@192.168.0.0:/remote/dir

with user/password

# to download the file
scp user:password@192.168.0.0:/remote/dir/foobar.txt /local/dir

# to upload the file
scp -i ./ssh/id_rsa /local/dir/foobar.txt user:password@192.168.0.0:/remote/dir

tmux commands

description

tmux its an terminal based multi terminal operator, bases on session and windows, a session its the container of windows and a window its a single terminal

commands

  • tmux to open a tmux session
  • ctrl + b command on tmux
    • W display all windows, you can select one with arrows and enter
    • D leave session without close tmux session
    • N change of window
    • C new window
    • X close window, close all window causes a session close
    • [ change the cursor to content and you can scroll with arrows
  • tmux at enters to previous last session

vim

description

legendary text editor, based on line commands that its writed in a line command in bottom, its different to write text in the file so watch the difference

commands

  • g + g moves to the first line
  • shift + g moves cursor to last line

line commands

  • :q exit saving
  • :q! exit without saving
  • :set nu displays the line number
  • ?word to search a word in the text
  • in serach word wiht the key n you change to the next occurrence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment