### Install Chocolatey from Internal Repository Source: https://chocolatey.org/packages/libjpeg-turbo This snippet ensures Chocolatey is installed from a specified internal repository URL. It depends on an environment variable for the download URL and uses the cChocoInstaller resource to perform the installation. The `InstallDir` parameter specifies the installation path. ```powershell Environment chocoDownloadUrl { Name = "chocolateyDownloadUrl" Value = $ChocolateyNupkgUrl } cChocoInstaller installChocolatey { DependsOn = "[Environment]chocoDownloadUrl" InstallDir = Join-Path $env:ProgramData "chocolatey" ChocoInstallScriptUrl = $ChocolateyInstallPs1Url } ``` -------------------------------- ### Install libjpeg-turbo via Chocolatey Command Line Source: https://chocolatey.org/packages/libjpeg-turbo Basic command-line installation of libjpeg-turbo package version 1.2.1.201304081 from the community Chocolatey repository. This method is suitable for individual system installations and requires an internet connection to access the community repository. ```batch choco install libjpeg-turbo ``` -------------------------------- ### Install Node.js using nvm (Bash) Source: https://nodejs.org/en/download This snippet demonstrates how to download and install the Node Version Manager (nvm) on a Linux system using curl and bash. It then proceeds to install a specific Node.js version (v24) and verifies the installed versions of both Node.js and npm. ```bash # Download and install nvm: curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.40.3/install.sh | bash # in lieu of restarting the shell \ . "$HOME/.nvm/nvm.sh" # Download and install Node.js: nvm install 24 # Verify the Node.js version: node -v # Should print "v24.11.1". # Verify npm version: npm -v # Should print "11.6.2". ``` -------------------------------- ### Install Chocolatey from Internal Repository Source: https://chocolatey.org/packages/libjpeg-turbo Ensures Chocolatey is installed using variables defined for the download URL. This Chef recipe snippet installs Chocolatey by specifying the download location, which should be an internal repository. ```ruby node['chocolatey']['install_vars'] = { 'chocolateyDownloadUrl' => "#{ChocolateyNupkgUrl}", } ``` -------------------------------- ### Chocolatey Idempotent Installation - PowerShell Conditional Package Setup Source: https://chocolatey.org/install Implements idempotent installation logic that checks if Chocolatey is already installed before proceeding. Downloads the package only if not present locally, then runs the installation function. Prevents duplicate installations and supports re-running the script safely. ```powershell if (!(Test-Path $ChocoInstallPath)) { if (!(Test-Path $localChocolateyPackageFilePath)) { Download-Package $searchUrl $localChocolateyPackageFilePath } Install-ChocolateyFromPackage $localChocolateyPackageFilePath } ``` -------------------------------- ### Configure Chocolatey Installation Variables in Chef Source: https://chocolatey.org/install This Chef recipe snippet configures installation variables for Chocolatey, specifically setting the 'chocolateyDownloadUrl' to point to an internal repository and enabling upgrades. It then includes the default Chocolatey recipe to perform the installation. This approach is suitable for environments managed by Chef. ```ruby # Note: `chocolateyDownloadUrl is completely different than normal # source locations. This is directly to the bare download url for the # chocolatey.nupkg, similar to what you see when you browse to # https://community.chocolatey.org/api/v2/package/chocolatey node['chocolatey'] ['install_vars'] ['chocolateyDownloadUrl'] = 'http://internal/odata/repo/check_this/chocolatey.VERSION.nupkg' node['chocolatey']['upgrade'] = true include_recipe 'chocolatey::default' ``` -------------------------------- ### Start ZAP UI in Development Mode Source: https://context7_llms Instructions to start the ZAP UI in development mode, which involves running a separate development server for the UI and the ZAP backend. It also specifies how to open the application in a browser. ```bash npm run zap-devserver quasar dev google-chrome http://localhost:8080/?restPort=9070 ``` -------------------------------- ### Installing Node Version Manager (NVM) and Node.js Source: https://stackoverflow.com/questions/60620327/the-n-api-version-of-this-node-instance-is-1-this-module-supports-n-api-version This snippet demonstrates how to install NVM using curl and then provides instructions on how to activate it in the current shell session. After NVM is set up, it shows how to install a specific Node.js version (e.g., v10.16.3) and verify the installation. ```bash curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash ``` ```bash export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion ``` ```bash nvm install v10.16.3 node --version ``` -------------------------------- ### Install Chocolatey using DSC with Internal Script URL Source: https://chocolatey.org/install This Desired State Configuration (DSC) script defines a resource 'cChocoInstaller' to install Chocolatey. It specifies the installation directory and the URL for the Chocolatey installation script located in an internal repository. This ensures Chocolatey is configured to a desired state. ```powershell cChocoInstaller InstallChocolatey { InstallDir = "C:\ProgramData\chocolatey" ChocoInstallScriptUrl = "http://internal/odata/repo/ChocolateyInstall.ps1" } ``` -------------------------------- ### Install Chocolatey using PowerShell with Internal Repository Source: https://chocolatey.org/install This PowerShell script installs Chocolatey by downloading the installer from a specified internal repository URL. It bypasses execution policies for the current process to allow the download and execution. Ensure the internal repository URL is correctly configured before running. ```powershell Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('http://internal/odata/repo/ChocolateyInstall.ps1')) ``` -------------------------------- ### Install Chocolatey from Internal Repository using PowerShell Source: https://chocolatey.org/packages/libjpeg-turbo This script ensures Chocolatey is installed from a specified internal repository URL. It handles downloading the Nupkg, extracting it, and running the installation script. It includes error handling for PowerShell versions without built-in archive support. ```powershell $RequestArguments = @{ UseBasicParsing = $true } $NugetRepositoryUrl = "http://internal/odata/repo" # $NugetRepositoryCredential = New-Object System.Management.Automation.PSCredential("username", ("password" | ConvertTo-SecureString -AsPlainText -Force)) # $RequestArguments.Credential = $NugetRepositoryCredential $ChocolateyDownloadUrl = "$($NugetRepositoryUrl.TrimEnd('/'))/package/chocolatey.2.5.1.nupkg" if (-not (Get-Command choco.exe -ErrorAction SilentlyContinue)) { $TempDirectory = Join-Path $env:Temp "chocolateyInstall" if (-not (Test-Path $TempDirectory -PathType Container)) { $null = New-Item -Path $TempDirectory -ItemType Directory } $DownloadedNupkg = Join-Path $TempDirectory "$(Split-Path $ChocolateyDownloadUrl -Leaf).zip" Invoke-WebRequest -Uri $ChocolateyDownloadUrl -OutFile $DownloadedNupkg @RequestArguments if (Get-Command Microsoft.PowerShell.Archive\Expand-Archive -ErrorAction SilentlyContinue) { Microsoft.PowerShell.Archive\Expand-Archive -Path $DownloadedNupkg -DestinationPath $TempDirectory -Force } else { try { $shellApplication = New-Object -ComObject Shell.Application $zipPackage = $shellApplication.NameSpace($DownloadedNupkg) $destinationFolder = $shellApplication.NameSpace($TempDirectory) $destinationFolder.CopyHere($zipPackage.Items(), 0x10) } catch { Write-Warning "Unable to unzip package using built-in compression." throw $_ } } & $(Join-Path $TempDirectory "tools\chocolateyInstall.ps1") } if (-not (Get-Command choco.exe -ErrorAction SilentlyContinue)) { refreshenv } ``` -------------------------------- ### Install Chocolatey License Package Source: https://chocolatey.org/packages/libjpeg-turbo Installs the chocolatey-license package from a specified NuGet repository URL. This is a prerequisite for managing licensed features. It requires the NugetRepositoryUrl to be set. ```powershell choco install chocolatey-license --source $NugetRepositoryUrl --confirm ``` -------------------------------- ### Install Native Dependencies for Windows Source: https://context7_llms Instructions for installing Chocolatey packages and configuring environment variables on Windows to resolve issues with native Node.js modules like node-canvas and jpeglib. ```bash choco install pkgconfiglite choco install libjpeg-turbo ``` -------------------------------- ### Install Native Dependencies for Mac/Linux Source: https://context7_llms Commands to install necessary native development dependencies on Fedora and Ubuntu for building Node.js binaries. These packages are required for certain Node.js modules that do not have pre-built binaries for all platforms. ```bash dnf install pixman-devel cairo-devel pango-devel libjpeg-devel giflib-devel src-script/install-packages-fedora apt-get update apt-get install --fix-missing libpixman-1-dev libcairo-dev libsdl-pango-dev libjpeg-dev libgif-dev src-script/install-packages-ubuntu ``` -------------------------------- ### Install cChoco DSC Module PowerShell Source: https://chocolatey.org/packages/libjpeg-turbo Installs the cChoco DSC module required for compiling DSC manifests. Configures NuGet package provider and PSGallery repository trust to enable module installation when cChoco is not already available. ```powershell if (-not (Get-Module cChoco -ListAvailable)) { $null = Install-PackageProvider -Name NuGet -MinimumVersion 2.8.5.201 -Force if (($PSGallery = Get-PSRepository -Name PSGallery).InstallationPolicy -ne "Trusted") { Set-PSRepository -Name PSGallery -InstallationPolicy Trusted } Install-Module -Name cChoco if ($PSGallery.InstallationPolicy -ne "Trusted") { Set-PSRepository -Name PSGallery -InstallationPolicy $PSGallery.InstallationPolicy } } ``` -------------------------------- ### Install libjpeg-turbo using Chef Source: https://chocolatey.org/packages/libjpeg-turbo Installs the libjpeg-turbo package to version '1.2.1.201304081' from the specified internal repository source using Chef. Requires the 'chocolatey_package' resource. ```ruby cChocoPackageInstaller 'libjpeg-turbo' do Name "libjpeg-turbo" Version "1.2.1.201304081" Source "http://internal/odata/repo" end ``` -------------------------------- ### Install Chocolatey with PowerShell Source: https://chocolatey.org/install This script downloads and installs the Chocolatey package from an OData feed. It supports authentication and allows configuration of the download source and unzipping method. Environment variables can be set to control debug output, proxy settings, and more. ```powershell # Download and install Chocolatey nupkg from an OData (HTTP/HTTPS) url such as Artifactory, Nexus, ProGet (all of these are recommended for organizational use), or Chocolatey.Server (great for smaller organizations and POCs) # This is where you see the top level API - with xml to Packages - should look nearly the same as https://community.chocolatey.org/api/v2/ # If you are using Nexus, always add the trailing slash or it won't work # === EDIT HERE === $packageRepo = 'http://internal/odata/repo' # If the above $packageRepo repository requires authentication, add the username and password here. Otherwise these leave these as empty strings. $repoUsername = '' # this must be empty is NOT using authentication $repoPassword = '' # this must be empty if NOT using authentication # Determine unzipping method # 7zip is the most compatible, but you need an internally hosted 7za.exe. # Make sure the version matches for the arguments as well. # Built-in does not work with Server Core, but if you have PowerShell 5 # it uses Expand-Archive instead of COM $unzipMethod = 'builtin' #$unzipMethod = '7zip' #$7zipUrl = 'https://chocolatey.org/7za.exe' (download this file, host internally, and update this to internal) # === ENVIRONMENT VARIABLES YOU CAN SET === # Prior to running this script, in a PowerShell session, you can set the # following environment variables and it will affect the output # - $env:ChocolateyEnvironmentDebug = 'true' # see output # - $env:chocolateyIgnoreProxy = 'true' # ignore proxy # - $env:chocolateyProxyLocation = '' # explicit proxy # - $env:chocolateyProxyUser = '' # explicit proxy user name (optional) # - $env:chocolateyProxyPassword = '' # explicit proxy password (optional) # === NO NEED TO EDIT ANYTHING BELOW THIS LINE === # Ensure we can run everything Set-ExecutionPolicy Bypass -Scope Process -Force; # If the repository requires authentication, create the Credential object if ((-not [string]::IsNullOrEmpty($repoUsername)) -and (-not [string]::IsNul ``` -------------------------------- ### Install and Configure Chocolatey Central Management Agent Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey-agent' package and configures Chocolatey Central Management. This includes setting the Central Management Service URL and communication salts if provided. It also enables the relevant Chocolatey features. ```powershell if ($ChocolateyCentralManagementUrl) { choco install chocolatey-agent --source $NugetRepositoryUrl --confirm choco config set --name CentralManagementServiceUrl --value $ChocolateyCentralManagementUrl if ($ChocolateyCentralManagementClientSalt) { choco config set --name centralManagementClientCommunicationSaltAdditivePassword --value $ChocolateyCentralManagementClientSalt } if ($ChocolateyCentralManagementServiceSalt) { choco config set --name centralManagementServiceCommunicationSaltAdditivePassword --value $ChocolateyCentralManagementServiceSalt } choco feature enable --name useChocolateyCentralManagement choco feature enable --name useChocolateyCentralManagementDeployments } ``` -------------------------------- ### Install Chocolatey Licensed Extension Package Source: https://chocolatey.org/packages/libjpeg-turbo Installs the Chocolatey.extension package (Chocolatey Licensed Extension) from a custom repository URL. This unlocks premium features including Package Builder, Package Internalizer, and Central Management. Requires the Chocolatey license to be installed first. ```Puppet DSL package {'chocolatey.extension': ensure => latest, provider => chocolatey, source => $repository_url, require => Package['chocolatey-license'], } ``` -------------------------------- ### Install Chocolatey License Package Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey-license' package, which is necessary for Chocolatey for Business features. This requires the license package to be available in the configured sources and depends on Chocolatey being updated. ```powershell cChocoPackageInstaller chocolateyLicense { DependsOn = "[cChocoPackageInstaller]updateChocolatey" Name = "chocolatey-license" } ``` -------------------------------- ### Install Chocolatey License Package Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey-license' package, which is essential for Chocolatey for Business (C4B) functionalities. This package contains the license information required to enable advanced features. ```ruby chocolatey_package 'chocolatey-license' do action :install source "#{NugetRepositoryUrl}" end ``` -------------------------------- ### Install Native Dependencies for OSX Source: https://context7_llms Commands to install required native development dependencies on macOS using Homebrew. These are needed for compiling Node.js modules that rely on specific system libraries. ```bash brew install pkg-config cairo pango libpng jpeg giflib librsvg src-script/install-packages-osx ``` -------------------------------- ### Install Chocolatey License Package (Ansible) Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey-license' package from the 'ChocolateyInternal' source using the `win_chocolatey` module. This is a prerequisite for enabling Chocolatey for Business features, assuming the license package has been created and placed in the internal repository. The state is set to `latest`. ```yaml - name: Install Chocolatey License win_chocolatey: name: chocolatey-license source: ChocolateyInternal state: latest ``` -------------------------------- ### Configure Background Service Allowed Commands Source: https://chocolatey.org/packages/libjpeg-turbo Sets which Chocolatey commands are allowed to run through the background service. Specifies install, upgrade, and uninstall as the permitted operations for non-administrator users. ```ruby chocolatey_config 'backgroundServiceAllowedCommands' do value 'install,upgrade,uninstall' end ``` -------------------------------- ### Install Chocolatey Licensed Extension (Ansible) Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey.ext' package, also known as the Chocolatey Licensed Extension, from the internal repository using the `win_chocolatey` module. This package provides the necessary components for licensed Chocolatey features, especially after the licensed source has been disabled. ```yaml - name: Install Chocolatey Extension win_chocolatey: name: chocolatey.ext ``` -------------------------------- ### Generate, Build, and Flash Project on MacOS Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Demonstrates a complete workflow on macOS to generate a project, build it using GCC and Make, and flash it to a target board using Simplicity Commander. This involves setting up the SDK path, toolchain, and executing build and flash commands. ```shell $ GSDK=~/SimplicityStudio/SDKs/gecko_sdk $ slc configuration --sdk=$GSDK --gcc-toolchain=/Applications/ARM $ slc generate $GSDK/app/common/example/blink_baremetal -np -d blinky -name=blinky -o makefile --with brd4166a $ cd blinky $ make -f blinky.Makefile $ commander flash build/debug/blinky.hex ``` -------------------------------- ### Include Additional Components in Project Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Shows how to extend a project's functionality by including additional components beyond those specified in the .slcp file. This is done using the --with argument, which accepts a comma-separated list of component IDs and optionally instance names. ```shell --with brd3200c,micriumos--with pwm:led0:led1,brd2200a ``` -------------------------------- ### Install Chocolatey License Package for Business Edition in Puppet Source: https://chocolatey.org/packages/libjpeg-turbo Installs the Chocolatey for Business (C4B) license package from the internal repository. The license package must be created separately using Chocolatey's organizational deployment guide. ```puppet package {'chocolatey-license': ensure => latest, provider => chocolatey, source => $_repository_url, } ``` -------------------------------- ### Apply Configuration Overrides Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Shows how to modify project configurations directly from the command line using the --configuration option. This allows for dynamic adjustments to settings like defines or preprocessor symbols without editing the .slcp file directly. ```shell --configuration=CONFIGURATION_OVERRIDE_MAP ``` -------------------------------- ### Install Chocolatey Licensed Extension Source: https://chocolatey.org/packages/libjpeg-turbo Installs the 'chocolatey.extension' package, also known as Chocolatey Licensed Extension, from the internal repository. This package unlocks various paid features. The installation is conditional on the 'chocolatey-license' package being installed. ```powershell if ("chocolatey-license" -in (choco list --localonly --limitoutput | ConvertFrom-Csv -Header "Name" -Delimiter "|").Name) { choco install chocolatey.extension --source $NugetRepositoryUrl --confirm } else { Write-Warning "Not installing 'chocolatey.extension', as Chocolatey-License has not been installed." } ``` -------------------------------- ### Ensure Chocolatey Installation via Ansible with Internal Source Source: https://chocolatey.org/install This Ansible playbook task ensures that Chocolatey is installed and present on Windows hosts. It specifies the 'chocolatey' package and uses the 'win_chocolatey' module, pointing to an internal repository URL for the installation source. This is useful for managing Chocolatey installation in an automated environment. ```yaml - name: Ensure Chocolatey installed from internal repo win_chocolatey: name: chocolatey state: present source: http://internal/odata/repo/ChocolateyInstall.ps1 ``` -------------------------------- ### Copy Project and SDK Sources Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Details options for managing source file copying during project generation. -cp copies all referenced files, -cpproj copies project sources and links SDK sources, and -cpsdk copies component sources and links project sources. -nocp links all files without copying. ```shell -cp ``` ```shell -cpproj ``` ```shell -cpsdk ``` ```shell -nocp ``` -------------------------------- ### Generate Project with Custom Name and Target Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Generates a new project using a specified .slcp file, assigns a custom name, and configures it for a particular target device or board. This command allows for flexible project creation tailored to specific hardware and naming conventions. ```shell slc generate \path\to\example.slcp -np -d \-name= --with ``` ```shell slc generate C:\Users\\SimplicityStudio\SDKs\gecko_sdk\app\bluetooth\example\soc_empty\soc_empty.slcp -np -d c:\test-soc-empty\ -name=test-soc-empty --with EFR32MG12P232F512GM68 ``` -------------------------------- ### Force New Project Creation Layout Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Uses the -np or --new-project flag to initiate a standard project generation process. This option also ensures that project sources are copied and internal paths within the .slcp file are updated to reflect the new project location. ```shell -np ``` -------------------------------- ### Specify Project File for Operations Source: https://docs.silabs.com/simplicity-studio-5-users-guide/latest/ss-5-users-guide-tools-slc-cli/03-usage Illustrates how to explicitly define the project file to be used for various project operations using the -p or --project-file option. This ensures that the correct .slcp file is targeted for operations like generation or configuration. ```shell generate -p="blink/blink.slcp -d="blink/output/blink_project" ``` -------------------------------- ### Apply DSC Configuration with Configuration Data Source: https://chocolatey.org/packages/libjpeg-turbo Executes the DSC configuration using Start-DscConfiguration with the provided configuration data. The configuration is applied locally with verbose output and forced execution. Uses a try-finally block to restore the original location after pushing to the temp directory. ```PowerShell $ConfigData = @{ AllNodes = @( @{ NodeName = "localhost" PSDscAllowPlainTextPassword = $true } ) } try { Push-Location $env:Temp $Config = ChocolateyConfig -ConfigurationData $ConfigData Start-DscConfiguration -Path $Config.PSParentPath -Wait -Verbose -Force } finally { Pop-Location } ``` -------------------------------- ### Launching ZAP with Zigbee SDK Metadata Source: https://context7_llms This command launches the ZAP tool with specific metadata for Zigbee applications, utilizing the ZCL specifications and generation templates from the provided SDK path. Ensure `zap-path` and `sdk-path` are correctly set. ```bash [zap-path] -z [sdk-path]/gsdk/app/zcl/zcl-zap.json -g [sdk-path]/gsdk/protocol/zigbee/app/framework/gen-template/gen-templates.json ``` -------------------------------- ### Install Chocolatey Central Management Agent Source: https://chocolatey.org/packages/libjpeg-turbo Installs the chocolatey-agent package from an internal NuGet repository when Central Management is configured. Requires ChocolateyCentralManagementUrl to be defined and conditionally installs the agent package. ```ruby chocolatey_package 'chocolatey-agent' do action :install source "#{NugetRepositoryUrl}" only_if { ChocolateyCentralManagementUrl != nil } end ``` -------------------------------- ### Install-ChocolateyFromPackage Function - PowerShell Chocolatey Package Installation Source: https://chocolatey.org/install Installs Chocolatey from a local package file with idempotent checks and support for 7-Zip and built-in compression extraction methods. Validates package existence, extracts contents, runs the install script, and configures environment paths. Handles PowerShell version differences (v3-v5+) and provides detailed error handling for extraction failures. ```powershell function Install-ChocolateyFromPackage { param ( [string]$chocolateyPackageFilePath = '' ) if ($chocolateyPackageFilePath -eq $null -or $chocolateyPackageFilePath -eq '') { throw "You must specify a local package to run the local install." } if (!(Test-Path($chocolateyPackageFilePath))) { throw "No file exists at $chocolateyPackageFilePath" } $chocTempDir = Join-Path $env:TEMP "chocolatey" $tempDir = Join-Path $chocTempDir "chocInstall" if (![System.IO.Directory]::Exists($tempDir)) { [System.IO.Directory]::CreateDirectory($tempDir) } $file = Join-Path $tempDir "chocolatey.zip" Copy-Item $chocolateyPackageFilePath $file -Force Write-Output "Extracting $file to $tempDir..." if ($unzipMethod -eq '7zip') { $7zaExe = Join-Path $tempDir '7za.exe' if (-Not (Test-Path ($7zaExe))) { Write-Output 'Downloading 7-Zip commandline tool prior to extraction.' Download-File $7zipUrl "$7zaExe" } $params = "x -o`"$tempDir`" -bd -y `"$file`"" $process = New-Object System.Diagnostics.Process $process.StartInfo = New-Object System.Diagnostics.ProcessStartInfo($7zaExe, $params) $process.StartInfo.RedirectStandardOutput = $true $process.StartInfo.UseShellExecute = $false $process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden $process.Start() | Out-Null $process.BeginOutputReadLine() $process.WaitForExit() $exitCode = $process.ExitCode $process.Dispose() $errorMessage = "Unable to unzip package using 7zip. Perhaps try setting `$env:chocolateyUseWindowsCompression = 'true' and call install again. Error:" switch ($exitCode) { 0 { break } 1 { throw "$errorMessage Some files could not be extracted" } 2 { throw "$errorMessage 7-Zip encountered a fatal error while extracting the files" } 7 { throw "$errorMessage 7-Zip command line error" } 8 { throw "$errorMessage 7-Zip out of memory" } 255 { throw "$errorMessage Extraction cancelled by the user" } default { throw "$errorMessage 7-Zip signalled an unknown error (code $exitCode)" } } } else { if ($PSVersionTable.PSVersion.Major -lt 5) { try { $shellApplication = new-object -com shell.application $zipPackage = $shellApplication.NameSpace($file) $destinationFolder = $shellApplication.NameSpace($tempDir) $destinationFolder.CopyHere($zipPackage.Items(),0x10) } catch { throw "Unable to unzip package using built-in compression. Set `$env:chocolateyUseWindowsCompression = 'false' and call install again to use 7zip to unzip. Error: `n $_" } } else { Expand-Archive -Path "$file" -DestinationPath "$tempDir" -Force } } Write-Output 'Installing chocolatey on this machine' $toolsFolder = Join-Path $tempDir "tools" $chocInstallPS1 = Join-Path $toolsFolder "chocolateyInstall.ps1" & $chocInstallPS1 Write-Output 'Ensuring chocolatey commands are on the path' $chocInstallVariableName = 'ChocolateyInstall' $chocoPath = [Environment]::GetEnvironmentVariable($chocInstallVariableName) if ($chocoPath -eq $null -or $chocoPath -eq '') { $chocoPath = 'C:\ProgramData\Chocolatey' } $chocoExePath = Join-Path $chocoPath 'bin' if ($($env:Path).ToLower().Contains($($chocoExePath).ToLower()) -eq $false) { $env:Path = [Environment]::GetEnvironmentVariable('Path',[System.EnvironmentVariableTarget]::Machine); } Write-Output 'Ensuring chocolatey.nupkg is in the lib folder' $chocoPkgDir = Join-Path $chocoPath 'lib\chocolatey' $nupkg = Join-Path $chocoPkgDir 'chocolatey.nupkg' if (!(Test-Path $nupkg)) { Write-Output 'Copying chocolatey.nupkg is in the lib folder' if (![System.IO.Directory]::Exists($chocoPkgDir)) { [System.IO.Directory]::CreateDirectory($chocoPkgDir); } Copy-Item "$file" "$nupkg" -Force -ErrorAction SilentlyContinue } } ``` -------------------------------- ### Configure Chocolatey Repository and Credentials Source: https://chocolatey.org/packages/libjpeg-turbo Sets up internal Chocolatey repository URL, username, and password. This allows Chocolatey to fetch packages from a private source. Ensure the URL is accessible and credentials are correct if authentication is required. ```ruby NugetRepositoryUrl = "http://internal/odata/repo" # NugetRepositoryUsername = "username" # NugetRepositoryPassword = "password" ``` -------------------------------- ### Install libjpeg-turbo using Ansible Source: https://chocolatey.org/packages/libjpeg-turbo Installs the libjpeg-turbo package to version '1.2.1.201304081' from the specified internal repository source. Requires the Ansible 'win_chocolatey' module. ```ansible chocolatey_package 'libjpeg-turbo' do action :install source 'http://internal/odata/repo' version '1.2.1.201304081' end ``` -------------------------------- ### Extend Standard Matter Cluster with Manufacturer-Specific Commands (XML) Source: https://context7_llms This XML example illustrates adding manufacturer-specific commands to a standard Matter cluster (e.g., On/Off cluster with code 0x0006). It utilizes the `` tag and defines new client commands with unique 32-bit codes and associated descriptions. ```xml Client command that turns the device on with a transition given by the transition time in the Ember Sample transition time attribute. Client command that toggles the device with a transition given by the transition time in the Ember Sample transition time attribute. ``` -------------------------------- ### Node.js Bcrypt Installation Error (N-API Version Mismatch) Source: https://stackoverflow.com/questions/60620327/the-n-api-version-of-this-node-instance-is-1-this-module-supports-n-api-version This code snippet illustrates the error message received during the installation of the bcrypt library in a Node.js application. The error indicates a mismatch between the N-API version of the Node.js instance and the version supported by the module, preventing successful installation. ```javascript bcrypt@4.0.1 install /home/ubuntu/backend/node_modules/bcrypt node-pre-gyp install --fallback-to-build node-pre-gyp WARN Using request for node-pre-gyp https download node-pre-gyp ERR! install error node-pre-gyp ERR! stack Error: The N-API version of this Node instance is 1. This module supports N-API version(s) 3. This Node instance cannot run this module. node-pre-gyp ERR! stack at Object.module.exports.validate_package_json (/home/ubuntu/backend/node_modules/node-pre-gyp/lib/util/napi.js:82:9) node-pre-gyp ERR! stack at validate_config (/home/ubuntu/backend/node_modules/node-pre-gyp/lib/util/versioning.js:229:10) node-pre-gyp ERR! stack at Object.module.exports.evaluate (/home/ubuntu/backend/node_modules/node-pre-gyp/lib/util/versioning.js:279:5) node-pre-gyp ERR! stack at install (/home/ubuntu/backend/node_modules/node-pre-gyp/li ``` -------------------------------- ### Install libjpeg-turbo using Puppet Source: https://chocolatey.org/packages/libjpeg-turbo Installs the libjpeg-turbo package to version '1.2.1.201304081' from the specified internal repository source using Puppet. Requires the Puppet Chocolatey Provider module. ```puppet package { 'libjpeg-turbo': ensure => '1.2.1.201304081', provider => 'chocolatey', source => 'http://internal/odata/repo', } ```