How do I make this Google Sheets Script faster

function getCellValue(){ var x=2; var y=2; var targetSheet1 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet1'); var targetSheet2 = SpreadsheetApp.getActiveSpreadsheet().getSheetByName('Sheet2'); var tempNumber = targetSheet1.getRange(y,4).getValue(); var compareNumber = targetSheet2.getRange(x,1).getValue();   for (j = 0; j<49; j++)  {   x=2;   var i= 0;   for (i; i<234; i++)   {     if (tempNumber == compareNumber)     {       targetSheet2.getRange(x,58).setValue(.5);       x=x+1;       compareNumber = targetSheet2.getRange(x,1).getValue();     }     else     {       x=x+1;       compareNumber = targetSheet2.getRange(x,1).getValue();     }   }    y=y+1;    tempNumber = targetSheet1.getRange(y,4).getValue(); } } 

Windows Installation Script – Detect SSD

Okay so, I bought a laptop, installed an additional SSD (now running 1 HDD, 1 SSD), and now I’m trying to install the Manufacturer’s customized Windows version. The problem is that that Windows version comes with its own installation script created by the manufacturer. When you try to install that Windows from USB, it opens up a script that then, without ANY input from the user whatsoever, formats your HDD and installs Windows there.

The problem I have is that that script does NOT install Windows to my SSD. I have tried contacting the manufacturer about adjusting the script, but they are too incompetent to even just understand what I’m asking. In the script there are even comments about how it detects what drive to install to, so it can’t be that difficult, right? Since I have no idea about programming myself, the internet is my only hope.

How do I adjust the following script (“Main.cmd”) to make it install Windows to my SSD instead of the HDD?

@echo off @rem  This script is called by x:\Windows\System32\Startnet.cmd - WinPE @echo. @echo. @echo. @echo. @echo Running Intel Optimization powercfg for improved imaging times @echo. @echo call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c call powercfg /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c @echo. @echo. @echo. @rem  ***************************************************************** @rem  List all the disks, then search the volumes of each one to see  @rem  which disks may have "Winpe" in the label. We will ignore that  @rem  disk and use the first disk without the Winpe label that we find.  @rem  ***************************************************************** @echo.>x:\Listdisk.txt @echo list disk>>x:\Listdisk.txt @echo exit>>x:\Listdisk.txt @echo call diskpart /s x:\Listdisk.txt call diskpart /s x:\Listdisk.txt>x:\Disks.txt @echo. @rem Set Disk equal to blank to start set disk= @echo. @rem  @rem  This line will write a diskpart script to select the disk and detail                     it's contents. @rem  We use this output to find a disk that does NOT have Winpe as the volume label. @rem  That disk will have the OS installed to it. This way you can exclude USB from diskpart. @rem   @rem  This works around the issue where the USB key is sometimes enumerated as disk 0 and the  @rem  SSD is disk 1.  @rem   for /f "skip=8 tokens=2" %%A in (x:\Disks.txt) do ( @echo sel disk %%A>x:\Par.txt @echo det disk>>x:\Par.txt @echo exit>>x:\Par.txt if NOT "%%A"=="DiskPart..." call :ListPar %%A ) if %Disk%=="" echo No disk found without a volume label of "Winpe"&& set     disk=0 @echo Using Disk "%Disk%" @echo. @echo ***************************************************************** @rem  Map drive letter for Install.wim and Winre.wim @echo ***************************************************************** @rem Create an output file containing all the drive letters @echo.>x:\listVol.txt @echo list volume>>x:\listVol.txt @echo exit>>x:\listVol.txt @echo call diskpart /s x:\listVol.txt call diskpart /s x:\Listdisk.txt>x:\Output.txt @echo call diskpart /s x:\listVol.txt>x:\Output.txt diskpart /s x:\listVol.txt>x:\Output.txt @echo. @rem Go through each drive letter, looking for the images\Install.txt file for /f "skip=8 tokens=3" %%A in (x:\Output.txt) do ( if exist %%A:\images\install.txt set InstallPath=%%A:\images&& echo "Found device with images folder and install.txt file" ) @echo. @echo. @echo. @echo. @rem ************************ @rem UEFI SECTION @rem ************************ @echo The PC is booted in UEFI mode @echo.>x:\winpart.txt @echo select disk "%Disk%">>x:\winpart.txt @echo clean>>x:\winpart.txt @echo convert gpt>>x:\winpart.txt @echo create partition efi size=100>>x:\winpart.txt @echo format quick fs=fat32 label="System">>x:\winpart.txt @echo assign letter="S">>x:\winpart.txt @echo create partition msr size=16>>x:\winpart.txt @echo create partition primary>>x:\winpart.txt @echo format quick fs=ntfs label="Windows">>x:\winpart.txt @echo assign letter="W">>x:\winpart.txt @echo shrink desired=450>>x:\winpart.txt @echo create partition primary>>x:\winpart.txt @echo format quick fs=ntfs label="Recovery">>x:\winpart.txt @echo assign letter="R">>x:\winpart.txt @echo set id="de94bba4-06d1-4d40-a16a-bfd50179d6ac">>x:\winpart.txt @echo gpt attributes=0x8000000000000001>>x:\winpart.txt @echo exit>>x:\WinPart.txt @echo Winpart.txt now contains..... @echo. type x:\winpart.txt @echo. @echo. @echo ***************************************************************** @echo  Setting up the partition table @echo ***************************************************************** @echo call diskpart /s x:\winpart.txt diskpart /s x:\winpart.txt @echo. @echo. @echo. @echo. @rem Check InstallPath was found and there are images in it. if NOT EXIST %InstallPath%\Install.swm echo "Install.swm Hassen Test NOT     found." && goto :Error @echo Install.swm FOUND at %InstallPath%\install.swm @echo. @echo. @echo. @echo ***************************************************************** @rem  Switches to the USB disk @rem  Create folders on local (eMMC) disk and copy files from USB disk @echo ***************************************************************** @echo. @echo Making directories... md w:\recycler\scratch if %errorlevel% NEQ 0 echo "Failed to make w:\recycler\scratch directory" &&     goto :error @echo. md r:\recovery\windowsre if %errorlevel% NEQ 0 echo "Failed to make m:\recovery\windowsre directory" && goto :error @echo. @echo. @echo ***************************************************************** @echo  Applying the Windows image from the USB @echo ***************************************************************** @echo call dism /apply-image /imagefile:"%InstallPath%\Install.swm"     /swmfile:"%InstallPath%\install*.swm" /index:1 /applydir:w:\ /compact     /scratchdir:"w:\recycler\SCRATCH call dism /apply-image /imagefile:"%InstallPath%\Install.swm"     /swmfile:"%InstallPath%\install*.swm" /index:1 /applydir:w:\ /compact     /scratchdir:"w:\recycler\SCRATCH if %errorlevel% NEQ 0 echo "Failed to apply image to w:" && goto :error call dism.exe /Apply-CustomDataImage     /CustomDataImage:"w:\Recovery\Customizations\usmt.ppkg" /ImagePath:w:\     /SingleInstance if %errorlevel% NEQ 0 echo "Failed to apply image to w:" && goto :error @echo. @echo ***************************************************************** @rem  Move WinRE to Recovery Partition @echo ***************************************************************** @echo. @echo copy %InstallPath%\Recovery\Winre.wim" "r:\recovery\windowsre copy "%InstallPath%\Recovery\Winre.wim" "r:\recovery\windowsre" if %errorlevel% NEQ 0 echo "Failed to copy winre.wim to     r:\recovery\windowsre" && goto :error @echo. @echo reset attributes now attrib r:\Recovery\Windowsre\winre.wim +s +h +a +r @echo. @echo. @echo ***************************************************************** @echo  Setting the boot environment @echo ***************************************************************** @echo call w:\WINDOWS\SYSTEM32\BCDBOOT w:\WINDOWS /s s: /f all w:\WINDOWS\SYSTEM32\BCDBOOT w:\WINDOWS /s s: /f all if %errorlevel% NEQ 0 echo "Failed to set boot information" && goto :error @echo. @echo. @echo. @echo ***************************************************************** @echo  Setting the recovery environment @echo ***************************************************************** @echo %InstallPath%\reagentc\reagentc /SetREImage /Path     "r:\RECOVERY\WINDOWSRE" /target w:\windows %InstallPath%\reagentc\reagentc /SetREImage /Path "r:\RECOVERY\WINDOWSRE"     /target w:\windows if %errorlevel% NEQ 0 echo "Failed to set recovery information" && goto     :error @echo. @echo. @echo. attrib +H +R W:\Recovery rmdir /s /q w:\recycler @echo ***************************************************************** @echo  WIMboot image deployment COMPLETE. Type EXIT from Command @echo  Prompt to restart or turn off device. @echo ***************************************************************** color 2f Goto :END  :ERROR @echo. @echo An error has been detected. color 4f @echo.  goto :END  :ListPar @REM This section is to bring a disk number and use it to List Partitions @echo. set TempDisk=%1 diskpart /s x:\Par.txt>x:\ParOutput.txt for /f "skip=24 tokens=3" %%A in (x:\ParOutput.txt) do ( if /i "%%A"=="no" set Disk=%TempDisk% ) for /f "skip=26 tokens=4" %%A in (x:\ParOutput.txt) do ( if /i NOT "%%A"=="Winpe" set Disk=%TempDisk% ) Goto :EOF  :END @rem  @rem  Get finish time so we can evaluate total WinPE phase time. @rem call |time>x:\StopTime.txt @rem @rem  Now parse both files to display the Start and Finish Time @rem @echo. @echo. for /f "tokens=5" %%A in (x:\starttime.txt) do echo Script Start Time is %%A for /f "tokens=5" %%A in (x:\stoptime.txt) do echo  Script Stop Time is %%A @echo.` 

GPG encryption/decryption commands are not working in a shell script

As part of a shell script , i need to encrypt and decrypt files. From the command line my commands are working and files are getting encrypted/decrypted.

But the same commands are not working from a shell script. Please help out to solve this.

used commands are

echo “PASSPHRASE” | gpg –passphrase-fd 0 –always-trust -r INFRA –encrypt echo “PASSPHRASE” | gpg –passphrase-fd 0 –always-trust -r INFRA

Firewall rules not working in post script of kickstart

I am installing centos with kickstart and during installation in post script it suppose to update device over tftp.

in my script i trigger that device which ultimately copy firmware from my system(where my kickstart is running).

These firewall rules works after first reboot but i want to do it in post section of kickstart.

firewall --enabled --service=tftp --service=ssh   %post --erroronfail --log=/tmp/ks-post.log --interpreter=/usr/bin/bash echo -e $  (firewall-cmd  --list-services) telnet> copy tftp x.x.x.x device-firmware my.rom %end 

But echo command output that firewalld is not running

I am working on an Ubuntu log rotation script and I just want to ensure this is working properly

#!/bin/bash   year=`date +%Y` month=`date +%m` today=`date +%d`  echo $  year echo $  month echo $  today  cp -p cron.log cron.log.orig   if [ ! -d /var/log/cron/$  year/$  month/$  today-cron.log ] then  mkdir -p /var/log/cron/$  year/$  month/$  today-cron.log fi;  cp -p daemon.log daemon.log.orig   if [ -d /var/log/daemon/$  year/$  month/$  today-daemon.log ] then  mkdir -p /var/log/daemon/$  year/$  month/$  today-daemon.log fi;  cat /dev/null > var/log/cron.log cat /dev/null > var/log/daemon.log 

Multi-var definition statement limit in Apps Script?

My personal javascript variable definition style is a single var statement followed by one or more definitions. It’s an unimportant choice, but one that some find benefits in.

Carrying this over to Apps Script, I find it often ends up giving up early—cutting off its interpretation of those comma-separated definitions and so skipping some variables’ creation and assignment.

For an example, the following is valid js syntax according to several checkers, but editBottom will not be defined (nor, indeed, get syntax highlighting to variables’ blue):

function rangeToBounds() {   var activeRange = SpreadsheetApp.getActiveSpreadsheet().getActiveSheet().getRange("R1C2:R3C4");    var editTop = activeRange.getRow(),       editLeft = activeRange.getColumn(),       editRight = activeRange.getColumn()+activeRange.getNumColumns()-1,       editBottom = activeRange.getRow()+activeRange.getNumRows()-1; } 

Whereas swapping in this equivalent set works as expected:

  var editTop = activeRange.getRow();   var editLeft = activeRange.getColumn();   var editRight = activeRange.getColumn()+activeRange.getNumColumns()-1;   var editBottom = activeRange.getRow()+activeRange.getNumRows()-1; 

Even this works:

  var editTop = activeRange.getRow(),       editLeft = activeRange.getColumn(),       editRight = activeRange.getColumn()+activeRange.getNumColumns()-1;   var editBottom = activeRange.getRow()+activeRange.getNumRows()-1; 

So I believe I’m hitting some length or nested-eval limit, not an Apps Script syntax rule.
What’s actually going on?