Skip to content

Instantly share code, notes, and snippets.

@tamld
tamld / manage-secrets.sh
Last active April 9, 2025 06:12
manage secrets
#!/bin/bash
set -e
##############################################################
# manage-secrets.sh - Encrypt & decrypt sensitive files
#
# Usage:
# ./manage-secrets.sh enc [folder] [--keep|-k] Encrypt *.secret → *.secret.enc
# ./manage-secrets.sh dec [folder] [--keep|-k] Decrypt *.secret.enc → *.secret
#
@tamld
tamld / download_apps.ps1
Last active March 17, 2025 04:58
Powershell script to download apps
# Create a folder for downloads
$DownloadFolder = "$env:USERPROFILE\Downloads\LatestApps"
New-Item -ItemType Directory -Path $DownloadFolder -Force | Out-Null
# Create a log file
$LogFile = "$DownloadFolder\download_log.txt"
New-Item -ItemType File -Path $LogFile -Force | Out-Null
Write-Host "Downloading files to: $DownloadFolder"
Write-Host "Log file: $LogFile"
@tamld
tamld / install_exporter.sh
Last active February 17, 2025 00:54
Install Node Exporter
#!/bin/bash
set -e
#######################################
# Check if the script is running as root.
# If not, use sudo for commands.
#######################################
check_root() {
if [ "$(id -u)" -eq 0 ]; then
CMD_PREFIX=""
@tamld
tamld / install_mini_packages.sh
Last active April 29, 2025 03:18
Install Packages App
#!/usr/bin/env bash
set -euo pipefail
### === Detect Privilege === ###
if [[ "$(id -u)" -eq 0 ]]; then
CMD_PREFIX=""
else
CMD_PREFIX="sudo"
fi
APT_CMD="$CMD_PREFIX apt-get"
@tamld
tamld / install_rclone.cmd
Last active January 19, 2025 14:31
Install Rclone
@echo off
setlocal EnableDelayedExpansion
:: Entry point of the script
call :requireAdmin || exit /b 1
call :logTask "Require Admin Privileges"
call :checkInternet || exit /b 1
call :logTask "Check Internet Connection"
call :checkAndSetup7Zip || exit /b 1
call :logTask "Check and Setup 7-Zip"
@tamld
tamld / install-tmux.sh
Last active September 17, 2025 05:07
Install Tmux with oh-my-tmux
#!/usr/bin/env bash
set -euo pipefail
# ------------------------- Options & Help -------------------------
INSTALL_PKGS=1
SUDO_MODE="auto" # auto | never | always (always only for Linux apt)
print_help() {
cat <<USAGE
Usage: $(basename "$0") [options]
@tamld
tamld / getProxies.cmd
Last active November 28, 2024 01:34
Get Proxies from Proxifly
pushd %temp%
rd /q /s proxies >nul 2>&1
mkdir %temp%\proxies && cd /d %temp%\proxies && pushd %temp%\proxies && mkdir proxifly proxy-list >nul 2>&1
:: Proxifly
curl -sL https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/all/data.txt -o proxifly\all.txt
curl -sL https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/http/data.txt -o proxifly\http.txt
curl -sL https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks4/data.txt -o proxifly\socks4.txt
curl -sL https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/protocols/socks5/data.txt -o proxifly\socks5.txt
curl -sL https://raw.githubusercontent.com/proxifly/free-proxy-list/main/proxies/countries/US/data.txt -o proxifly\socks5_US.txt
@tamld
tamld / rclone_sync.cmd
Last active November 4, 2024 10:24
rclone sync drive online
@echo off
setlocal
:: Check if required tools are installed
dir "C:\Program Files\7-Zip\7z.exe" /b >nul || (
curl -fS -o %temp%\7z.msi https://www.7-zip.org/a/7z2408-x64.msi
msiexec /i %temp%\7z.msi /quiet
)
:: Check if rclone is installed
@tamld
tamld / nextcloud-run-behind-cloudflared
Created October 22, 2024 10:21
nextlcoud-docker-cloudflared-setting
sudo docker run \
--init \
--sig-proxy=false \
--name nextcloud-aio-mastercontainer \
--restart always \
--publish 8080:8080 \
--env APACHE_PORT=11000 \
--env APACHE_IP_BINDING=0.0.0.0 \
--volume nextcloud_aio_mastercontainer:/mnt/docker-aio-config \
--volume /var/run/docker.sock:/var/run/docker.sock:ro \
@tamld
tamld / colorText.bat
Created October 6, 2024 04:15
Colorized the text by CMD
@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.