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
| trigger: | |
| - main | |
| pool: | |
| vmImage: 'windows-latest' | |
| steps: | |
| - task: PowerShell@2 | |
| inputs: | |
| targetType: 'inline' |
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
| Import-Module MicrosoftPowerBIMgmt | |
| $clientId="REDACTED" | |
| $tenantId="REDACTED" | |
| $clientSecret="REDACTED" | |
| $securePassword = ConvertTo-SecureString -String $clientSecret -AsPlainText -Force | |
| $credential = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $clientId, $securePassword | |
| Connect-PowerBIServiceAccount -ServicePrincipal -Credential $credential -TenantId $tenantId |
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
| # just a simple way to process an iterable in chunks | |
| def batch(iterable, n=1): | |
| l = len(iterable) | |
| for i in range(0, l, n): | |
| yield iterable[i:min(i + n, l)] |
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
| import locale, string | |
| n = ['$1,234.56','-$1,234.56','($1,234.56)', '$ -1,234.56'] | |
| tbl = str.maketrans('(', '-', '$),') | |
| [locale.atof( x.translate(tbl)) for x in n] |
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 = (txt as any) => let | |
| removeOne = (input) => | |
| let | |
| text = Text.From(input), | |
| length = Text.Length(text), | |
| position = Text.PositionOf(text, "<"), | |
| positionEnd = Text.PositionOf(text, ">"), | |
| range = positionEnd-position+1, | |
| result = if position >= 0 then Text.ReplaceRange(text, position, range, "") else input |
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
| (sf15Id as any) => let | |
| Source = sf15Id, | |
| #"tab" = #table(1, {{Source}}), | |
| #"cb1" = Table.AddColumn(#"tab", "cb1", each if Text.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Text.Middle([Column1],0,1)) then 1 else 0), | |
| #"cb2" = Table.AddColumn(#"cb1", "cb2", each if Text.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Text.Middle([Column1],1,1)) then 2 else 0), | |
| #"cb3" = Table.AddColumn(#"cb2", "cb3", each if Text.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Text.Middle([Column1],2,1)) then 4 else 0), | |
| #"cb4" = Table.AddColumn(#"cb3", "cb4", each if Text.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Text.Middle([Column1],3,1)) then 8 else 0), | |
| #"cb5" = Table.AddColumn(#"cb4", "cb5", each if Text.Contains("ABCDEFGHIJKLMNOPQRSTUVWXYZ", Text.Middle([Column1],4,1)) then 16 else 0), | |
| #"char16" = Table.AddColumn(cb5, "char16", each Text.Middle("ABCDEFGHIJKLMNOPQRSTUVWXYZ012345", [cb1]+[cb2]+[cb3]+[cb4]+[cb5], 1)), | |
| #"cb6" = Table.AddColumn(#"char16", "cb6", each if Text.Contains("A |
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
| import clr | |
| import pandas as pd | |
| from tqdm import tqdm | |
| clr.AddReference("System.Data") | |
| import System.Data.OleDb as ADONET | |
| def handle_oledb_field(f): | |
| mytype=str(type(f)) | |
| if mytype == "<class 'System.DBNull'>": | |
| return None |
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
| <# | |
| .Synopsis | |
| Exports environment variable from the .env file to the current process. | |
| .Description | |
| This function looks for .env file in the current directoty, if present | |
| it loads the environment variable mentioned in the file to the current process. | |
| based on https://github.com/rajivharris/Set-PsEnv |