Skip to content

Instantly share code, notes, and snippets.

View bogdanbujdea's full-sized avatar
💭
Who reads this?

Bogdan Bujdea bogdanbujdea

💭
Who reads this?
View GitHub Profile
@bogdanbujdea
bogdanbujdea / lovelace.yaml
Created August 11, 2023 21:49
Home Assistant Volvo
- title: Volvo Mobile
path: mobile-car
icon: mdi:car-connected
badges: []
cards:
- type: picture-elements
elements:
- type: state-icon
entity: lock.volvo_xc60_yv1uzh5v4p1357593_lock_status
style:
@bogdanbujdea
bogdanbujdea / azure-pipelines.ndepend.yaml
Created September 19, 2022 14:42
NDepend task for running static code analysis
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- main
pool:
vmImage: 'windows-latest'
@bogdanbujdea
bogdanbujdea / RescueTime.json
Last active September 13, 2022 21:01
Retrieve RescueTime productivity score
[{"id":"2d66941a7a549e66","type":"inject","z":"f2ad30b932f27004","name":"Every 1 minutes","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"300","crontab":"","once":true,"onceDelay":"5","topic":"","payload":"","payloadType":"date","x":110,"y":200,"wires":[["31e295f42e3e8f58"]]},{"id":"31e295f42e3e8f58","type":"credentials","z":"f2ad30b932f27004","name":"Set cookie","props":[{"value":"rescueTimeCookie","type":"msg"}],"x":330,"y":200,"wires":[["28ea02f9b5ab7705"]]},{"id":"28ea02f9b5ab7705","type":"function","z":"f2ad30b932f27004","name":"Prepare RescueTime Request","func":"msg.url = \"https://www.rescuetime.com/widget_window/productivity\";\nmsg.headers = {};\nmsg.method = \"GET\";\nmsg.headers[\"Cookie\"] = msg.rescueTimeCookie;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":610,"y":200,"wires":[["93e5e34a7e137d05"]]},{"id":"93e5e34a7e137d05","type":"http request","z":"f2ad30b932f27004","name":"Request","method":"use","ret":"txt","paytoqs":"body","url":"","tls":"",
@bogdanbujdea
bogdanbujdea / azure-pipelines.yaml
Created August 30, 2022 20:09
Multi-stage YAML pipeline with build, test and deploy stages
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
@bogdanbujdea
bogdanbujdea / azure-pipelines.yaml
Last active August 21, 2022 21:56
Multi-stage YAML pipeline
# ASP.NET
# Build and test ASP.NET projects.
# Add steps that publish symbols, save build artifacts, deploy, and more:
# https://docs.microsoft.com/azure/devops/pipelines/apps/aspnet/build-aspnet-4
trigger:
- main
pool:
vmImage: 'ubuntu-latest'
@bogdanbujdea
bogdanbujdea / manifest.json
Last active October 15, 2021 22:46
testdeploy.ps1
[
{
"resourceAppId": "00000003-0000-0ff1-ce00-000000000000",
"resourceAccess": [
{
"id": "df021288-bdef-4463-88db-98f22de89214",
"type": "Role"
},
{
"id": "d13f72ca-a275-4b96-b789-48ebcc4da984",
@bogdanbujdea
bogdanbujdea / Program.cs
Last active September 27, 2021 20:23
C# Console application that writes a text onto an image
using System.Drawing; //install the System.Drawing.Common Nuget package
using System.IO;
namespace TestApp
{
class Program
{
static void Main(string[] args)
{
var originalImagePath = "d:\\banner.png";
@bogdanbujdea
bogdanbujdea / Program.cs
Last active September 26, 2021 20:24
Retrieve page views from Universal Analytics property
using System;
using System.Security.Cryptography.X509Certificates;
using System.Threading.Tasks;
using Google.Apis.Analytics.v3;
using Google.Apis.Auth.OAuth2;
using Google.Apis.Services;
namespace GoogleUATest
{
class Program
@bogdanbujdea
bogdanbujdea / CorsStartup.cs
Last active September 14, 2021 20:14
Enable CORS in ASP.NET Core Web Api
public class Startup
{
readonly string MyAllowSpecificOrigins = "randomPolicyNameUsedForTestingPurposes"; //the name doesn't matter
public void ConfigureServices(IServiceCollection services)
{
services.AddCors(options =>
{
options.AddPolicy(name: MyAllowSpecificOrigins,
@bogdanbujdea
bogdanbujdea / Program.cs
Created March 19, 2021 21:53
Retrieve fields from ID with Form Recognizer
static async Task Main(string[] args)
{
var resultUrl = await StartAnalyzingImage(); // defined here https://gist.github.com/thewindev/a3a06af46693b890e968fbf810d2b50d
IdentificationResult result;
do
{
await Task.Delay(1000); // wait 1 second before checking, otherwise the API will return 429
var json = await _client.GetStringAsync(resultUrl);
result = JsonConvert.DeserializeObject<IdentificationResult>(json);