This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Replacing variables in file." | |
| InFile="${1:-Test.txt}" | |
| InFileName="${InFile%.*}" | |
| InFileExt=${InFile#"$InFileName"} | |
| OutFile=${2:-"${InFileName}_out${InFileExt}"} | |
| InVar=${3:-VarValues.txt} | |
| if [ ! -f $InFile ] || [ ! -f $InVar ] ; then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # I had 70000+ files all named after the pattern nnn_something.jpg. nnn was a number from 000 to 999. Not all numbers existed. | |
| # Each set of nnn belonged together, and I wanted them placed in sub-folders like this 074/074_something.jpg | |
| # These three bash shell commands cleaned up the mess in a few seconds: | |
| # CREATE FOLDERS. | |
| #This works on bash prior to version 4 - as on Mac. (Newer Bash can just write $ mkdir {000..999} ) | |
| $ for i in 00{0..9} 0{10..99} {100..999}; do mkdir ${i} ; done | |
| # MOVE FILES |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| OneDrive.exe as a Windows Service | |
| ================================= | |
| Flemming Steffensen, 2017, 2021 | |
| For our automatic build setup, we needed to fetch some files off a Sharepoint Library. | |
| Sharepoint allows (if configured so) Lists and Libraries to be synchronized to a local folder by using the OneDrive application. | |
| However, the OneDrive application is started when a user logs in, and in an automated build setup, this never happens. | |
| The solusion were to disable the normal auto-start feature of OneDrive, and then install it as a service, and making sure the | |
| service start as the computer starts. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| :: Fix to allow SourceTrail to analyze MPLAB CX8 source code. | |
| @echo off | |
| setlocal enabledelayedexpansion | |
| ::Usage: | |
| :: Copy Microchip includes from C:\Program Files (x86)\Microchip\xc8\v1.33\include | |
| :: to another folder such as C:\Program Files (x86)\Microchip\xc8\v1.33\include_fixed | |
| :: Copy this file (fix.cmd) into the include_fixed folder, and execute. | |
| :: | |
| :: Depends on Strawbery Perl from https://strawberryperl.com/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| When Notepad++ and others suddenly can't access mapped drives from network resources, this is the fix: | |
| 1. Add a new DWORD to your registry: | |
| HKEY_LOCAL_MACHINE/SOFTWARE/Microsoft/Windows/CurrentVersion/Policies/System/EnableLinkedConnection | |
| 2. Set it to a value of 1. | |
| 3. Reboot & all should be good. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| echo FETCHING files... | |
| set "source=\\myFileServer\FileServer\Files_To_Go_Onto_CD" | |
| set "dest=.\CD_FILES" | |
| robocopy %source% %dest% | |
| if %ERRORLEVEL% EQU 16 echo ***FATAL ERROR*** & goto fail | |
| if %ERRORLEVEL% EQU 15 echo OKCOPY + FAIL + MISMATCHES + XTRA & goto fail | |
| if %ERRORLEVEL% EQU 14 echo FAIL + MISMATCHES + XTRA & goto fail | |
| if %ERRORLEVEL% EQU 13 echo OKCOPY + FAIL + MISMATCHES & goto fail | |
| if %ERRORLEVEL% EQU 12 echo FAIL + MISMATCHES& goto fail | |
| if %ERRORLEVEL% EQU 11 echo OKCOPY + FAIL + XTRA & goto fail |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| :: ICD3 switcher by Flemming Steffensen, Febuary 2021. | |
| :: Switch USB drivers for all Microchip ICD3 In Circuit Debugger connected to the computer. | |
| :: Unlike the "MPLAB Drive Switcher" utility, this script supports all installation points of MPLAB8 and MPLABX, | |
| :: both 32 and 64 bit, and it uses only windows functionality to perform the switch, which is virtually instantaneous. | |
| :: This script is parameterized in run in command prompt and interactive when doubleclicked. | |
| :: Tested on Win10. | |
| :: | |
| :: Note, A known ICD3 bug appear to happen much more frequently when switching between drives. The ICD3 firmware also | |
| :: need to be programmed, and while it can happen automatic, I recommend to not do so. If after installing the firmware, |
Updated 2023-12-11: Hosts calculation updated to support CIDR or 31 and 32.
Prerequisites:
- A1 contains an IP address, such as 10.0.0.2
- B1 contains the number of bits in the netmask (CIDR) such as 24
The below formulas then go into C1, D1 etc. to perform the various calculations. Some calculations depends on other calculations.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @echo off | |
| :: 2019-03-20: Flemming Steffensen added this as a workaround to a Jenkins bug JENKINS-47657 | |
| :: https://issues.jenkins.io/browse/JENKINS-47657?focusedCommentId=363147&page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel#comment-363147 | |
| :: | |
| set "ServiceName=jenkinsslave-C__Jenkins" | |
| for /F "tokens=3 delims=: " %%H in ('sc query "%ServiceName%" ^| findstr " STATE"') DO ( | |
| if /i "%%H" neq "RUNNING" ( | |
| net start "%ServiceName%" | |
| ) | |
| ) |