Skip to content

Instantly share code, notes, and snippets.

@cheeseonamonkey
Last active January 31, 2022 03:44
Show Gist options
  • Save cheeseonamonkey/058673619779cf7ea927c1a12d048a9d to your computer and use it in GitHub Desktop.
Save cheeseonamonkey/058673619779cf7ea927c1a12d048a9d to your computer and use it in GitHub Desktop.
My collection of cmd and shell scripts
@echo off
echo.
echo.
SET /P inp= (Z)ip or (U)nzip:
echo entered:
echo "%inp%"
IF "%inp%"=="e" (GOTO e)
IF "%inp%"=="E" (GOTO e)
IF "%inp%"=="Z" (GOTO e)
IF "%inp%"=="z" (GOTO e)
IF "%inp%"=="d" (GOTO d)
IF "%inp%"=="D" (GOTO d)
IF "%inp%"=="u" (GOTO d)
IF "%inp%"=="U" (GOTO d)
echo Error! Invalid entry :(
:e
echo.
echo.
echo Zipping up dir...
echo ___________________
7z\7zPortable\app\7-zip\7z.exe a -p -mx=0 myzip.7z my
rmdir my /S /Q
echo.
echo Dir zip finished!
goto :end
:d
echo.
echo.
echo Unzipping dir...
echo ___________________
7z\7zPortable\app\7-zip\7z.exe x myzip.7z -aoa
echo.
echo Dir created!
echo Don't forget to clear anything else.
start my
echo.
goto :end
:end
pause
@echo off
REM ==============================================
REM This was for my friend who had a big dead zone on her phone's touch screen.
REM It uses ADB and just simplifies and loops the command to resize the screen: ""
REM ==============================================
echo.
echo SCREEN SQUISHER
echo ______________________
echo.
echo.
echo Hello Toria :)
echo.
echo You done fucked your screen up!
echo.
echo I told you to get a case :p
echo.
echo.
pause
cls
echo.
echo But for now we can just SQUISH your phone screen, so you can still use it.
echo.
echo First, lets make everything purple just for funsies...
echo.
echo.
pause
cls
color 75
echo.
echo Ah, yes - much better! :)
echo.
echo.
pause
echo.
echo.
echo This will tell you everything you need to do.
echo.
echo I'll try to make it clear and understandable for you.
echo Let me know if you need help with my nonsense :)
echo.
echo.
pause
cls
echo.
echo Plug your phone into your laptop.
echo.
echo Make sure that your phone says that "USB Debugging Connected" thing that we saw earlier.
echo (in the notification tray)
echo.
echo If it doesn't, let me know and I will help you.
echo.
echo.
pause
cls
echo.
echo Below this line, it should say "List of devices attached":
echo ____________________________________________________________
.\platform-tools\adb.exe devices
echo.
echo.
echo It should also have another line after that, that says some random letters, and then the word "device".
echo.
echo.
echo.
echo For my phone it looks like this:
echo _________________________________
echo List of devices attached
echo 936AX04VQ8 device
echo.
echo.
echo But for you it might show different random letters.
echo.
echo Make sure you see this - if not it won't work!
echo.
echo If you don't see it, it usually means that either:
echo - your phone isn't connected to your laptop,
echo - or USB Debugging (on your phone) isn't turned on.
echo.
echo.
pause
:startSquish
cls
echo.
echo Getting data from device...
echo.
echo.
pause
echo.
echo.
echo (you can ignore all this stuff, it just helped with writing the script)
echo.
@echo on
.\platform-tools\adb.exe shell wm size > size.txt
set /p size= < size.txt
set width= 0
set height= 0
set size=%size:Physical=%
set size=%size:size:=%
FOR /f "tokens=1,2,3,4 delims=x" %%a IN ("%size%") do set width= %%a&set height= %%b
@echo off
echo.
pause
cls
echo.
echo ENTER SQUISH AMOUNT
echo.
echo _______________________________________
echo Your screen size is: %size%
echo.
echo Your screen width is: %width%
echo Your screen height is: %height%
echo _______________________________________
echo.
echo Okay - So here is where you enter the amount to 'squish' your phone screen.
echo.
echo I don't know which parts of your screen that are broken, so you'll have to guess and kind of figure it out how much to squish it!
echo.
echo You can use this whenever you need to change it.
echo.
echo I would probably start by entering 150 or so, and seeing what it looks like.
echo Then maybe add or subtract like 25 or 50 at a time, until the screen squish is how you want it to be.
echo.
echo To set it back to normal, just enter 0 (0 squish = no squish / regular screen).
echo.
echo.
set /P squishamount= "Enter squish amount: "
echo.
echo.
cls
echo.
echo Squishing your screen by %squishamount% pixels...
echo.
pause
@echo on
echo old width: %width%
echo old height: %height%
set /A newHeight= %height% - %squishamount%
echo new height: %newHeight%
echo Squishing now...
.\platform-tools\adb.exe shell wm size %width%x%newHeight%
@echo off
echo.
echo.
pause
cls
echo.
echo Your phone screen should be squished now.
echo.
echo Do you want to set a new amount?
echo.
set /P inpyn= "Type 'Y' or 'N': "
echo.
echo.
IF "%inpyn%"=="Y" (GOTO startSquish)
IF "%inpyn%"=="y" (GOTO startSquish)
cls
echo.
pause
echo.
echo Thank you for using the screen squisher :)
echo.
echo Have a good day, and don't do anything I wouldn't do!
echo.
pause
exit
REM set size=%size:=%
REM for /f "tokens=* delims= " %%a in ("%size%") do set size=%%a
REM =====================================================
REM copypastes
REM .\platform-tools\adb.exe
REM cls
REM echo.
REM echo
REM echo.
REM echo.
REM pause
REM pause
echo off
cls
echo Set up vault from tarball:
echo ----
echo.
pause
echo.
IF EXIST "vaultCompressedTarGzip.txt" (
ECHO Found file: TarGzip.txt\t\tRenaming extension to targz...
ren vaultCompressedTarGzip.txt vaultCompressed.tar.gz
echo ----
) ELSE (
ECHO (no targzip.txt found! checking for: .tar.gz ...)
)
echo.
echo Extracting from file: (.tar.gz)...
..\..\7z\7zPortable\app\7-zip\7z.exe x vaultCompressed.tar.gz -aoa
echo ----
echo.
echo "Extracting from file: (.tar)...
..\..\7z\7zPortable\app\7-zip\7z.exe x vaultCompressed.tar -aoa
echo ----
echo.
pause
echo.
echo.
echo Finished!
echo ----
echo.
echo Cleaning up old files...
del vaultCompressedTarGzip
del vaultCompressedTarGzip.txt
del vaultCompressed.tar.gz
del vaultCompressed.tar
echo
su
cd /storage/emulated/0/SyncThings
#Remove old tar
rm vaultCompressed.tar
#Remove old gz:
rm vaultCompressed.tar.gz
# new tar
tar cvf vaultCompressed.tar VaultieVault
# new targz (compress)
gzip -9 vaultCompressed.tar
# user notify
read -t 5 -p "Success! Press enter to exit."
exit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment