Skip to content

Instantly share code, notes, and snippets.

@fabriciofmsilva
Last active July 12, 2019 21:38
Show Gist options
  • Save fabriciofmsilva/e408bd803b064d6b9f665d215bf4d33a to your computer and use it in GitHub Desktop.
Save fabriciofmsilva/e408bd803b064d6b9f665d215bf4d33a to your computer and use it in GitHub Desktop.
Linux

asdf

asdf: Language version management

Installation

# core
git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.7.2

# plugins
## ruby
asdf plugin-add ruby https://github.com/asdf-vm/asdf-ruby.git
...
## nodejs
asdf plugin-add nodejs https://github.com/asdf-vm/asdf-nodejs.git
...
## golang
asdf plugin-add golang https://github.com/kennyp/asdf-golang.git
...
## erlang
asdf plugin-add erlang https://github.com/asdf-vm/asdf-erlang.git
...
## elixir
asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git
...
## kotlin
asdf plugin-add kotlin https://github.com/missingcharacter/asdf-kotlin.git
...
## rust
asdf plugin-add rust https://github.com/code-lever/asdf-rust.git
...
## crystal
asdf plugin-add crystal https://github.com/marciogm/asdf-crystal.git
...

Commands

asdf plugin-list

asdf list-all <LANGUAGE_NAME>

asdf install <LANGUAGE_NAME> <LANGUAGE_VERSION>

asdf global <LANGUAGE_NAME> <LANGUAGE_VERSION>

asdf local <LANGUAGE_NAME> <LANGUAGE_VERSION>

asdf help

asdf update

asdf plugin-update --all

Resources

Databases: Postgresql 10, Redis, Memcached e MongoDB

ls /etc/init.d

service or systemctl
sudo service <SERVICE_NAME> <SERVICE_COMMAND>
sudo systemctl <SERVICE_COMMAND> <SERVICE_NAME>

Postgresql

sudo service postgresql status

sudo su postgres
createuser --interactive

Redis

sudo service redis-server status

Memcached

sudo service memcached status

MongoDB

sudo service mongod status

sudo service mongod start
sudo service mongod stop

sudo service mongod disable

Docker

docker run hello-world

docker ps

docker stop <CONTAINER_ID>

Postgres

docker pull postgres
docker pull postgres:[tag_you_want]

mkdir -p $HOME/docker/volumes/postgres

docker run --rm   --name pg-docker -e POSTGRES_PASSWORD=docker -d -p 5432:5432 -v $HOME/docker/volumes/postgres:/var/lib/postgresql/data  postgres

psql -h localhost -U postgres -d postgres

ps aux

cat /proc/<PS_ID>/csgroup

Linux

dpkg -L software-properties-common

sudo apt install tilix zsh

sh -c "`curl -fsSL https://raw.githubusercontent.com/skwp/dotfiles/master/install.sh `"

Cryptography

Keys (algorithm)

  1. Digest (md5, sha1, sha512, bcrypt, hmac) finger print
  2. Symmetric encryption (Triple DES, Blowfish, AES)
  3. Asymmetric encryption
ssh-keygen -o -a 100 -t ed25519 -f ~/.ssh/id_ed25519 -C "<EMAIL>"
cat ~/.ssh/id_ed25519
cat ~/.ssh/id_ed25519.pub

eval "$(ssh-agent -s)"
ssh add ~/.ssh/id_ed25519

git

git config --global user.name "<NAME>"
git config --global user.email "<EMAIL>"

cat .gitconfig

tmux

sudo apt install tmux
tmux

tmux ls
tmux attach-session -t 0
tmux kill-session -t 0

man tmux

# commands
ctrl b + % -> split horizontal
ctrl b + " -> split vertical
ctrl b + o -> navigate panel

vim

vim

:split
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment