Skip to content

Instantly share code, notes, and snippets.

View mcxiaoke's full-sized avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
@mcxiaoke
mcxiaoke / ProcessAsyncHelper.cs
Created July 17, 2022 03:04 — forked from Indigo744/ProcessAsyncHelper.cs
The right way to run external process in .NET (async version)
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// Process helper with asynchronous interface
/// - Based on https://gist.github.com/georg-jung/3a8703946075d56423e418ea76212745
/// - And on https://stackoverflow.com/questions/470256/process-waitforexit-asynchronously
/// </summary>
@mcxiaoke
mcxiaoke / ProcessAsyncHelper.cs
Created July 17, 2022 03:03 — forked from NSouth/ProcessAsyncHelper.cs
The right way to run external process in .NET (async version)
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
using System.Threading.Tasks;
/// <summary>
/// Process helper with asynchronous interface
/// - Based on https://gist.github.com/Indigo744/b5f3bd50df4b179651c876416bf70d0a
/// - And on https://stackoverflow.com/questions/470256/process-waitforexit-asynchronously
/// </summary>
@mcxiaoke
mcxiaoke / StreamPipe.cs
Created July 17, 2022 02:58 — forked from antopor/StreamPipe.cs
How to redirect Process' standart input/output (C#, .net 4.5, async code)
using System;
using System.Diagnostics;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace Test
{
class Program
{
@mcxiaoke
mcxiaoke / MainWindow.xaml
Created July 4, 2022 01:39 — forked from danvacam/MainWindow.xaml
Making borderless resizable window in WPF
<Window x:Class="Wpf.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525" WindowStyle="None" AllowsTransparency="True" Background="Transparent" >
<Grid x:Name="LayoutRoot"
Background="White" Margin="4">
<Grid.Effect>
<DropShadowEffect BlurRadius="15" Direction="-90" RenderingBias="Quality" ShadowDepth="2"/>
</Grid.Effect>
@mcxiaoke
mcxiaoke / apply_patches.bash
Created July 1, 2022 09:59
A script intended to make Genshin Impact run perfectly on Linux using Wine + DXVK. You need to have a Wine installation, Winetricks is automatically installed in this script.
#!/bin/bash
VERSION="151"
PATCHES_DIR="$PWD/patches/$VERSION"
GAME_DIR="$PWD/files/drive_c/Program Files/Genshin Impact/Genshin Impact game"
if ! [ -d "$PWD/patches" ]; then
export WINEPREFIX="$PWD/files"
git clone https://notabug.org/Krock/GI-on-Linux.git patches
@mcxiaoke
mcxiaoke / ColorConverting.cs
Created June 18, 2022 04:27 — forked from UweKeim/ColorConverting.cs
HSL color, HSB color and RGB color types, as well as conversion methods between them in C# and .NET
namespace ZetaColorEditor.Colors
{
using System;
using System.Drawing;
/// <summary>
/// Provides color conversion functionality.
/// </summary>
/// <remarks>
/// http://en.wikipedia.org/wiki/HSV_color_space
@mcxiaoke
mcxiaoke / ApplicationInfo.cs
Created June 12, 2022 13:14 — forked from jrgcubano/ApplicationInfo.cs
Provide info about running application C#
/// <summary>
/// This class provides information about the running application.
/// </summary>
public static class ApplicationInfo
{
private static readonly Lazy<string> _productName = new Lazy<string>(GetProductName);
private static readonly Lazy<string> _version = new Lazy<string>(GetVersion);
private static readonly Lazy<string> _company = new Lazy<string>(GetCompany);
private static readonly Lazy<string> _copyright = new Lazy<string>(GetCopyright);
private static readonly Lazy<string> _applicationPath = new Lazy<string>(GetApplicationPath);
@mcxiaoke
mcxiaoke / SingleInstance.cs
Created May 22, 2022 13:41 — forked from meziantou/SingleInstance.cs
SingleInstance
using System;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Channels;
using System.Runtime.Remoting.Channels.Ipc;
using System.Threading;
namespace SingleInstance
{
class Program
{
@mcxiaoke
mcxiaoke / FlyCamera.cs
Created May 10, 2022 02:35 — forked from FreyaHolmer/FlyCamera.cs
A camera controller for easily flying around a scene in Unity smoothly. WASD for lateral movement, Space & Ctrl for vertical movement, Shift to move faster. Add this script to an existing camera, or an empty game object, hit play, and you're ready to go~
using UnityEngine;
[RequireComponent( typeof(Camera) )]
public class FlyCamera : MonoBehaviour {
public float acceleration = 50; // how fast you accelerate
public float accSprintMultiplier = 4; // how much faster you go when "sprinting"
public float lookSensitivity = 1; // mouse look sensitivity
public float dampingCoefficient = 5; // how quickly you break to a halt after you stop your input
public bool focusOnEnable = true; // whether or not to focus and lock cursor immediately on enable
@mcxiaoke
mcxiaoke / mitm_start.sh
Last active May 6, 2022 10:55
GrassCutter autopatchhk.yuanshen.com mitmproxy script
#!/bin/sh
./bin/mitmweb --no-web-open-browser --web-host 0.0.0.0 -s ./custom_proxy.py -k --set tls_version_server_min=SSL3 --set tls_version_client_min=SSL3 --verbose