Skip to content

Instantly share code, notes, and snippets.

View tuananhlai's full-sized avatar

Lại Tuấn Anh tuananhlai

  • Japan
  • 18:33 (UTC -12:00)
View GitHub Profile
#!/bin/zsh
echo "🖥️ Mac Setup Script"
echo "===================="
# Ask if this is a company machine
echo ""
echo "Is this a company-issued machine? (y/n)"
read is_company_machine
echo ""
@tuananhlai
tuananhlai / kafka-copy-topic.sh
Last active March 23, 2022 04:27
Copy all messages from a source topic to a target topic
DELIM="$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 40 | head -n 1)";
# Add `-c 1` to test with 1 message
kcat -b localhost:9092 -C -t source_topic -D "$DELIM" -K: -e -o beginning | kcat -b localhost:9092 -P -D "$DELIM" -t target_topic -K:
@tuananhlai
tuananhlai / .vimrc
Last active December 20, 2021 06:31
Neovim configuration
set tabstop=2
set shiftwidth=2
set expandtab
set number
set so=5
set nocompatible " We're running Vim, not Vi!
syntax on " Enable syntax highlighting
filetype on " Enable filetype detection
filetype indent on " Enable filetype-specific indenting
filetype plugin on " Enable filetype-specific plugins
@tuananhlai
tuananhlai / docker-compose.kafka-network-host.yml
Last active July 4, 2021 01:04
A docker-compose file for creating a zookeeper node and 3 kafka brokers, with kafdrop as Web UI
version: "3.9"
services:
zookeeper:
image: confluentinc/cp-zookeeper:latest
network_mode: host
environment:
ZOOKEEPER_SERVER_ID: 1
ZOOKEEPER_SERVERS: localhost:22888:23888
ZOOKEEPER_CLIENT_PORT: 2181
@tuananhlai
tuananhlai / setup_ubuntu.sh
Last active July 5, 2022 03:18
Install script for new Ubuntu/Pop OS system
#!/bin/bash
PORTAINER_CLIENT_PORT=9165
PORTAINER_SERVER_PORT=8165
sudo apt update && sudo apt upgrade -y
# Install common
sudo apt install -y apt-transport-https build-essential xclip git g++ httpie mycli zsh unoconv gnupg tilix openjdk-17-jdk-headless openjdk-17-source;
# This program is meant to use to calculate SBFL ranking metric
# Example usage:
# - Passing values directly through command line arguments:
# python3 fault-localization.py -f 1 --tf 1 -p 4 --tp 5 --fo ochiai
# - Passing filepath and formula:
# python3 fault-localization.py values.txt --fo tarantula
import sys
from math import sqrt
@tuananhlai
tuananhlai / brute_force.py
Created March 24, 2021 05:33
The code I used to solve a portswigger lab about brute-forcing password.
import requests
session = requests.Session()
def login():
url = "https://ac291fbf1e82ce2980c4012800f4005b.web-security-academy.net/login"
payload = {
'username': 'wiener',
'password': 'a'