Skip to content

Instantly share code, notes, and snippets.

Avatar
🍇

Sascha Bajonczak SBajonczak

🍇
View GitHub Profile
@SBajonczak
SBajonczak / TicketReport.ps1
Created May 5, 2022
Get a report for TIcket work duration from azure devops
View TicketReport.ps1
# Set the Selection Parameters here!!!!
$yearToSelect=2022
# PAT Generation documented here: https://docs.microsoft.com/en-us/azure/devops/organizations/accounts/use-personal-access-tokens-to-authenticate?view=azure-devops&tabs=Windows#create-a-pat
# Required Permissions: Analytics (READ):; Work Items (READ)
$AzureDevOpsPAT = "PLEASE INSERT PAT"
$OrganizationName = "realcoretfs"
$AzureDevOpsAuthenicationHeader = @{Authorization = 'Basic ' + [Convert]::ToBase64String([Text.Encoding]::ASCII.GetBytes(":$($AzureDevOpsPAT)")) }
$AzureDevOpsAuthenicationHeader
@SBajonczak
SBajonczak / City.cs
Created Jan 5, 2022
City with Geolocation capatibilities
View City.cs
using NetTopologySuite.Geometries;
using System.ComponentModel.DataAnnotations.Schema;
namespace spatial
{
[Table("City")]
public class City
{
public int ID { get; set; }
@SBajonczak
SBajonczak / Query Nearest City.cs
Created Jan 4, 2022
Query Spatial the nearest city
View Query Nearest City.cs
// Create factory
var gf = NetTopologySuite.NtsGeometryServices.Instance.CreateGeometryFactory(4326);
// Set our Current Location
var currentLocation = gf.CreatePoint(new NetTopologySuite.Geometries.Coordinate(-122.171936, 47.643159));
// Find the nearest city in correlation to our location
var nearestCity = ctx.Cities.OrderBy(c => c.Location.Distance(gf.CreateGeometry(currentLocation)));
// Print out
Console.WriteLine(String.Format("Nearest Citiy is : {0}", nearestCity.ToList().FirstOrDefault().CityName));
@SBajonczak
SBajonczak / demodata.cs
Created Jan 4, 2022
Creating Spatial Demo Data
View demodata.cs
// Create first data entry
City seattle = new City();
seattle.CityName = "Seattle";
seattle.Location = new Point(-122.333056, 47.609722) { SRID = 4326 };
ctx.Cities.Add(seattle);
// Create second data entry
City redmond = new City();
redmond.CityName = "Redmond";
redmond.Location = new Point(-122.123889, 47.669444) { SRID = 4326 };
@SBajonczak
SBajonczak / ImportGroupsToAzureAD.ps1
Created Jan 3, 2022
Importing Groups from an array into the Azure AD
View ImportGroupsToAzureAD.ps1
foreach ($group in $groups)
{
$name = $group.Name
$owner = $group.Owner
$foundElement = get-azureadgroup -SearchString $name
if ($foundElement)
{
Write host "$name already exists"
} else
@SBajonczak
SBajonczak / openNuki.js
Created Jan 2, 2022
Nuki Script for Opening the deoor after 5 Seconds
View openNuki.js
on('buttons.default.switch.desktop' _=>{
setTimeout(_=>{
setState('nuki.0.1234567890.actions.openAction',true);
},5000); // Wait 5 seconds
})
@SBajonczak
SBajonczak / checkPermission.cs
Created Dec 28, 2021
Generate Bitmask Check
View checkPermission.cs
public bool HasAccessTo(int profileValue, ApplicationRole roleToCheck){
return (profileValue & roleToCheck) === roleToCheck
}
// Will result true
bool result= HasAccesTo(21,ApplicationRole.Contributor);
// Will result false
bool result= HasAccesTo(21,ApplicationRole.Administrator);
@SBajonczak
SBajonczak / BItmaskEnum.cs
Last active Dec 27, 2021
BistmaskEnumeration Definitions
View BItmaskEnum.cs
public enum ApplicationRole
{
Visitor=1,
Reader=2,
Contributor=4,
Administrator=8,
Owner=16
}
@SBajonczak
SBajonczak / non-clustered-vs.md
Created Dec 27, 2021
Differences between Clustered Index and NonClustered Index
View non-clustered-vs.md
Parameters Clustered Non-clustered
Use for You can sort the records and store clustered index physically in memory as per the order. A non-clustered index helps you to creates a logical order for data rows and uses pointers for physical data files.
Storing method Allows you to stores data pages in the leaf nodes of the index. This indexing method never stores data pages in the leaf nodes of the index.
Size The size of the clustered index is quite large. The size of the non-clustered index is small compared to the clustered index.
Data accessing Faster Slower compared to the clustered index
Additional disk space Not Required Required to store the index separately
Type of key By Default Primary Keys Of The Table is a Clustered Index. It can be used with unique constraint on the table which acts as a composite key.
Main feature A clustered index can improve the performance of data retrieval. It should be created on columns which are used in joins.
@SBajonczak
SBajonczak / MyConfig.json
Last active Dec 22, 2021
OhMyPosh Configuration
View MyConfig.json
{
"$schema": "https://raw.githubusercontent.com/JanDeDobbeleer/oh-my-posh/main/themes/schema.json",
"final_space": true,
"console_title_template": "{{.Folder}}{{if .Root}} :: root{{end}} :: {{.Shell}}",
"tooltips": [
{
"type": "git",
"tips": [
"git",
"gi",