This file contains 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
<Batch Transaction="false" xmlns="http://schemas.microsoft.com/analysisservices/2003/engine"> | |
<Discover xmlns="urn:schemas-microsoft-com:xml-analysis"> | |
<RequestType>TMSCHEMA_MODEL</RequestType> | |
<Restrictions> | |
<RestrictionList> | |
<DatabaseName>b7b2993d-570b-4c92-9e5d-d5e8f72c935d</DatabaseName> | |
</RestrictionList> | |
</Restrictions> | |
<Properties> | |
<PropertyList/> |
This file contains 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
let | |
header = [#"Accept"="application/vnd.github.cloak-preview"], | |
response = Web.Contents("https://api.github.com/search/commits?q=remove password",[Headers=header]), | |
json = Json.Document(response), | |
select = Table.SelectColumns(Table.FromRecords(json[items]),{"url","commit","repository"}), | |
expand_commit = Table.TransformColumns(Table.ExpandRecordColumn(select, "commit", {"committer", "message"}),{"message",each Text.Clean(_) }), | |
expand_commiter = Table.ExpandRecordColumn(expand_commit, "committer", {"date", "name", "email"}), | |
expand_repo = Table.ExpandRecordColumn(expand_commiter, "repository", {"html_url"}), | |
commits = Table.AddColumn(expand_repo, "commit", each Json.Document(Web.Contents([url]))), | |
files = Table.ExpandListColumn(Table.ExpandRecordColumn(commits, "commit", {"files"}),"files"), |
This file contains 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
let | |
RScript = R.Execute("datacsv<-read.csv(unz(""d:\\Downloads\\R_Twitter_sample.zip"",""R_Twitter_sample.csv""))"), | |
out = RScript{[Name="datacsv"]}[Value] | |
in | |
out |
This file contains 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
let | |
seed = {1..10000000}, | |
seedTable = Table.FromList(seed, Splitter.SplitByNothing(), null, null, ExtraValues.Error), | |
RScript = R.Execute("write.csv(dataset,""d:\\Downloads\\out.csv"")",[dataset=seedTable]), | |
out = RScript | |
in | |
out |
This file contains 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
let | |
RScript = R.Execute("output <- read.table(text=system2(""whoami"", stdout=TRUE))"), | |
output = RScript{[Name="output"]}[Value] | |
in | |
output |
This file contains 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
##Get msmdsrv process details | |
msmdsrv_proc <- system2("tasklist",args = c('/fi','"imagename eq msmdsrv.exe"'), stdout=TRUE) | |
msmdsrv_clean<-msmdsrv_proc[-c(1,3)] | |
msmdsrv<-read.fwf(textConnection(msmdsrv_clean),widths=c(25,9,17,12,13),comment.char="") | |
##Get all TCP ports | |
tcp <- system2("netstat", args = c('-anop','TCP'), stdout=TRUE) | |
ports<-read.fwf(textConnection(tcp),skip=3,widths=c(9,23,23,16,10)) |
This file contains 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
let | |
Source = #table(null,{{1}}), | |
RScript = R.Execute("output<-dataset #(lf)msmdsrv_proc <- system2(""tasklist"",args = c('/nh','/fi','""imagename eq msmdsrv.exe""'), stdout=TRUE) #(lf)msmdsrv_pid <- strsplit(msmdsrv_proc[2],""\\s+"")[[1]][2]#(lf)msmdsrv_regex <- paste(c(""ESTABLISHED\\s*"", msmdsrv_pid),collapse="""")#(lf)tcp <- system2(""netstat"", args = c('-ano'), stdout=TRUE) #(lf)msmdsrv_connections<-grep(msmdsrv_regex,tcp,value=TRUE)#(lf)msmdsrv_inbound<-strsplit(strsplit(msmdsrv_connections[1],""\\s+"")[[1]][3],"":"")[[1]] #(lf)output$port<-tail(msmdsrv_inbound,n=1)",[dataset=Source]), | |
out = RScript{[Name="output"]}[Value] | |
in | |
out |
This file contains 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
let | |
RScript = R.Execute("msmdsrv_proc <- system2(""tasklist"",args = c('/fi','""imagename eq msmdsrv.exe""'), stdout=TRUE) #(lf)msmdsrv_clean<-msmdsrv_proc[-c(1,3)]#(lf)msmdsrv<-read.fwf(textConnection(msmdsrv_clean),widths=c(25,9,17,12,13),comment.char="""")#(lf)tcp <- system2(""netstat"", args = c('-anop','TCP'), stdout=TRUE)#(lf)ports<-read.fwf(textConnection(tcp),skip=3,widths=c(9,23,23,16,10))"), | |
formatTable = (T) => Table.PromoteHeaders(Table.TransformColumns(T,{{"V1",Text.Trim},{"V2",Text.Trim},{"V3",Text.Trim},{"V4",Text.Trim},{"V5",Text.Trim}})), | |
msmdsrv = formatTable(RScript{[Name="msmdsrv"]}[Value]), | |
ports = formatTable(RScript{[Name="ports"]}[Value]), | |
match = Table.SelectRows(ports, each [PID]=Table.ToRecords(msmdsrv){0}[PID]){0}[Local Address], | |
out = List.Last(Text.Split(match,":")) | |
in | |
out |
This file contains 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
(num as number)=> | |
List.Last( | |
List.Generate( | |
() =>[reminder = num, | |
binString= Number.ToText(Number.BitwiseAnd(reminder,1))], | |
each [reminder]> 0, | |
each [reminder = Number.BitwiseShiftRight([reminder],1), | |
binString= Number.ToText(Number.BitwiseAnd(reminder,1))&[binString]], | |
each [binString] | |
) |
This file contains 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
#Finding the portnumber on which the $Embedded$ tabular model is running on | |
$embedded = "$env:LOCALAPPDATA\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces" | |
$ports = Get-ChildItem $embedded -rec | where {$_.Name -eq "msmdsrv.port.txt"} | |
$port = Get-Content $ports.FullName -Encoding Unicode | |
#Getting the data sources from the $Embedded$ tabular model | |
[xml] $db = Invoke-ASCmd -Server:localhost:$port -Query:"SELECT * from `$SYSTEM.TMSCHEMA_DATA_SOURCES" | |
$db.return.root.row | |
$cs = $db.return.root.row.ConnectionString |