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
| # Part of the Vagrant file | |
| # Vagrant plugins triggers and scp are needed | |
| config.trigger.before :destroy,:vm => "<VMNAME>", :force => true, :stdout => false, :stderr => false do | |
| info "Creating backup of files from virtual machines" | |
| run "./backup-before-destroy.sh" | |
| end | |
| # The file backup-before-destroy.sh | |
| #/bin/bash |
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
| #!/usr/bin/env python | |
| import sys | |
| import yaml | |
| def main(argv): | |
| with open(argv[0]) as stream: | |
| try: | |
| #print(yaml.load(stream)) |
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
| --- | |
| tasks: | |
| - name: Check current timezone | |
| shell: timedatectl | grep zone | awk '{ print $3}' | |
| register: current_zone | |
| changed_when: False | |
| notify: | |
| - restart Cron service | |
| - name: Set timezone to {{ timezone }} |
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
| #Create new PSDrives | |
| $ProfileDrive = ((Get-Item env:APPDATA).Value).substring(0, 2) | |
| $DesktopPath = $ProfileDrive + (Get-Item env:HOMEPATH).Value + '\Desktop' | |
| $PSDrive1 = @("Desktop:","$DesktopPath") | |
| $ScriptsPath = $ProfileDrive + (Get-Item env:HOMEPATH).Value + '\Documents\Scripts' | |
| $PSDrive2 = @("Scripts:","$ScriptsPath") | |
| $PSDrivesToCreate = @($PSDrive1,$PSDrive2) |
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
| Function GenerateScriptDocumentationInMarkdown { | |
| <# | |
| .Synopsis | |
| Generates documentation for a folder-full of scripts using the integrated Get-Help CMDlets. | |
| .Description | |
| Generates a .markdown documentat for each PS1 script in a folder which has the necessary headers required by Get-Help. Also generates an index document which lists (and links to) all generated documentats. Each file name is preceeded with "script_ps1_" so that they are listed together when viewing the Wiki documents. | |
| .Parameter SourceScriptFolder | |
| Source folder where the scripts are located |
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
| #Assign default parameters values to some cmdlets - only works with Powershell 3.0 and newer :-/ | |
| if (([Version]$psversiontable.psversion).major -ge 3) { | |
| $DefaultParameterVaulesToAdd = @(@('Export-CSV:Delimiter', ';'), @('Export-CSV:Encoding', 'UTF8'), @('Export-CSV:NoTypeInformation', '$true')) | |
| $DefaultParameterVaulesToAddCount = $DefaultParameterVaulesToAdd.Lenght | |
| for ($i = 0; $i -lt $DefaultParameterVaulesToAddCount; $i++) { | |
| $CurrentParameterValue = $DefaultParameterVaulesToAdd[$i][0] |
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
| # | |
| # File: Get-HelpByMarkdown.ps1 | |
| # | |
| # Author: Akira Sugiura (urasandesu@gmail.com) | |
| # | |
| # | |
| # Copyright (c) 2014 Akira Sugiura | |
| # | |
| # This software is MIT License. | |
| # |
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
| $error[0] | fl * -f | |
| For catch is needed exception field value "System.Management.Automation.CommandNotFoundException" | |
| e.g. | |
| PSMessageDetails : | |
| Exception : System.Management.Automation.CommandNotFoundException: The term 'Get-AcceptedDomain' is not recognized as the name of a cmdle | |
| t, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the pat | |
| h is correct and try again. |
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
| $title = "Delete Files" | |
| $message = "Do you want to delete the remaining files in the folder?" | |
| $yes = New-Object System.Management.Automation.Host.ChoiceDescription "&Yes", ` | |
| "Deletes all the files in the folder." | |
| $no = New-Object System.Management.Automation.Host.ChoiceDescription "&No", ` | |
| "Retains all the files in the folder." | |
| $options = [System.Management.Automation.Host.ChoiceDescription[]]($yes, $no) |
NewerOlder