Hanif-Ibadurrahman / dokumentasi

Berisikan info dan langkah - langkah

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dokumentasi

Repository ini adalah berisikan info dan langkah - langkah seputar programming.

Table of Contents

  1. Linux

Linux

  • 1.1.1 Node & Npm

    sudo apt update
    sudo apt install nodejs && sudo apt install npm
    sudo npm cache clean --force
    sudo npm i -g n
    sudo n latest / sudo n stable

  • 1.1.2 Youtube-DL

    sudo curl -L https://yt-dl.org/downloads/latest/youtube-dl -o /usr/local/bin/youtube-dl
    sudo chmod a+rx /usr/local/bin/youtube-dl

  • 1.1.3 Git

    Source: GIT

    sudo add-apt-repository ppa:git-core/ppa
    sudo apt update
    sudo apt install git

    Set session

    git config --global credential.helper store
    git config --global credential.helper cache

  • 1.1.4 Composer

    Download file secara manual di https://getcomposer.org/download/ atau
    sudo curl -L https://getcomposer.org/download/ -o /usr/local/bin/composer
    mv composer.phar /usr/local/bin/composer
    sudo chmod -R 755 /usr/local/bin/composer

  • 1.1.5 PHP

    sudo apt install software-properties-common
    sudo add-apt-repository ppa:ondrej/php
    sudo apt install php8.1 php8.1-curl php7.4 

    Switch PHP Version

    sudo update-alternatives --config php

To install or update nvm, you should run the install script

curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash
wget -qO- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh | bash

sudo apt update
sudo apt install zsh
sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"

for default terminal select button side search > preferences > unnamed > command > run a custom command instead of mt shell > custom command > zsh

[Antigen](https://github.com/zsh-users/antigen)

curl -L git.io/antigen > antigen.zsh
# User configuration
source ~/antigen.zsh

# Load the oh-my-zsh's library.
antigen use oh-my-zsh

# Bundles from the default repo (robbyrussell's oh-my-zsh).
antigen bundle git
antigen bundle heroku
antigen bundle pip
antigen bundle lein
antigen bundle command-not-found

# Syntax highlighting bundle.
antigen bundle zsh-users/zsh-syntax-highlighting
antigen bundle zsh-users/zsh-autosuggestions

# Load the theme.
antigen theme spaceship-prompt/spaceship-prompt

# Tell Antigen that you're done.
antigen apply

alias cgg="git log --oneline --pretty=oneline --graph"

reopen terminal and run

zsh

set zsh for default terminal click hamburger button on terminal > preferences > unnamed > tab command > click Run a custom command instead of my shell > zsh

Location for setting VS Code

~/.config/Code/User/settings.json 
{
  "editor.formatOnPaste": true,
  "editor.formatOnSave": true,
  "terminal.integrated.defaultProfile.linux": "zsh",
  "php.suggest.basic": false,
  "[php]": {
    "editor.defaultFormatter": "bmewburn.vscode-intelephense-client"
  },
  "[typescript]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[typescriptreact]": {
    "editor.defaultFormatter": "esbenp.prettier-vscode"
  },
  "[go]": {
    "editor.defaultFormatter": "golang.go"
  },
}

Plugin: Eslint, change-case, Color Highlight, Docker, GitLents - Git supercharged, Prettier - Code Formatter, Svg Preview, PHP Intelephense, Laravel Extra Intellisense, Javascript and TypeScript Nightly, Github Copilot

Laravel projects by globally installing the Laravel installer:

   composer global require laravel/installer

For zsh:

echo 'export PATH="$PATH:$HOME/.config/composer/vendor/bin"' >>  ~/.zshrc
source ~/.zshrc

Docker ps displays every docker instance currently running in your environment. If you add the -a option, then you even have the stopped ones.

  docker ps (-a)

Docker-compose ps displays all the containers once started with it (currently running or not).

  docker-compose ps

The docker images show to you the images you have build, and the -a show you the intermediate images.

  docker images (-a)

It will build your images if they aren't already and will start your dockers

  docker-compose up

If you want to re-build your images, use the option --build (you can also use the command docker-compose build to only build the images). The option -d, which means "detach" make the containers run in the background.

  docker-compose up -d --build

With Docker, you need a separate command to build your image where you can specify the name of your image and you have to specify the PATH or URL to your context (this can be a git repository).

  docker build (-t <NAME>) <PATH>/<URL>

Example

  docker build -t local/something-api:latest .

Example with arg

  docker build --build-arg APP_ENV=development -t local/something-fe:latest .

This command allows you to connect to the shell of your container. I prefer using "/bin/bash" but your container may not have bash installed and only "sh" which is more common.

  docker exec -it <NAME>/<ID> <“sh”>/<”/bin/bash”>

Example

  docker exec -it facec6d02097 sh

Run create the container using the image you tell it. You can specify lots of parameters, I recommend you to add a name to your container and you may need to specify some ports to expose. As for docker-compose, the -d make the container run in the background

  docker run (-d) (-p <hostPort>:<containerPort>) (--name <NAME>) <IMGNAME>/<IMGID>

The docker rm remove only one container when docker-compose rm remove every container started with a docker-compose command.

  docker rm <ID>/<NAME>
  docker-compose rm

Docker rmi delete the image you give as a parameter and recursively all the images intermediate used to build it.

  docker rmi <ID>/<NAME>

This command prints you the logs of the container you specify. If you use the option -f --tail you can follow the live flux of your logs ( is the number of lines you want to display. Keep in mind to choose a number of lines you can handle and to not be overwhelmed by your logs).

    docker logs <ID>/<NAME> (-f --tail <NBLINE>)

The option (/) with the docker-compose logs let you see the logs from only one container instead of every logs. The point here is if you don’t use the -d option when using docker run or docker-compose up you will see your logs directly (but you will need to stop the container to quit the view). It can still be useful to debug launching apps.

    docker-compose logs (<ID>/<NAME>)

Fix-permission-docker-kill

  sudo aa-status
  sudo systemctl disable apparmor.service --now
  sudo service apparmor teardown
  sudo aa-status
  docker-compose down

Install

curl "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip"
unzip awscliv2.zip
sudo ./aws/install

Configure

aws configure

List the buckets:

aws --endpoint-url http://endpoint ls

List content in buckets:

aws --endpoint-url https://endpoint s3 ls s3://dox/attachment/document/

Move content:

aws --endpoint-url https://endpoint s3 mv --recursive s3://dox/attachment/document/document/ s3://dox/attachment/document/

Install rbenv

git clone https://github.com/rbenv/rbenv.git ~/.rbenv

For Zsh:

echo 'eval "$(~/.rbenv/bin/rbenv init - zsh)"' >> ~/.zshrc 

Dependencies required to install Ruby:

sudo apt install git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev

List latest stable versions

rbenv install -l

Latest ruby now:

rbenv install 3.1.3

Set global

rbenv global 3.1.3  

Install Rails:

  gem install rails

Install Go to website https://www.rabbitmq.com/install-debian.html#apt-clouds then copy script and save on format sh

chmod 755 <filename>.sh
./<filename>.sh

To enable RabbitMQ Management Console, run the following:

sudo rabbitmq-plugins enable rabbitmq_management

Note: If you enable this console after running the service, you will need to restart it for the changes to come into effect. See the relevant management section below for your operating system to be able to do it.

it can be accessed using web browser by visiting: http://[IP]:15672/ The default username and password are both set “guest” for the log in.

⬆ back to contents

  • 2 Create

  • 2.1 Create SSH
ssh-keygen -t rsa

How to get result ssh

cat ~/.ssh/id_rsa.pub

⬆ back to contents

  • 3 Reset

  • 3.1 Reset Trial Navicat On Linux

If you don't want to activate and just want to reset the trial, please delete the ~/.config/dconf/user files and the ~/.config/navicat folder. Pay attention to the backup data.

rm ~/.config/dconf/user
rm -r ~/.config/navicat

⬆ back to contents

  • 4 Doesn't work

  • 4.1 libfuse.so.2: cannot open shared object file

Ubuntu 22.04: Appimage doesn't start : libfuse.so.2: cannot open shared object file: No such file or directory

sudo apt install libfuse2

  • 4.2 not found go lib
export PATH=$(go env GOPATH)/bin:$PATH

  • 4.3 export variable from env file
export $(cat .env)

About

Berisikan info dan langkah - langkah


Languages

Language:C++ 99.5%Language:Shell 0.5%