Skip to content

Instantly share code, notes, and snippets.

View luisadha's full-sized avatar
🇵🇸
Free Palestine

Luis Adha luisadha

🇵🇸
Free Palestine
View GitHub Profile
@luisadha
luisadha / hostnamchanger.sh
Last active October 23, 2022 08:24
For modify system hostname.
#!/system/bin/sh
# Author: luisadha
# Script to change system hostname, reboot to restore it.
# **Su binaries needed & busybox too**
local file="$0: $1: No such file or directory"
local usage="usage:\thostnamchanger FILE... "
[ $# -lt 1 ] && echo $usage && return 1
[ ! -f $1 ] && echo $file && return 1
local arg="$*";
@luisadha
luisadha / cu
Created October 23, 2022 08:31
Cu is a function referring to gnu coreutils for easier and more efficient use.
[ -z "$PS1" ] && return # bashcheck is only called via function
cu()
{
local program="$1"
local help="$*";
if [ -z "$program" ]; then echo "cu: Try \`cu --help' "; exit 1
elif [ "$program" == "--help" ]; then coreutils --help;
elif [ "$program" == "--version" ]; then coreutils --version;
else eval cmd=--coreutils-prog=$1; coreutils $cmd $help; fi
}
@luisadha
luisadha / playmusicv1.0.sh
Created October 25, 2022 11:30
SCRIPT: Program Play simple music from your music player via terminal
#!/system/bin/sh
# Author: Luis Adha
# This code is released to the public domain.
# The author gave permission to use this code snippet in your script.
# Script name: playmusic.sh
# Version: v0.1
# Build date: Teu Dec 21 13:59:21 WIB 2021
GRAY='\e[1;30m'
@luisadha
luisadha / ft.sh
Created November 2, 2022 16:21
ft command for force output always true (0).
#!/system/bin/sh
#
# FT stands for (force true) to use Disableprecmd in prompt
# MIT License, Copyleft (c) 2021 Luis Adha.
# This is asset of kalip.sh
# Usage: ft [command]
# or: ft ./file
@luisadha
luisadha / dialog_progressbar.sh
Created November 9, 2022 15:32
rebuild script dialog_progressbar.sh from internet source
#!/bin/bash
# heavily inspired by http://fitnr.com/showing-file-download-progress-using-wget.html
URL=$1
wget --progress=dot "$URL" 2>&1 |\
grep "%" |\
sed -u -e "s,\.,,g" | awk '{print $2}' | sed -u -e "s,\%,,g" | dialog --gauge "Download $(basename $URL) " 10 100
@luisadha
luisadha / inpreference.rc
Last active November 10, 2022 23:50
Used to capture Terminal Emulator settings via initial command, type 'source inpreference.rc'
# Copy pasta ke initial langsung
: ' exit
echo -e "
| Command line: $0
| Terminal type: ${TERM}
| HOME folder: ${HOME}
| Initial command:
0\texit"; history
'
@luisadha
luisadha / ranpper.sh
Created November 14, 2022 00:01
Install wallpaper randomly in the selected directory
#!/system/bin/sh
# date Thu May 9 19:00:28 WIB 2019
# Script untuk secara acak memilih gambar lalu mengaturnya menjadi wallpaper dari file dalam directory
# (28.05.2019)Teu
# Honeycoffe
# Requipment
# - Directory Containing Pictures
# - Busybox installed in your device
@luisadha
luisadha / gist:eeac5834894bab60a1288089188c87ba
Created December 6, 2022 15:40
Memeriksa perangkat apakah mendukung a/b pertisi
getprop ro.build.ab_update
local CHECK_GPU=$(su -c dumpsys SurfaceFlinger | awk '/GLES: / { print $3 $4}' )
CHECK_GPU=${CHECK_GPU-'FAIL'}
local CHECK_CPU=$(if [ "$(getprop|grep ro.product.board)" != "$(cat /proc/cpuinfo|grep Hardware)" ]; then echo $(getprop ro.product.board); else echo $(cat /proc/cpuinfo|grep Hardware); fi)
local CHECK_MEM=$(echo "$(free -m | xargs | awk '{print "" $17 "/" $8 " MB"}') ")
echo ""
echo -e "${G} %=,_ _,=%${D}"
echo -e "${G} ,\*?&&&&&&&&&&?*/, \tTERM: $TERM"
echo -e "${G} &&&&&${R}*${G}&&&&&&&${R}*${G}&&&& ${D}\tSHELL: $SHELL"
echo -e "${G} &&&&&&&&&&&&&&&&&&&&${D} \tCPU: $CHECK_CPU "
echo -e "${G} &&&&&&&&&&&&&&&&&&&&${D} \tGPU: $CHECK_GPU "
@luisadha
luisadha / cleanup_termux-downloads.sh
Last active January 8, 2023 17:21
When this file is touched a popup will appear "Open file with" select Termux. then if it says Save file in ~/download/, then touch Open Directory
echo "Clean up the file termux downloaded?"
echo $(pwd)
read REPLY
rm -rf $(pwd)/*