This file contains 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, |
This file contains 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 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 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 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 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 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 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
$ sudo spctl --master-enable | |
$ sudo spctl --master-disable |
This file contains 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 | |
# fsteff 2019 | |
# Workaround for bash not properly supporting export of environment array variables. | |
# When using Jenkins 'Inject environment variables' plugin, array variables ends up in a strange state, | |
# where they are listed as exported variables, but are not actual shell variables. | |
# Checking using `env` or `printenv` shows injected array variables unrolled (ie not as arrays) | |
# Checking using `declare -p`, `declare -xp` and `set` does not show injected array variables - but normal array variable are shown as arrays. | |
# The workaround below loops through the output of `printenv` and sets each injected variable it finds. | |
# NOTE: This must be run in the 'Execute Shell' where the variables are needed. | |
# NOTE2: Using as a script file, requires that it's executed as `. ./FixInjectedArraysInBash.sh` or `source ./FixInjectedArraysInBash.sh` |
This file contains 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
:: === Main code: | |
:: My answer to https://stackoverflow.com/questions/17546016/how-can-you-zip-or-unzip-from-the-script-using-only-windows-built-in-capabiliti/58013665#58013665 | |
call :ZipUp "C:\Some\Path" "C:\Archive.zip" | |
:: === SubRoutines: | |
:ZipUp | |
::Arguments: Source_folder, destination_zip |