Skip to content

Instantly share code, notes, and snippets.

@echo off
:: Define color codes
set "RED=0c"
set "YELLOW=0e"
set "GREEN=0a"
set "DEFAULT=07"
:: Call setColor label to print text in different colors
call :setColor "This is a red message" RED
echo.
@tamld
tamld / install_Cursor.sh
Last active September 22, 2024 12:54
install cursor
# Fork from https://gist.githubusercontent.com/msanjeevkumar/edbfebbae976ab7b2cb2e4f22cb6b374/raw/005490f3c968b68645bb649612cb5303fdd4a48e/cursor_setup_and_update.sh
#!/bin/bash
set -euo pipefail
# Directory setup
APP_DIR="${HOME}/Applications"
ICON_DIR="${HOME}/.local/share/icons"
DESKTOP_DIR="${HOME}/.local/share/applications"
BIN_DIR="${HOME}/.local/bin"
@tamld
tamld / move_ZALO_APP.cmd
Created September 16, 2024 02:34
Move Zalo APP
@echo off
:: Ask the user for the new location to save Zalo
SET /P "destination=Enter the new location for Zalo (e.g., D:\NewFolder\Zalo): "
:: Define the old location of the Zalo application
SET "source=%USERPROFILE%\AppData\Local\Zalo"
:: Check if the new directory exists, if not, create it
IF NOT EXIST "%destination%" (
@tamld
tamld / convert_WORD_TO_PDF.ps1
Created September 12, 2024 02:02
convert DOC DOCX to PDF
$path = Read-Host -Prompt "Please enter the file system path to your docx files."
# Create Word application object
$msWord = New-Object -ComObject Word.Application
# Ensure the Word application runs in the background
$msWord.Visible = $false
# Process each docx file in the specified directory
Get-ChildItem -Path "$path" -Filter *.doc? -ErrorAction Stop | ForEach-Object {
@tamld
tamld / driverBackup-Restore.cmd
Last active August 31, 2024 06:40
CMD Batch File: Backup and Restore Driver offline
:: "VERSION=1.4"
:: "CREATED_DATE=2024-08-31"
@echo off
Title Automated Driver Backup and Restore Script
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
if '%errorlevel%' NEQ '0' (
echo Run CMD as Administrator...
goto goUAC
) else (
@tamld
tamld / install-ubuntu-debian-apps.sh
Last active March 31, 2025 05:10
Install Ubuntu-Debian Apps
#!/bin/bash
# Check if the user is root
if [ "$(id -u)" -eq 0 ]; then
IS_ROOT=true
CMD_PREFIX=""
APT_CMD="apt-get"
else
IS_ROOT=false
CMD_PREFIX="sudo"
@tamld
tamld / install_ngrok.md
Last active October 8, 2023 16:14
ngrok

Overview

To public service port over the Internet, we can use ngrok This guide give you steps to do the follow things below:

  • Install ngrok
  • Create a config file named ngrok.yml
  • Allow user auto login
  • Create crontab send telegram URL login every @reboot action

1. Install ngrok

You can login or sign up a new ngrok account

@tamld
tamld / 0-pve.sh
Created September 7, 2023 16:08 — forked from sugoidogo/0-pve.sh
customized install proxmox ve on debian - only tested on buster, bullseye
#!/usr/bin/env bash
# wget -qO 0-pve.sh https://gist.github.com/sugoidogo/4684e4659431e17d15be20171160c1f9/raw/ && bash 0-pve.sh
set -e
export DEBIAN_FRONTEND=noninteractive
export APT_LISTCHANGES_FRONTEND=none
function download { wget $* || curl -fLO $*; }
function stream { wget -qO- $* || curl -fsSL $*; }
function package { apt $* || dnf $*; }
echo "This script will download and run the installation script in a screen session"
echo "The installation script will download post-installation scripts to $HOME and reboot the system upon successful installation"
@tamld
tamld / install-fonts.sh
Last active May 23, 2023 00:00
Install Fonts
#!/bin/bash
if [ ! -d ~/.fonts ]; then
mkdir -p ~/.fonts/nerd-fonts
else
echo ~/.fonts is exist
fi
sudo apt update && sudo apt install -y fontconfig unzip
# Download nerd fonts
#!/bin/bash
@tamld
tamld / copy.cmd
Last active February 9, 2023 02:48
bat file copy all files in the source to des with current date modified filtering
REM Show list the day with Modified Time
REM for /f "tokens=*" %a in ('dir /b /od') do @echo %a %~ta
REM Show list the day with Creation Time
REM for /f "tokens=*" %a in ('dir /b /t:c') do @echo %a %~ta
REM This will copy all files with Modified = current date and copy to the destination place
@echo off
REM set source backup location, source must place in ""
set "source=c:\users\pc"
REM set source backup location, source must place in ""
set "des=d:\1"