Earlier tonight I gave an introductory talk about DevOps at British Computer Society (BCS), in a Software Practice Advancement group evening meeting:
For the future generations, the presentation could be find here or here.
Taken from websages blog.
== Rules ==
– There is one system, not a collection of systems.
– The desired state of the system should be a known quantity.
– The “known quantity” must be machine parseable.
– The actual state of the system must self-correct to the desired state.
– The only authoritative source for the actual state of the system is the system.
– The entire system must be deployable using source media and text files.
On Buying Software
– Keep the components in the infrastructure simple so it will be better understood.
– All products must authenticate and authorize from external, configurable sources.
– Use small tools that interoperate well, not one “do everything poorly” product.
– Do not implement any product that no one in your organization has administered.
– “Administered” does not mean saw it in a rigged demo, online or otherwise.
– If you must deploy the product, hire someone who has implemented it before to do so.
– Do not author any code you would not buy.
– Do not implement any product that does not provide an API.
– The provided API must have all functionality that the application provides.
– The provided API must be tailored to more than one language and platform.
– Source code counts as an API, and may be restricted to one language or platform.
– The API must include functional examples and not requre someone to be an expert on the product to use.
– Do not use any product with configurations that are not machine parseable and machine writeable.
– All data stored in the product must be machine readable and writeable by applications other than the product itself.
– Writing hacks around the deficiencies in a product should be less work than writing the product’s functionality.
– Keep the disparity in your architecture to an absolute minimum.
– Use Set Theory to accomplish this.
– Do not improve manual processes if you can automate them instead.
– Do not buy software that requires bare-metal.
– Manual data transfers and datastores maintained manually are to be avoided.
Git Cheat Sheet
- Get code: git pull
- Commit code: git commit -a -m “Comment”
- Push changes: git push
- Detect current branch: git branch
- Detect pending commits: git status
- Add files to commit: git add filename or git add .
Git workflow: https://www.atlassian.com/git/tutorials/comparing-workflows
Example of PowerShell Main base script:
[switch] $Help = $false, # Allows help to be shown
$Password = 'admin', # Password
$Username = 'admin' # Username
Write-Host 'Expected parameters:'
Write-Host ' -Help : Shows this help.'
Write-Host " -Password <password> : Password to use to connect. By default is '$Password'"
Write-Host " -UserName <username> : Username to connect. By default is '$Username'"
$PSVersion = $PSVersionTable.PSVersion
if ( ([int]$PSVersion.Major) -lt $version)
Write-Host "Script needs Powershell $version or higher."
Write-Host -ForegroundColor Red "Error. Detected version: $PSVersion"
# Global variables
$scriptDir = Split-Path ($MyInvocation.MyCommand.Definition) -parent
Import-Module "$($scriptDir)\something.psm1" -Force
Write-Host 'Hello World'
Write-Host -ForegroundColor Magenta $psItem.Exception
Write-Host -ForegroundColor Magenta $psItem.ErrorDetails
Write-Error -Exception $psItem.Exception
This is a function to change encoding of a file:
function ChangeEncoding($file , $encoding = "ascii")
# Encoding could be ascii, utf8, utf7, Unicode, etc.
$tempFile = "$($file).temp"
gc $file | out-file -encoding $encoding $tempFile
Rename-Item $tempFile $file
You can get a Sublime-style scrollbar showing the shape of your code like this:
In tools / options / Text Editor / Scroll Bars set Behavior to “Use map mode for vertical scroll bar”
More info: http://blogs.msdn.com/b/cdnstudents/archive/2014/01/21/visual-studio-tips-and-tricks-enhanced-scroll-bar.aspx