Commits

Kevin Berridge committed cf76974

presentation!

  • Participants

Comments (0)

Files changed (9)

demo-scripting.ps1

+function demo
+{
+  "awesome is awesome!?: " + ('awesome' -eq 'awesome!')
+  $a = 1, 2, 3
+  "a is $a"
+  $a[0] -lt $a[-1]
+}
+
+$results = demo
+
+function parensfunc($a, $b, $c) {
+  "a is $a, b is $b, c is $c"
+}
+
+function calls {
+  "first call:  $( parensfunc(1, 2, 3) )"
+  "second call: $( parensfunc 1, 2, 3 )"
+  "third call:  $( parensfunc 1 2 3 )"
+  #parensfunc(1 2 3) #does not parse!
+}

ex1/example-file1.txt

+whatever

ex1/example-file2.txt

+not a match

ex1/example-file3.cs

+whatever

ex1/nested/example-file4.cs

+whatever
+function SpeakText {
+  begin {
+    add-type -assemblyname System.Speech
+    $spk = new-object System.Speech.Synthesis.SpeechSynthesizer
+  }
+  process {
+    $_
+    $spk.Speak($_)
+  }
+}
+
+$wc = new-object System.Net.WebClient
+$xml = [xml]$wc.DownloadString('http://search.twitter.com/search.atom?q=kberridge')
+$xml.feed.entry | %{ $_.title } | SpeakText
+$cmds = @()
+$cmds += 'cd ex1'
+$cmds += 'ls | select-string -pattern whatever'
+$cmds += 'ls -filter *.cs | select-string -pattern whatever'
+$cmds += 'ls -r -filter *.cs | select-string -pattern whatever'
+$cmds += 'gvim $profile'
+$cmds += "get-eventlog -logname application -newest 100 |`n  select-string -inputobject { `$_.Message } -pattern database"
+$cmds += 'cd ..\ex2'
+$cmds += 'hg blame -u .\default.ps1'
+$cmds += 'hg blame -u .\default.ps1 | ?{$_ -match ''^.*kevin''}'
+$cmds += "`$len=(ls -r -filter *.cs |`n  %{hg blame -u `$_.FullName} |`n  ?{`$_ -match '^.*kevin'}).Length;`n  `"Kevin wrote `$len lines of code`""
+$cmds += 'cd ..; gvim get-tweets.ps1'
+$cmds += '.\get-tweets.ps1'
+$cmds += 'gvim demo-scripting.ps1;. .\demo-scripting.ps1'
+$cmds += 'demo'
+$cmds += 'calls'
+$cmds += 'more tools.txt'
+$cmds += 'GOODBYE'
+
+$current = 0
+
+function next {
+  $global:current++;
+  show
+}
+
+function prev {
+  $global:current--;
+  show
+}
+
+function show {
+  $global:cmds[$global:current]
+}
+
+function exe {
+  iex $global:cmds[$global:current]
+}
+
+set-alias n next
+set-alias p prev
+set-alias s show
+set-alias e exe
+psake
+remoting (enter-pssession, invoke-command)
+background-jobs
+sql-ps
+Burning River Developers
+  sponsored by Matrix Pointe Software
+               and Mobile Defense
+
+The Shell Show
+  Kevin Berridge - @kberridge
+  Joe Cannatti - @JoeCannatti
+
+"Slides"
+  https://bitbucket.org/kberridge/powershell-slides