Skip to content

Instantly share code, notes, and snippets.

View davepermen's full-sized avatar

David Spörri davepermen

View GitHub Profile
using System.ComponentModel;
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ProcessTracking;
// From https://stackoverflow.com/a/37034966/1528847
class ProcessTracker(bool closeOnExit = true)
{
ChildProcessTracker? current = closeOnExit ? new() : null;
using Microsoft.AspNetCore.Server.Kestrel.Https;
using System.Diagnostics;
using System.Net;
using System.Security.Cryptography.X509Certificates;
using System.Text;
using Yarp.ReverseProxy.Forwarder;
var demo = new
{
port = 5005,
* {
border-radius: 0 !important;
/* youtube */
--yt-spec-base-background: black;
/* twitch */
--color-background-body: black;
--color-background-base: black;
--color-background-alt: black;
--border-radius-small: 0;
--border-radius-medium: 0;
FOR /F "tokens=*" %G IN ('dir /b *.mkv') DO ffmpeg -i "%G" -c copy -color_range 1 -colorspace 5 -color_primaries 5 -color_trc 6 "%~nG.fixed.mkv" -y
<Project>
<PropertyGroup>
<Domain>files.conesoft.net</Domain>
<Hosting>D:\Hosting\Deployment\Websites</Hosting>
<WebPublishMethod>FileSystem</WebPublishMethod>
<PublishUrl>bin\Release\net8.0\publish\</PublishUrl>
</PropertyGroup>
<Target Name="ZipPublishOutput" AfterTargets="FileSystemPublish">
<ZipDirectory Overwrite="true" SourceDirectory="$(publishUrl)" DestinationFile="$(Hosting)\$(Domain).zip" />
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<ul>
<li>
static public class ByteHelpers
{
static public Stream WriteBytes(this Stream stream, params byte[] bytes)
{
stream.Write(bytes);
return stream;
}
static public Stream Write_8(this Stream stream, params byte[] bytes)
{
@davepermen
davepermen / index.html
Last active October 9, 2023 15:09
modern menu
<!DOCTYPE html>
<meta name="robots" content="noindex">
<html>
<head>
<meta charset="utf-8">
<link rel="manifest" href="/site.webmanifest">
<meta name="viewport" content="width=device-width">
<link href="site.css" rel="stylesheet" />
</head>
<body>
@davepermen
davepermen / generatefilenames.cs
Last active September 30, 2023 11:21
Generate Navigation Filename
using System;
var monthnames = new [] { "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" };
var years = new [] { 2007, 2008, 2009, 2010 };
var months = Enumerable.Range(1, 12);
Directory.CreateDirectory("navigation-segments");
foreach(var year in years)
@using Microsoft.AspNetCore.Components.Forms
<AuthorizeView>
<Authorized>
<form method="post" enctype="multipart/form-data" action="/user/update-profile-picture">
@{
var user = context.User?.Identity?.Name ?? "--noname--";
var profilePicture = $"/user/{user}.jpg?{Random.Shared.Next()}";
}
<label>