Skip to content

Instantly share code, notes, and snippets.

View namtx's full-sized avatar
🐤
Fullstuck developer

0x6e616d7478 namtx

🐤
Fullstuck developer
View GitHub Profile
@namtx
namtx / docker-compose.yml
Created January 10, 2023 12:45
ZooKeeper + Kafka + MySQL + Debezium Connector local setup with docker-compose
version: '2'
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
environment:
ZOOKEEPER_CLIENT_PORT: 2181
ZOOKEEPER_TICK_TIME: 2000
ports:
- 22181:2181
package dev.namtx.leetcode.daily;
public class ReverseVowelsOfAString {
public static void main(String[] args) {
System.out.println(new ReverseVowelsOfAString().reverseVowels("aA"));
}
public String reverseVowels(String s) {
char[] chars = s.toCharArray();
int left = 0;
package dev.namtx.leetcode.daily;
/**
* https://leetcode.com/problems/minimum-genetic-mutation
*/
public class MinimumGeneticMutation {
public int minMutation(String start, String end, String[] bank) {
boolean[] checked = new boolean[bank.length];
int min = minMutation(start, end, bank, checked, 0);
if (min == Integer.MAX_VALUE) return -1;
@namtx
namtx / useEffectDebugger.js
Created April 15, 2022 03:54 — forked from nvh95/useEffectDebugger.js
Find which dependency cause useEffect to fire
// Credit to https://stackoverflow.com/a/59843241/3422559
import { useEffect, useRef } from "react";
const usePrevious = (value, initialValue) => {
const ref = useRef(initialValue);
useEffect(() => {
ref.current = value;
});
return ref.current;
@namtx
namtx / appscript.gs
Created April 1, 2022 05:59
appscript
const AMAZON_SELLER_NOTIFICATION_LABEL_NAME = "Amazon Seller Notification";
const NOTIFICATION_SUBJECT_PREFIX = "Sold, ship now:";
const ORDER_ID_REGEX = "Order ID: 113-3770207-6613845";
const MANAGE_ACCOUNT_SHEET_NAME = "MANAGE ACCOUNT";
const AMZ_MAILS_SHEET_NAME = "AMZ MAILS";
const IGNORED_ORDERS_SHEET_NAME = "Ignored Orders";
const _ = LodashGS.load();
const ORDER_DETAIL_MAPPINGS = {
shipBy: /(?:Ship by: )(.+)\n/,
@namtx
namtx / Solution.java
Created January 21, 2022 16:56
416. Partition Equal Subset Sum
package dev.namtx.leetcode;
import java.util.Arrays;
public class PartitionEqualSubsetSum {
public static final int UNCALCULATED = -1;
public static final int IMPOSSIBLE = 1;
public static final int POSSIBLE = 0;
public static void main(String[] args) {
@namtx
namtx / Solution.java
Last active January 20, 2022 07:52
2115. Find All Possible Recipes from Given Supplies
package dev.namtx.leetcode;
import java.util.*;
/**
* https://leetcode.com/problems/find-all-possible-recipes-from-given-supplies/
*
* tags: topological sort, dfs
*/
public class FindAllPossibleRecipesFromGivenSupplies {
@namtx
namtx / Assignment - Local.postman_environment.json
Created September 4, 2020 05:28
Assignment Local Environent
{
"id": "f608af19-c772-4e9a-8b9c-d733d924743a",
"name": "Assignment - Local",
"values": [
{
"key": "accessToken",
"value": "",
"enabled": true
},
{
@namtx
namtx / main.tf
Last active November 29, 2023 18:06
terraform + k3sup
provider "google" {
project = var.google_project_id
region = var.region
zone = var.az
}
resource "google_compute_instance" "k3s_master_instance" {
name = "k3s-master"
machine_type = "n1-standard-1"
tags = ["k3s", "k3s-master", "http-server", "https-server"]
@namtx
namtx / kubernetes-dashboard-admin.rbac.yaml
Created August 11, 2020 03:59
kubernetes dashboard admin rbac
apiVersion: v1
kind: ServiceAccount
metadata:
name: admin-user
namespace: kube-system
---
# Create ClusterRoleBinding
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata: