Skip to content

Instantly share code, notes, and snippets.

View xardit's full-sized avatar
🍀

Ardit Hyka xardit

🍀
View GitHub Profile
@zachshallbetter
zachshallbetter / README.md
Created September 29, 2023 21:33
Middleware Examples

Next.js Middleware Examples

This Gist contains a collection of Next.js Middleware examples that demonstrate various use cases and scenarios for enhancing your Next.js applications. Middleware in Next.js allows you to intercept, modify, and control the flow of requests and responses, making it a powerful tool for building robust web applications.

Middleware Examples

  1. Authentication Middleware (authenticationMiddleware.ts):
    • Checks if the user is authenticated based on a session cookie.
    • Redirects unauthenticated users to the login page.
  • Ensures users have the necessary role to access protected routes.
@jvdi
jvdi / dockerizeWireguardOverWebsocket.md
Last active August 7, 2024 09:52
Set Up a dockerize Wireguard VPN Server over WebSocket Tunneling

This tutorial good for Linux or Unix system at the end need to run bash script for connect
(Also it's have some technic for use in windows - Explained at client install section.)

VPS => virtual private server as wiregurd vpn server

Requirements

  • Assuming the firewall is off (Not Secure - it's just for test so in production: config firewall)
  • VPS have docker and docker-compose (for install instrucrion : docker site full explained)
  • In VPS enable net.ipv4.ip_forward=1 at /etc/sysctl.conf (or /etc/sysctl.d/99-sysctl.conf) and reboot your system
  • Have access to root user in VPS
@belgattitude
belgattitude / ci-yarn-install.md
Last active November 5, 2024 08:32
Composite github action to improve CI time with yarn 3+ / node-modules linker.
#########################################################
# Tekton #
# Kubernetes Cloud-Native CI/CD Pipelines And Workflows #
# https://youtu.be/7mvrpxz_BfE #
#########################################################
# Referenced videos:
# - Argo Workflows and Pipelines - CI/CD, Machine Learning, and Other Kubernetes Workflows: https://youtu.be/UMaivwrAyTA
# - Automation of Everything - How To Combine Argo Events, Workflows & Pipelines, CD, and Rollouts: https://youtu.be/XNXJtxkUKeY
# - Kaniko - Building Container Images In Kubernetes Without Docker: https://youtu.be/EgwVQN6GNJg
@MBrassey
MBrassey / Match_Addresses.md
Last active September 29, 2024 20:11
Match Crypto Wallet Addresses (REGEX)

Match Crypto Wallet Addresses using Regular Expressions

The following regular expressions are crafted to match some commonly used cryptocurrency wallet address types. This document details the Regex components and pattern tests to match Ethereum, Bitcoin, Dash and Monero addresses.

🌀 Click the images below to view the tested patterns.

Ethereum (ETH)

/^0x[a-fA-F0-9]{40}$/g

@BretFisher
BretFisher / cert.sh
Created August 13, 2020 18:45
docker compose with traefik and certs
#!/usr/bin/env bash
set -euo pipefail
IFS=$'\n\t'
DOMAIN_NAME=$1
openssl req \
-newkey rsa:2048 \
-x509 \
-nodes \
@d4v3y0rk
d4v3y0rk / howto.md
Created March 14, 2020 13:04
Encryption with DM_CRYPT in WSL2

Encrypted Volumes in WSL2

Description

This is a quick guide on how to setup dm_crypt under WSL2 for working with encrypted volumes. I use an encrypted volume to store things like password recovery codes and 2nd factor backup codes etc. I recently switched over to using WSL2 and wanted to figure out how to enable this functionality there. This is the distilled howto for getting it to work.

Guide

First thing you have to do is create a custom WSL2 kernel. Inside your already installed and running WSL2 (ubuntu) installation:

  • Install some required packages.
@ZhuYouwei
ZhuYouwei / Export Notes.AppleScript
Last active August 14, 2021 12:50
Export Mac Notes to txt file
property outputPath : (path to desktop as text) & "export"
tell application "Finder"
if not (exists outputPath) then
make new folder at desktop with properties {name:"export"}
end if
end tell
tell application "Notes"
set Nf to text returned of (display dialog "Folder Name" default answer "Notes")
@lbrame
lbrame / podman_arch_rootless.md
Created February 11, 2020 17:47
Running rootless unprivileged Podman containers on Arch Linux

Setting up podman rootless containers on Arch Linux

Podman is a container engine that is similar to and fully compatible with Docker that has the peculiarity of not requiring a daemon to run and to allow for rootless containers, which are often deemed safer than privileged containers running as root. Podman is a drop-in replacement for Docker that even supports the same syntax and it has good support from Red Hat.

However, running podman rootless containers on Arch Linux may not be obvious, so I'm writing the instructions I have used to achieve that here.

Podman works using control groups and users from which said containers need to be launched need to be assigned an appropriate range of subordinate user and group IDs. On Arch Linux, these files are not present and they need to be created.

From a root shell: