Running a script remotely via SSH that calls sudo internally fails with:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
Running a script remotely via SSH that calls sudo internally fails with:
sudo: a terminal is required to read the password; either use the -S option to read from standard input or configure an askpass helper
sudo: a password is required
| #!/bin/bash | |
| # SAFE Cleanup files older than specified days | |
| BASE_DIR="/sftp1/data" | |
| DAYS_OLD=180 | |
| DATE=$(date '+%Y-%m-%d %H:%M:%S') | |
| VERBOSE=1 | |
| # SAFETY FEATURE: Set to 1 for actual deletion, 0 for test mode | |
| DELETE_MODE=0 |
| #!/bin/bash | |
| # Clear bash history securely | |
| echo "Clearing bash history from memory..." | |
| history -c | |
| history -w | |
| echo "Flushing data to disk..." | |
| sync |
| #!/bin/bash | |
| # Check if email is provided as an argument | |
| if [ "$#" -ne 1 ]; then | |
| echo "Usage: $0 [email]" | |
| exit 1 | |
| fi | |
| EMAIL=$1 | |
| KEY_NAME="$HOME/.ssh/id_ed25519" |
This script tests the connection to a specified URL and provides detailed timing information, useful for troubleshooting internet connectivity issues. It measures the time taken for various stages of the connection process, including:
Name lookup (DNS resolution) Connecting to the server Initiating data transfer Overall request completion This breakdown helps pinpoint potential bottlenecks in your network or the remote server.
I hereby claim:
To claim this, I am signing this object:
| LOAD DATA LOCAL INFILE 'g:\\temp\\file1.csv' | |
| INTO TABLE mytable | |
| FIELDS TERMINATED BY ';' -- Pemisah kolom dalam file CSV | |
| ENCLOSED BY '"' -- Karakter penutup untuk kolom yang diapit oleh tanda kutip ("") | |
| LINES TERMINATED BY '\r\n' -- Karakter akhir baris dalam file CSV | |
| IGNORE 1 LINES -- Mengabaikan baris header pertama dalam file CSV (jika ada) | |
| -- Kolom target dalam tabel | |
| (COL1, COL2, COL3, COL4, COL5); |
| #!/bin/bash | |
| echo "=== Mengambil waktu dari header HTTP google.com ===" | |
| RAW_DATE=$(curl -sI google.com | grep -i '^date:' | cut -d' ' -f2-) | |
| if [ -z "$RAW_DATE" ]; then | |
| echo "GAGAL: Tidak bisa mengambil header 'date' dari google.com (cek koneksi internet)." | |
| exit 1 | |
| fi |
| def get_country_flag(country_code): | |
| OFFSET = 127397 | |
| codepoints = tuple(ord(char) + OFFSET for char in country_code.upper()) | |
| return chr(codepoints[0]) + chr(codepoints[1]) | |
| # usage get_country_flag("ID") |