Skip to content

Instantly share code, notes, and snippets.

View lysender's full-sized avatar

Lysender lysender

View GitHub Profile

Mongo Dump using a root user

Note: Regular user may skip the --authenticationDatabase admin part

mongodump --host 127.0.0.1 -u root -p password --authenticationDatabase admin --db db_name --forceTableScan;
@lysender
lysender / create-mysql-user.md
Created June 15, 2025 05:31
Create MySQL User

Create a user with high level admin access to all databases

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'admin'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
@lysender
lysender / crate-aws-vpc-subnets-with-terraform.md
Created June 15, 2025 05:28
Creating VPCs and Subnets with Terraform and IaC

Creating VPCs and Subnets with Terraform and IaC

Introduction

In this exercise, we will walk through the process of creating a basic infrastructure on AWS using Terraform, an open-source Infrastructure as Code (IaC) tool. Specifically, we'll create a Virtual Private Cloud (VPC) with two subnets, a public and a private one. We will also create an Internet gateway and a route table, which will be associated with our public subnet. This setup mimics a typical cloud infrastructure configuration, separating resources into public and private subnets for improved security and control.

Desired Outcome

If you wish to give it a shot before looking into the detailed step-by-step and the solution videos, here is an overview of what the created solution should deploy:

@lysender
lysender / crate-vps-manually-in-aws.md
Created June 15, 2025 05:14
Creating VPCs and Subnets Manually in AWS

Creating VPCs and Subnets Manually in AWS

Introduction

In this exercise, we will focus on manually building a simple VPC-subnet infrastructure on the AWS Console. This includes creating a VPC, two subnets (one public and one private), an Internet Gateway, and a public route table. By creating these elements manually, we will gain a deeper understanding of how intricate and challenging the process of creating and managing infrastructure can be. This will provide a foundation for appreciating the benefits of Infrastructure as Code (IaC) in automating these tasks and maintaining consistency across environments.

Desired Outcome

If you wish to give it a shot before looking at the detailed step-by-step and the solution videos, here is an overview of what the created solution should deploy:

@lysender
lysender / mysql-create-user.md
Created May 23, 2025 09:00
MySQL - create all around user for dev purposes

Create an all around user for MySQL for dev purposes.

CREATE USER 'admin'@'localhost' IDENTIFIED BY 'password';
CREATE USER 'admin'@'%' IDENTIFIED BY 'password';

GRANT ALL PRIVILEGES ON *.* TO 'admin'@'localhost' WITH GRANT OPTION;
GRANT ALL PRIVILEGES ON *.* TO 'admin'@'%' WITH GRANT OPTION;
@lysender
lysender / til-enable-application-passwords-on-wordpress-development-env.md
Last active November 29, 2023 22:32
TIL - Enable application passwords on WordPress development environment

API Passwords vs Application Passwords

Forget about API passwords, they are useless in production.

You need the "Application Passwords" instead which can be used for "Basic" authentication when calling the REST API.

This requires HTTPS so this is normally not enabled in local development.

Enable Application Passwords in development environment

@lysender
lysender / til-moving-within-quotes.md
Created November 15, 2023 04:00
TIL - vim - moving within quotes

Basic key bindings

f" and f' to move to the next double quote or single quote.

F" and F' to move to the previous double quote or single quote.

Used when you want to select or copy text including the quotes.

t" and t' to move to the last character before the next double quote or single quote.

@lysender
lysender / leetcode-rust-single-element-in-a-sorted-array.md
Created November 6, 2023 03:45
Leetcode - Rust - Single Element in a Sorted Array

Problem: https://leetcode.com/problems/single-element-in-a-sorted-array/description/ Solution: https://leetcode.com/problems/single-element-in-a-sorted-array/solutions/4254843/rust-solution-using-binary-search/

Using binary search, seek middle. The idea is that since this is a sorted array, finding which side has the single element is just a matter of comparing adjacent items from the middle and the distance between middle and the edges.

For example, if the middle item and the item to the left is equal and the distance between the middle and the left is even, then the single element must not be on the left since the distance is an event number. It must be to the right.

impl Solution {
    pub fn single_non_duplicate(nums: Vec<i32>) -> i32 {
@lysender
lysender / leetcode-add-to-array-form-of-integer.md
Created October 27, 2023 03:33
Leetcode add to array form of integer
@lysender
lysender / nvim-typescript-lsp-auto-import-path-incorrect.md
Created October 26, 2023 03:51
NeoVim + TypeScript LSP - auto import path incorrect - always starts at src

I am working on several projects with neovim with TypeScript LSP installed.

In some projects, the auto import correctly set the path using relative paths.

However, some projects always starts its import at src for some reason.

Tried to configure LSP to always use relative path but can't make it work.

Somehow, there is something in my project configuration that broke the LSP import.