:s/pattern/string/ Replace pattern with string on line
:%s/pattern/string/ Replace pattern with string throughout document
g Global. Replace all c Confirm i case-insensitive
| @echo off | |
| SET st3Path=C:\Program Files\Sublime Text 3\sublime_text.exe | |
| rem add it for all file types | |
| @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f | |
| @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3" /t REG_EXPAND_SZ /v "Icon" /d "%st3Path%,0" /f | |
| @reg add "HKEY_CLASSES_ROOT\*\shell\Open with Sublime Text 3\command" /t REG_SZ /v "" /d "%st3Path% \"%%1\"" /f | |
| rem add it for folders | |
| @reg add "HKEY_CLASSES_ROOT\Folder\shell\Open with Sublime Text 3" /t REG_SZ /v "" /d "Open with Sublime Text 3" /f |
| <Query Kind="Statements"> | |
| <Reference><RuntimeDirectory>\System.Security.dll</Reference> | |
| <Namespace>System.Security.Cryptography.Xml</Namespace> | |
| </Query> | |
| // need to load System.Security via F4 | |
| XmlDocument myDoc = new XmlDocument(); | |
| myDoc.LoadXml("<root x='x' a='a'><trunk>etc</trunk></root>"); | |
| myDoc.OuterXml.Dump("Attributes in original document order"); | |
| XmlDsigC14NTransform t = new XmlDsigC14NTransform(); |
| <Query Kind="Statements"> | |
| <GACReference>System.Management.Automation, Version=3.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35</GACReference> | |
| <Namespace>System.Management.Automation</Namespace> | |
| </Query> | |
| // create a powershell session | |
| PowerShell ps = PowerShell.Create(); | |
| // add a script to emit a PowerShell hashtable which includes a parameter value | |
| ps.AddScript("param($target); Write-Output @{hello = $target}"); |
| <Query Kind="Program" /> | |
| // define regex to match $-delimited tokens, eg $name$ | |
| static Regex toke = new Regex(@"\$(\w+)\$", RegexOptions.Compiled); | |
| static void Main() | |
| { | |
| string input = @"Dear $name$, as of $date$ your balance is $amount$"; | |
| var args = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); | |
| args.Add("name", "Mr Smith"); |
| # Illustration (based on concepts in http://blogs.technet.com/b/heyscriptingguy/archive/2011/06/16/use-asynchronous-event-handling-in-powershell.aspx | |
| # and code nicked from an answer in http://social.technet.microsoft.com/Forums/en-US/96b339e2-e9da-4802-a66d-be619aeb21ac/execute-function-one-time-in-every-10-mins-in-windows-powershell | |
| # ) | |
| ##### | |
| # | |
| # PASTE LINES BELOW INTO CONSOLE | |
| # | |
| # |
| // echoDump is a minimal "echo" server that responds with a dump of the incoming request. | |
| // (Based on https://github.com/adonovan/gopl.io/blob/master/ch1/server1/main.go) | |
| package main | |
| import ( | |
| "flag" | |
| "fmt" | |
| "log" | |
| "net/http" | |
| "net/http/httputil" |
Using nc (aka netcat) as a commonly available solution (but this syntax only tested for Alpine):
nc -lkp 8088 -e /bin/cat
nb:
| FROM golang | |
| RUN go get github.com/DATA-DOG/godog/cmd/godog | |
| WORKDIR /go/godog | |
| CMD ["godog"] |
| xyz = $(shell expr '/home/fn/go/fred' : '\(.*go/\)') | |
| default: | |
| XGP=$$(expr '/home/fn/go/fred' : '\(.*go/\)'); \ | |
| echo XGP $$XGP; \ | |
| export XWD=$$(expr '/home/fn/go/fred' : '.*/go/\(.*\)'); \ | |
| echo XWD $$XWD; \ | |
| echo xyz $(xyz) |