Skip to content

Instantly share code, notes, and snippets.

View mcxiaoke's full-sized avatar

Hello World mcxiaoke

  • Earth
View GitHub Profile
@mcxiaoke
mcxiaoke / PYTHON_DEFAULT.md
Created November 1, 2022 03:49 — forked from patrickmmartin/PYTHON_DEFAULT.md
update-alternatives for python3 on Ubuntu

Ubuntu 16 default python is almost python 3

Loads of solutions exist, but for changing the system default, alias is not the way to go.

$ update-alternatives --list python update-alternatives: error: no alternatives for python

@mcxiaoke
mcxiaoke / pr.md
Created September 26, 2022 13:46 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@mcxiaoke
mcxiaoke / shell-setup.ps1
Last active September 10, 2022 07:57 — forked from mikepruett3/shell-setup.ps1
Packages to install via scoop, winget, choco, and other tools...
<#
.SYNOPSIS
Script to Initialize my custom powershell setup.
.DESCRIPTION
Script uses scoop
.NOTES
**NOTE** Will configure the Execution Policy for the "CurrentUser" to Unrestricted.
Author: Mike Pruett
Date: October 18th, 2018
@mcxiaoke
mcxiaoke / InstallHdiff.ps1
Created August 21, 2022 03:55 — forked from LiuQixuan/InstallHdiff.ps1
Install game_hdiff.zip for GenshinImpact
#先读我!
#$HdiffFilePath 为 升级包 完整路径
#$GamePath 为 游戏完整路径(非启动器路径)
#$ToolPath 为 hpatchz.exe 完整路径(如果有官方启动器就填写启动器完整路径,如果没有去该地址下载:https://github.com/sisong/HDiffPatch/releases)
param($HdiffFilePath="H:\GameSetup\setup\Genshine Impact\game_2.8.52_2.8.53_hdiff_tODgBJm8uenIGUX5.zip",$GamePath="H:\Games\Genshin Impact\Genshin Impact game")
$ToolPath = 'G:\ProgramFiles\hdiffpatch_v4.1.3'
$github = "https://gist.github.com/LiuQixuan/1a3810046c1152808fc9d65c699f8d8d"
$host.ui.RawUI.WindowTitle = "Install game_hdiff.zip for GenshinImpact"
@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