Skip to content

Instantly share code, notes, and snippets.

View Bomret's full-sized avatar

Stefan Reichel Bomret

View GitHub Profile
@Bomret
Bomret / install-win11-in-utm.md
Last active June 29, 2022 15:36
Installing Windows 11 in UTM

Install

  1. when setup wizard starts, press Shift + F10
  2. in command prompt open regedit
  3. naviagte to HKEY_LOCAL_MACHINE/System/Setup
  4. Create Key "LabConfig" 4.1 Under LabConfig create DWORD (32-bit) "BypassTPMCheck" -> Set to 1 4.2 Under LabConfig create DWORD (32-bit) "BypassSecureBootCheck" -> Set to 1

Setup

When screen "Connect to network" appears

@Bomret
Bomret / popos-on-surface-laptop-3.md
Last active March 15, 2022 19:04
Pop! OS on Surface Laptop 3
  1. Install Pop! OS
  2. Install Surface Linux Kernel
  3. Fix Wifi
  4. Fix built-in keyboard with encrypted disk (default install encrypts the drive)
  • Edit /etc/initramfs-tools/modules
  • Add at bottom:
surface_aggregator
surface_aggregator_registry
surface_hid_core

Keybase proof

I hereby claim:

  • I am bomret on github.
  • I am bomret (https://keybase.io/bomret) on keybase.
  • I have a public key whose fingerprint is D641 CEC5 42E2 93B3 E053 8570 EB6A 68A0 8F9B CAFD

To claim this, I am signing this object:

@Bomret
Bomret / format message with multiple string args
Created July 30, 2014 07:57
Formatting a message with multiple string args.
using System;
namespace param.format
{
class MainClass
{
public static void Main(string[] args)
{
var message = FormatMessage("{0} {0} {1} {2}", "hello", "you", "Guys");
@Bomret
Bomret / gist:0a130778ffbe3a3f0322
Last active March 23, 2022 15:10
Windows batch with UAC prompt
@echo off
REM credits: https://sites.google.com/site/eneerge/scripts/batchgotadmin
REM Stored here in case that site goes down some day
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
REM --> If error flag set, we do not have admin.
@Bomret
Bomret / Boxstarter Desktop PC
Last active January 2, 2016 00:39
Boxstarter script to setup my machine
Update-ExecutionPolicy Unrestricted
Set-WindowsExplorerOptions -EnableShowHiddenFilesFoldersDrives -EnableShowFileExtensions
Enable-MicrosoftUpdate
Install-WindowsUpdate -acceptEula -SuppressReboots
cinst 7zip
cinst mingw
cinst git.install
cinst cmder
@Bomret
Bomret / Simplest C# Future
Last active December 23, 2015 19:38
The simplest Future constructs available in C#. The first one is an Action that takes a Func that produces a value (the work) and an Action that consumes the result (the callback) as parameters. The second is a Func that takes a Func that produces a value as parameter (the work to do) and returns an Action that calls another Action, provided by …
class Program
{
static void Main(string[] args)
{
// first implementation with callback provided directly
Action<Func<int>, Action<int>> future =
(work, callback) => ThreadPool.QueueUserWorkItem(_ => callback(work()));
// example application (will print "Result: 3")
future(() => 1 + 2, result => Console.WriteLine("Result: {0}", result));