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
| reverse32 = (x) => | |
| let | |
| b0 = Number.BitwiseAnd(x,0xff), | |
| b1 = Number.BitwiseShiftRight(Number.BitwiseAnd(x,0xff00),8), | |
| b2 = Number.BitwiseShiftRight(Number.BitwiseAnd(x,0xff0000),16), | |
| b3 = Number.BitwiseShiftRight(Number.BitwiseAnd(x,0xff000000),24) | |
| in | |
| Number.BitwiseOr( | |
| Number.BitwiseOr( | |
| Number.BitwiseShiftLeft(reverse(b0),24), |
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
| calculateCRClookup = (divident)=> | |
| let | |
| // move divident byte into MSB of 32Bit CRC | |
| curByte = Number.BitwiseShiftLeft(divident,24) | |
| in | |
| List.Accumulate({0..7}, | |
| curByte, | |
| (_curByte,_)=> | |
| let | |
| // if MSB set, shift left and XOR with polynomial = 0x4C11DB7 |
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
| List.Swap = (_,_from as number ,_to as number) => | |
| let | |
| from = List.Min({_from,_to}), | |
| to = List.Max({_from,_to}) | |
| in if from=to then _ else | |
| List.Range(_,0,from) | |
| &{_{to}} | |
| &List.Range(_,from+1,to-from-1) | |
| &{_{from}} | |
| &List.Range(_,to+1) |
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
| (url) => | |
| let | |
| BufferedWithMetadata = (binary)=>(try Binary.Buffer() otherwise null) meta Value.Metadata(binary), | |
| response = BufferWithMetadata(Web.Contents(url,[ManualStatusHandling={404}])), | |
| out = if Value.Metadata(response)[Response.Status]=404 | |
| then null | |
| else response | |
| in | |
| out |
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
| (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 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
| (hexString as text) | |
| => Expression.Evaluate(“0x”&hexString) |
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
| <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 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
| 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 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
| let | |
| RScript = R.Execute("set.seed(20)#(lf)irisCluster<-kmeans(iris[,3:4],3,nstart=20)#(lf)iris$cluster<-irisCluster$cluster"), | |
| out = RScript{[Name="iris"]}[Value] | |
| in | |
| out |
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
| 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"), |