Skip to content

Instantly share code, notes, and snippets.

View skalahonza's full-sized avatar

Jan Skála skalahonza

View GitHub Profile
@skalahonza
skalahonza / avi-mp4-convert.sh
Created October 16, 2021 14:47
Convert all avi files to mp4 using HW accelerated FFMPEG
for i in *.avi; do ffmpeg -hwaccel cuda -i "$i" "${i%.*}.mp4"; done

Odkazy na statnicove otazky na Dropboxu

Zdravím!

Níže najdete odkazy na jednotlivé státnicové otázky programu OI 2016. Odkazy vedou na Dropbox kde můžete doplňovat, komentovat atd.

Jak tisknout

V Dropbox Paper nahoře vpravo > ... > print. V nastavení tisku dejte další možnosti a dejte velikost na 80%, defaultní velikost je strašně velká. Taky doporučuji vypnout všehny informace v zápatí a záhlaví. Defaultně je tam URL, čas apod.

http:
routers:
api-router:
rule: "PathPrefix(`/api`)"
service: "backend-service"
entryPoints:
- "web"
front-router:
rule: "PathPrefix(`/`)"
@skalahonza
skalahonza / OdataDateTimeQuery.cs
Created June 16, 2020 12:56
Construct OData date time query that compares date time part by part. Suitable for Logic Apps SQL server with Data Gateway
private static string GreaterOrEqual(string first, string second, string part) =>
$"{part}({first}) ge {part}({second})";
private static string GreaterThan(string first, string second, string part) =>
$"{part}({first}) gt {part}({second})";
private static string Equal(string first, string second, string part) =>
$"{part}({first}) eq {part}({second})";
/// <summary>
@skalahonza
skalahonza / overlapping_entries.py
Created September 2, 2023 07:24
Get all overlaping clockify time entries
import requests
from datetime import datetime
import pytz
# Replace with your Clockify API key, workspace ID and user ID
API_KEY = ''
WORKSPACE_ID = ''
USER_ID = ''
# Set the time zone
@skalahonza
skalahonza / Summary.cs
Created August 17, 2023 09:04
Reusing XML Documentation in C#
var dto = new DTO();
var tmp = dto.Description; // see the same summary as in Entity.Description
public class Entity
{
/// <summary>
/// The description of the entity.
/// </summary>
public string Description { get; set; }
@skalahonza
skalahonza / version.yml
Created February 17, 2023 06:19
This script is designed to be used in GitHub Actions workflows to set version-related environment variables based on the event that triggered the workflow. If the workflow was triggered by a tag event, the script sets the RELEASE_VERSION environment variable to the commit SHA and tag name separated by a semicolon. Otherwise, the RELEASE_VERSION …
- name: Set Release Version
run: |
if [ "${GITHUB_REF_TYPE}" = "tag" ]; then
echo "RELEASE_VERSION=${GITHUB_SHA};${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
else
echo "RELEASE_VERSION=${GITHUB_SHA}" >> $GITHUB_ENV
fi
@skalahonza
skalahonza / TypeSafeEnum.cs
Created August 23, 2022 10:10
Type safe enum that uses normal enum values for the underlying storage. Enhancment of Ardalis.SmartEnum.SmartEnum.
using Ardalis.SmartEnum;
/// <summary>
/// Type safe enum that uses normal enum values for the underlying storage.
/// Enhancment of Ardalis.SmartEnum.SmartEnum
/// </summary>
/// <typeparam name="TEnum">The type that is inheriting from this class.</typeparam>
/// <typeparam name="TDiscriminator">Enum used as discriminator</typeparam>
public abstract class TypeSafeEnum<TEnum, TDiscriminator> : SmartEnum<TEnum>
where TEnum : SmartEnum<TEnum, int>
@skalahonza
skalahonza / SamplesController.cs
Created March 22, 2022 13:53
Dynamic CRUD controller.
using Microsoft.AspNetCore.Mvc;
namespace Petricords.API.Controllers;
public class SamplesController : ApiController
{
private readonly IServiceProvider _services;
public SamplesController(IServiceProvider services)
{
@skalahonza
skalahonza / Dotnet libraries.md
Last active February 5, 2022 08:58
Set of usefull .NET libraries for various use cases.

.NET libraries

Set of usefull .NET libraries for various use cases.

Common

  • Swashbuckle - swagger
  • System.Linq.Async - IAsyncEnumerable LINQ support
  • Pathoschild.Http.FluentClient - fluent HTTP client
  • Blazorise - UI toolkit for Blazor
  • Microsoft.Extensions.Options - loading configration via dependency injection