Skip to content

Instantly share code, notes, and snippets.

View alexx384's full-sized avatar

Aleksei Palenyi alexx384

View GitHub Profile
@alexx384
alexx384 / Change_commit.md
Created October 10, 2024 12:26
Change commit and rewrite git history
@alexx384
alexx384 / init.lua
Last active May 9, 2024 19:23
Neovim config
-- NVIM v0.9.5
-- Directory where to put it: ~/.config/nvim/init.lua
-- Prerequisites: vim-plug - https://github.com/junegunn/vim-plug (After installation open nvim, type :PlugInstall and hit Enter)
-- Configure shared clipboard
if vim.loop.os_uname().sysname == 'Linux' then
vim.o.clipboard = 'unnamedplus'
elseif vim.loop.os_uname().sysname == 'Darwin' then
vim.o.clipboard = 'unnamed'
end
@alexx384
alexx384 / Readme.oracle_redo_from_aws_rds.md
Created March 20, 2024 19:55
Gather Oracle Redo logs from AWS RDS Oracle database and analyze them using LogMiner

The whole process of database audit is consists of the following steps:

  1. Archive log extraction from AWS RDS Oracle in custom Oracle format and uploading it to S3 bucket
    • based on Production AWS RDS Oracle database
  2. Archive log extraction from Oracle custom backup format
    • based on fully managed Oracle database. In this case I'm going to use Oracle database in Docker
  3. Archive log analysis
    • based on fully managed Oracle database. In this case I'm going to use Oracle database in Docker

Note: the databases in docker from step 2 and step 3 should be based on different docker containers. I'm going to use Oracle 19c database

@alexx384
alexx384 / connect_via_proxy_under_ssh.md
Created May 22, 2023 12:58
Connect via Remote server instance

Connect using Squid proxy via SSH

This method requires installing squid proxy on the remove machine. Then forwarding proxy port via SSH tunnelling.

Configure squid

Perform futher commands from this section on the server instance.

Install squid:

sudo apt update && sudo apt install squid -y
@alexx384
alexx384 / cisco-vpn-forward.md
Last active March 11, 2022 15:11
How to forward traffic through the Cisco VPN (anyconnect) on Kubuntu 20.04

Inspired by https://unix.stackexchange.com/a/613771

In this example I'll forward traffic on 1.2.3.4 IP address through Cisco VPN. I assume that Cisco VPN use interface cscotun0 to forward the traffic.

Create set of IPs that should be forwarded via Cisco VPN

Using ipset command create set of IPs in the Kernel

sudo ipset -N cisco-forward-ips iphash
sudo ipset add cisco-forward-ips 1.2.3.4
@alexx384
alexx384 / Install&ConfigureAnsibleMaster&WorkerNode.md
Last active December 30, 2020 12:40
Install and configure ansible master and worker nodes in docker containers

How to install ansible master and worker nodes in docker containers

This instruction describes how to install and configure:

  • ansible master node in docker container
  • ansible worker node in docker container

0. Requirements

To do that you need:

  • Linux operating system
  • Installed Docker (docker and docker.io)
@alexx384
alexx384 / memmem.md
Last active June 12, 2022 23:45
Custom implementation of memmem() for Windows and others

The implementation based on the StackExchange question and answers. Also added some improvements.

#include <stdlib.h>

void* memmem(const void* haystack, size_t haystackLen,
             const void* needle, size_t needleLen)
{
	/* The first occurrence of the empty string is deemed to occur at
@alexx384
alexx384 / vscode_python_preparation.md
Created February 17, 2019 15:53
Configure Python for Visual Studio Code in Ubuntu 18.04
  1. Install plugin ms-python.python.
  2. In vscode open File -> Preferneces -> Settings. Click on the Workspace Settings. In the search box type: pep8.
  3. Open the terminal. Install pep8, autopep8, pylint. You can do that by user or admin, you decide. I prefer like user:
pip3 install pep8
pip3 install autopep8
pip3 install pylint
  1. After that, enter which pep8 and copy the output to vscode in the field Python › Linting: Pep8Path.
  2. Enter the which autopep8 and copy the output to vscode in the field Python › Formatting: Autopep8Path.
@alexx384
alexx384 / ubuntu_ftp_configure.md
Last active February 10, 2019 19:52
Install and configure ftp on ubuntu, by using vsftpd

To install execute the following command: sudo apt install vsftpd

Make backup of the /etc/vsftpd.conf by executing: sudo cp /etc/vsftpd.conf /etc/vsftpd.conf.bak. Clear all from the /etc/vsftpd.conf and paste the following lines:

listen=YES

anon_root=/srv/ftp/public
@alexx384
alexx384 / ubuntu_deny_program_internet.md
Last active February 10, 2019 19:53
Ubuntu forbid access to the Internet for the specific program

For that tutorial, I will use user testuser. So you need to change testuser to your username.

  1. Create no-internet group: sudo groupadd no-internet
  2. Add testuser to the no-internet group: sudo usermod -aG no-internet testuser
  3. Create script for easy run:
  • Check that the directory is exist: mkdir -p /home/testuser/.local/bin
  • Create sript echo -e '#!/bin/bash\nsg no-internet "$@"' > /home/testuser/.local/bin/no-internet
  • Set rights to script: chmod 744 /home/testuser/.local/bin/no-internet
  1. Add iptables rule for dropping network activity for group no-internet: sudo iptables -I OUTPUT 1 -m owner --gid-owner no-internet -j DROP
  2. Check that all works: no-internet "ping 8.8.8.8"