Skip to content

Instantly share code, notes, and snippets.

View bechynsky's full-sized avatar
😺

Štěpán Bechynský bechynsky

😺
  • Microsoft
  • Prague, Czech republic
  • X @stepanb
View GitHub Profile
@bechynsky
bechynsky / pause-fabric.ps1
Created December 27, 2024 09:26
Runbook for Azure Automation. I used to stop running Fabric Capacity every day evening as I need Fabric Capacity only to demo Power BI Copilot..
Param
(
# Define a mandatory parameter for the resource group name
[Parameter (Mandatory= $true)]
[String] $resourceGroupName = "",
# Define a mandatory parameter for the Fabric Capacity name
[Parameter (Mandatory= $true)]
[String] $fabricName = ""
)
@bechynsky
bechynsky / 1itopenaidalle.xaml
Created June 13, 2023 08:28
Hands onlab for 1. IT Gymnazium about Azure OpenAI Dall-e XAML
<Window x:Class="OpenAI102dalle.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OpenAI102dalle"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<Style TargetType="Control">
@bechynsky
bechynsky / 1itopenaidalle.cs
Created June 13, 2023 08:27
Hands onlab for 1. IT Gymnazium about Azure OpenAI Dall-e C#
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@bechynsky
bechynsky / 1itopenai.cs
Created June 10, 2023 12:15
Hands onlab for 1. IT Gymnazium about Azure OpenAI
using Azure;
// Add Azure OpenAI package
using Azure.AI.OpenAI;
using System;
using System.Windows;
namespace OpenAI101
{
/// <summary>
/// Interaction logic for MainWindow.xaml
@bechynsky
bechynsky / 1itopenai.xaml
Created June 10, 2023 12:13
Hands onlab for 1. IT Gymnazium about Azure OpenAI
<Window x:Class="OpenAI101.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:OpenAI101"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Window.Resources>
<Style TargetType="Control">
@bechynsky
bechynsky / cv_setup.ps1
Created May 1, 2023 07:04
Environment for students to play with Azure Cognitive Services Custom Vision
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = ""
$PasswordProfile.ForceChangePasswordNextLogin = $false
$location = "westeurope"
# AAD domain
$domain = ""
for ($id = 10; $id -le 35; $id++) {
@bechynsky
bechynsky / web_app_lab_setup.ps1
Created May 1, 2023 07:03
This is script for students environment to play with Azure Web Apps. Every student will get AAD account and rights for one Web App as contributor. You need to share direct link to Web App resource.
# Azure Active Directory domain
$domain = ""
$PasswordProfile = New-Object -TypeName Microsoft.Open.AzureAD.Model.PasswordProfile
$PasswordProfile.Password = ""
$PasswordProfile.ForceChangePasswordNextLogin = $false
$resourceUrlPrefix = "https://portal.azure.com/#" + $domain + "/resource/"
$location = "westeurope"
@bechynsky
bechynsky / ua_flag.py
Created March 3, 2022 15:04
Raspberry Pi Sense HAT Flag of Ukraine
from sense_hat import SenseHat
sense = SenseHat()
# https://en.wikipedia.org/wiki/Flag_of_Ukraine
b = [0, 87, 183] # Strong azure
y = [255, 215, 0] # Yellow
o = [0, 0, 0] # off
ua_flag = [
@bechynsky
bechynsky / rpi_grove_temperature_humidity.py
Last active October 18, 2021 12:49
Reads data from Grove Temperature&Humidity SHT31 sensors ands sends it to webhook (Power Automate)
# Cron
# 0,30 * * * * /usr/bin/python3 /home/pi/rpi_grove_temperature_humidity.py
import time
import requests
# https://wiki.seeedstudio.com/Grove-TempAndHumi_Sensor-SHT31/
# https://github.com/Seeed-Studio/grove.py
# https://seeed-studio.github.io/grove.py/
from grove.i2c import Bus
@bechynsky
bechynsky / grove_node_red_01.json
Created July 17, 2021 11:12
Simple example how to use Raspberry Pi, Grove Base Hat, Grove Temperature sensor SHT31 and Grove 4-digit display
[
{
"id": "f7035dda.42292",
"type": "tab",
"label": "Grove",
"disabled": false,
"info": ""
},
{
"id": "9c65bcd0.754a7",