Skip to content

Instantly share code, notes, and snippets.

@paintmeyellow
paintmeyellow / commands
Last active May 31, 2023 06:48
ubuntu 22.04 wireguard
Import new connection:
nmcli connection import type wireguard file developers-amst.conf
Disable autoconnect:
nmcli connection modify developers-amst autoconnect no
Check connection profile:
nmcli connection show developers-amst
Wireguard Indicator:
@paintmeyellow
paintmeyellow / gist:283c8384a84f99c2ab7189cbc3b680da
Created April 26, 2022 18:03
How to Extend Swap Space using Swap file in Linux
//1. Check the size of existing swap space
free -m
//2.Create a swap file of size 1 GB
sudo fallocate -l 1G /swap_file
//3.Secure the swap file
chmod 600 /swap_file
//4.Enable the Swap Area on Swap File
@paintmeyellow
paintmeyellow / docker-compose.yml
Created March 30, 2022 11:47
Protobuf compiler + Go plugin + buf in Docker container
version: "3"
services:
buf:
build:
context: .
dockerfile: docker/proto.Dockerfile
volumes:
- ./:/workspace
working_dir: /workspace
git clone https://github.com/Nyr/openvpn-install
chmod +x ./openvpn-install/openvpn-install.sh
./openvpn-install/openvpn-install.sh
@paintmeyellow
paintmeyellow / gist:913fd91150f6259cd9cee70712bb1e15
Last active July 16, 2024 12:05
AES-128-GSM Cipher Golang+PHP
<?php
function handle(): void
{
$method = 'AES-128-GCM';
$msg = 'message';
$pass = 'password';
$tagLength = 16;
$key = hash('md5', $pass, true);
@paintmeyellow
paintmeyellow / script.sh
Last active November 26, 2022 19:57
Merge two files line by line
paste -d " " file1.txt file2.txt > merged.txt
@paintmeyellow
paintmeyellow / func.php
Last active November 26, 2022 19:57
nestedSets getTree
<?php
public function getTree(): array
{
$trees = [];
$stack = [];
$categories = ...;
foreach ($categories as $category) {