Skip to content

Instantly share code, notes, and snippets.

View Andreas-Huber's full-sized avatar

Andreas Huber Andreas-Huber

View GitHub Profile
@Andreas-Huber
Andreas-Huber / README.md
Last active August 2, 2023 10:45 — forked from ascendbruce/README.md
Use macOS-style shortcuts in Windows

Use macOS-style shortcuts in Windows / keyboard mappings using a Mac keyboard on Windows

Make Windows PC's shortcut act like macOS (Mac OS X) (using AutoHotkey (ahk) script)

With this AutoHotKey script, you can use most macOS style shortcuts (eg, cmd+c, cmd+v, ...) on Windows with a standard PC keyboard.

There is a new, alternative project that does similar things and more, check it out at https://github.com/stevenilsen123/mac-keyboard-behavior-in-windows

How does it work

@Andreas-Huber
Andreas-Huber / wsl-set-xwindow-display.sh
Created September 29, 2020 11:22
Set the DISPLAY environment variable in WSL to redirect XWindow to the Windows host.
#!/bin/bash
# Set the DISPLAY environment variable in WSL to redirect XWindow to the Windows host.
# Linux is running in WSL?
if [[ "$(< /proc/sys/kernel/osrelease)" == *microsoft* ]]; then
export WSL_HOST_IP=$(tail -1 /etc/resolv.conf | cut -d' ' -f2)
# Xwindow redirect
export DISPLAY=$WSL_HOST_IP:0
fi
@Andreas-Huber
Andreas-Huber / TestContextTextWriter.cs
Created February 22, 2019 14:24
Text writer that set's itself as the console output to capture console logs within UWP unit tests.
using System;
using System.IO;
using System.Text;
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Uwp.TestTools
{
/// <summary>
/// <see cref="TextWriter"/> that set's itself as the <see cref="Console.Out"/> to capture console logs within UWP Unit Tests.
/// </summary>
#!/bin/sh
#Downloads the Swagger Code Generator CLI and creates a angular client from the sample api
#Requires Java
#https://github.com/swagger-api/swagger-codegen
SWAGGERCLIPATH="/tmp/swagger-codegen-cli.jar"
if [ ! -f "$SWAGGERCLIPATH" ]; then
#Download swagger codegen cli if it does not exist
wget http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.0/swagger-codegen-cli-2.3.0.jar -O "$SWAGGERCLIPATH"
#Downloads the Swagger Code Generator CLI and creates a angular client from the sample api
#Requires Java
#https://github.com/swagger-api/swagger-codegen
$SwaggerCliPath = ".tmp/swagger-codegen-cli.jar";
if (-NOT (Test-Path $SwaggerCliPath)){
#Download swagger codegen cli if it does not exist
New-Item -ItemType Directory -Force -Path .tmp
Invoke-WebRequest http://central.maven.org/maven2/io/swagger/swagger-codegen-cli/2.3.0/swagger-codegen-cli-2.3.0.jar -OutFile $SwaggerCliPath