Skip to content

Instantly share code, notes, and snippets.

View robertosljunior's full-sized avatar

Bob Junior robertosljunior

View GitHub Profile
Function Get-LocalPowerBIPorts {
$obj=@()
Foreach($p In (Get-Process -Name "PBIDesktop" -ErrorAction Ignore | `
select Id, ProcessName, mainWindowTitle)) {
$properties = @{ 'PID'=$p.Id;
'ProcessName'=$p.ProcessName
'Title'=$p.mainWindowTitle
'Port'=( get-nettcpconnection -OwningProcess ([int]$p.Id) | Where-Object { ($_.State -eq "Established") -and ($_.RemotePort -ne "443") } | Select-Object remoteport -Unique ).remoteport
}
@robertosljunior
robertosljunior / is-private-mode.js
Created July 11, 2020 01:40 — forked from jherax/is-private-mode.js
Detect if the browser is running in Private mode (Promise based)
/**
* Lightweight script to detect whether the browser is running in Private mode.
* @returns {Promise<boolean>}
*
* Live demo:
* @see https://output.jsbin.com/tazuwif
*
* This snippet uses Promises. If you want to run it in old browsers, polyfill it:
* @see https://cdn.jsdelivr.net/npm/es6-promise@4/dist/es6-promise.auto.min.js
*
@robertosljunior
robertosljunior / git-ssh-auth-win-setup.md
Created July 11, 2020 01:38 — forked from bsara/git-ssh-auth-win-setup.md
Setup SSH Authentication for Git Bash on Windows

Setup SSH Authentication for Git Bash on Windows

Prepararation

  1. Create a folder at the root of your user home folder (Example: C:/Users/uname/) called .ssh.
  2. Create the following files if they do not already exist (paths begin from the root of your user home folder):
  • .ssh/config
@robertosljunior
robertosljunior / ADAL_with_vanilla_JS.md
Created May 15, 2020 14:33 — forked from psignoret/ADAL_with_vanilla_JS.md
Minimal sample app using ADAL.JS and vanilla JavaScript

Using ADAL.JS with vanilla JavaScript

A minimal sample app using ADAL.JS and plain old vanilla JavaScript to obtain an access token from Azure Active Directory and use that access token to make an API request. In this case, the API we're requesting a token for is the Microsoft Graph API, which is used to retrieve the signed-in user's basic profile.

You can see (and test) this live at: https://bl.ocks.org/psignoret/raw/50e88652ae5cb6cc157c09857e3ba87f/

@robertosljunior
robertosljunior / Get-AzureADPSPermissions.ps1
Created May 14, 2020 18:53 — forked from psignoret/Get-AzureADPSPermissions.ps1
Script to list all delegated permissions and application permissions in Azure AD
<#
.SYNOPSIS
Lists delegated permissions (OAuth2PermissionGrants) and application permissions (AppRoleAssignments).
.PARAMETER DelegatedPermissions
If set, will return delegated permissions. If neither this switch nor the ApplicationPermissions switch is set,
both application and delegated permissions will be returned.
.PARAMETER ApplicationPermissions
If set, will return application permissions. If neither this switch nor the DelegatedPermissions switch is set,
<style id="jsbin-css">
.demo-wrapper {
top: 0px;
position: fixed;
min-height: 50px;
width: 100%;
}
.slider {
SELECT CONVERT(DATE, CAST(201909 as VARCHAR(6)) + '01')
@robertosljunior
robertosljunior / format_cpf.dax
Created November 26, 2018 13:20
Formatação de CPF usando DAX
var CPF =
FORMAT (
SELECTEDVALUE ( DM_MGR_CLIENTE[NUM_CPF] );
"000\.##0\.##0\-#0"
)