Skip to content

Instantly share code, notes, and snippets.

View DoZator's full-sized avatar
😺
Working

Oleg Bogatenko DoZator

😺
Working
View GitHub Profile
@DoZator
DoZator / Dockerfile
Last active April 12, 2021 07:39
Run old Rails 3.2 (Ruby 1.9.3) app for Development with Docker
FROM ruby:1.9.3
MAINTAINER DoZator <[email protected]>
# Create app directory
RUN mkdir -p /app
WORKDIR /app
COPY Gemfile /app/
@DoZator
DoZator / tunnel.md
Last active May 22, 2023 07:02
SSH Tunneling (SSH port forwarding)

Opening SSH tunnel in a shell

    ssh -L 3000:localhost:3000 -N remotehost

-N - for "run no command". To create a local port forwarding, pass the -L option to the ssh client

 ssh -L 3000:localhost:3000 -N remotehost &amp;
@DoZator
DoZator / readme.md
Last active December 19, 2017 13:13
Solving Docker permission denied for user

Solving Docker permission denied for user

    sudo usermod -a -G docker $USER
@DoZator
DoZator / README.md
Created December 21, 2017 12:22
Add user on Ubuntu 16.04 (access with public SSH key)

Add user

    adduser user

Add new user to the 'sudo' group

 usermod -aG sudo user
@DoZator
DoZator / readme.md
Last active July 13, 2023 11:45
Port and listening sockets

This command shows the port and listening socket associated with the service for TCP protocol

    sudo netstat -vanp tcp

Find who uses port

 sudo netstat -vanp tcp | grep PORT_NUMBER
@DoZator
DoZator / tokens.md
Created August 23, 2018 12:46 — forked from zmts/tokens.md
Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Про токены, JSON Web Tokens (JWT), аутентификацию и авторизацию. Token-Based Authentication

Preconditions:

В данной заметке рассматривается работа JWT с симметичным алгоритмом шифрования (HS256/HS384/HS512)

Основы:

Аутентификация(authentication, от греч. αὐθεντικός [authentikos] – реальный, подлинный; от αὐθέντης [authentes] – автор) - это процесс проверки учётных данных пользователя (логин/пароль). Проверка подлинности пользователя путём сравнения введённого им логина/пароля с логином/паролем, сохранённым в базе данных пользователей.

Авторизация(authorization — разрешение, уполномочивание) - это проверка прав пользователя на доступ к определенным ресурсам.

@DoZator
DoZator / README.md
Created April 8, 2019 14:16
Disable Automatic Updates (Ubuntu)

Edit /etc/apt/apt.conf.d/20auto-upgrades to disable automatic updates:

sudo vim /etc/apt/apt.conf.d/20auto-upgrades

Switch off the Update-Package-Lists directive from 1 to 0:

APT::Periodic::Update-Package-Lists "0";
@DoZator
DoZator / README.md
Created April 18, 2019 08:51
Using Amazon ECR

ECR Container Repository

Create repository

aws ecr create-repository --repository-name myproject/appname

Delete repository

@DoZator
DoZator / README.md
Created May 3, 2019 08:21
Saver docker image as a tar file

Saver docker image as a tar file

docker save -o <path_for_tar_file> <image_name>

Load the image into Docker

docker load -i 
@DoZator
DoZator / README.md
Created May 20, 2021 09:34
Golang modules

Creating a Go module

Inside our project directory, we're going to initialize our project as a Go module.

$ go mod init github.com/DoZator/my-new-project

Directly adding dependency to the go.mod file