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
(json) => | |
let | |
//List the expandable columns | |
expandableColumns = (_) => List.Accumulate( | |
Table.ColumnNames(_), | |
{}, | |
(s, c) => | |
s | |
& ( | |
if Type.Is(Value.Type(Record.Field(_{0}, c)), type record) |
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 | |
//Declaring compact function | |
MSMDSRVport = () => let cu=Table.FirstN(Table.Sort(Folder.Contents("C:\Users"),{{"Date accessed",Order.Descending}}),1)[Name]{0} in List.Transform(Table.SelectRows(Folder.Files("C:\Users\"&cu&"\AppData\Local\Microsoft\Power BI Desktop\AnalysisServicesWorkspaces"),each [Name]="msmdsrv.port.txt")[Content],each Lines.FromBinary(_,null,null,1200){0}), | |
GetConnectionString = (port) => let c=AnalysisServices.Databases("localhost:"&port)[Name]{0} in AnalysisServices.Database("localhost:"&port,c,[Query="select * from $system.TMSCHEMA_DATA_SOURCES"])[ConnectionString], | |
ConnectionString2Bin = (cs) => let sp=Splitter.SplitTextByDelimiter(";") in Binary.FromText(Text.Replace(Text.Replace(List.Last(sp(cs)),"Mashup=",""),"mashup=","")), | |
Unz = (bZ,fN) => let UInt32=BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger32,ByteOrder.LittleEndian),UInt16=BinaryFormat.ByteOrder(BinaryFormat.UnsignedInteger16,ByteOrder.LittleEndian),H=BinaryFormat.Record([MH=BinaryFormat.Binary(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
(f as function, allowedValues as list)=> | |
let | |
//create a new parameter type with metadata for allowed values | |
parameterType = Value.Type(allowedValues{1}) meta [Documentation.AllowedValues = allowedValues], | |
//create a function type with custom parameter type | |
myFunType = type function (select as parameterType) as function | |
in //replace the orginal function type with the new myFunType | |
Value.ReplaceType(f,myFunType) |
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
Show hidden characters
// This file was initially generated by Windows Terminal 0.11.1191.0 | |
// It should still be usable in newer versions, but newer versions might have additional | |
// settings, help text, or changes that you will not see unless you clear this file | |
// and let us generate a new one for you. | |
// To view the default settings, hold "alt" while clicking on the "Settings" button. | |
// For documentation on these settings, see: https://aka.ms/terminal-documentation | |
{ | |
"$schema": "https://aka.ms/terminal-profiles-schema", |
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
(xml as table, path as list)=> | |
let | |
isEmptyTable = each Type.Is(Value.Type(_), Table.Type) and List.Count(Table.ToRows(_))=0, | |
xmlRow2record = (rec, row) => Record.AddField(rec,row{0},if isEmptyTable(row{2}) then null else row{2}), | |
xmlTableExpandNode = (xmlTable, node) => List.Accumulate(Table.SelectRows(xmlTable, each [Name] = node)[Value],#table(1,{}),(s,c)=>s&c), | |
head = List.RemoveLastN(path,1), | |
tail = List.Last(path), | |
exceptTail = List.Accumulate(head,xml,xmlTableExpandNode), | |
tailRecords= List.Transform(Table.SelectRows(exceptTail, each [Name]=tail)[Value],each List.Accumulate(Table.ToRows(_),[],xmlRow2record)), | |
out = Table.FromRecords(tailRecords) |
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 func = | |
(SelectionList as list, ListOfPositions as list, optional StartWithOne as number) => | |
let | |
selectionList = List.Buffer(SelectionList), | |
listOfPositions = List.Buffer(ListOfPositions), | |
StartPosition = if StartWithOne = 1 then -1 else 0, | |
Result = List.Transform(ListOfPositions, each SelectionList{_ + StartPosition}?) | |
in |
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
$InFile = 'Filename.txt' | |
$OutFile = 'Filename2.txt' | |
filter replace-chars { $_ -replace '\^',';' } | |
if (test-path $OutFile) | |
{ Clear-Content $OutFile } | |
Get-Content $InFile -ReadCount 1000 | | |
replace-chars | |
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
function Get-PublicIPInfo { | |
<# | |
.Description | |
Returns Public IP info from ip.nf | |
.Parameter IPAddress | |
Supply an IP address that you would like to lookup. | |
.Parameter ComputerName | |
Names of computers to run this command on. | |
.Parameter Credential | |
Credential used by Invoke-Command when performing the lookup on a remote machine. |
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
function New-TempDirectory { | |
$pathToCreate = join-path ([io.path]::GetTempPath()) ([io.path]::GetRandomFileName()) | |
New-Item -ItemType Directory -Path $pathToCreate | |
} |
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
'use strict'; | |
process.env.DEBUG = 'actions-on-google:*'; | |
// Create and Deploy Your First Cloud Functions | |
// https://firebase.google.com/docs/functions/write-firebase-functions | |
const functions = require('firebase-functions'); | |
const Assistant = require('actions-on-google').ApiAiAssistant; | |
const admin = require('firebase-admin'); |
NewerOlder