Skip to content

Instantly share code, notes, and snippets.

View yuhangch's full-sized avatar
🚶
exhausted

陈昱行|Chen Yu-hang yuhangch

🚶
exhausted
View GitHub Profile
@yuhangch
yuhangch / deldot.sh
Created June 13, 2020 10:57
Mac Uninstall .Net Core
#!/usr/bin/env bash
#
# Copyright (c) .NET Foundation and contributors. All rights reserved.
# Licensed under the MIT license. See LICENSE file in the project root for full license information.
#
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
current_userid=$(id -u)
if [ $current_userid -ne 0 ]; then
@yuhangch
yuhangch / disable-auto-base.sh
Created July 30, 2020 12:48
Conda disable auto activate base
conda config --set auto_activate_base false
@yuhangch
yuhangch / bash.md
Last active August 10, 2020 06:41
Notes Collection
title Shell Notes
date 2019-10-16 16:41:23 +0800
draft true

source 的替代方法

. ~/.zshrc
@yuhangch
yuhangch / do.md
Created August 13, 2020 08:06
rio-color windows

LIB

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\VC\lib; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\lib;

PATH

C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\include\ucrt; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\VC\bin; C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\SDK\ScopeCppSDK\SDK\bin;

@yuhangch
yuhangch / minio-boto3-rasterio-memoryfile.py
Created August 14, 2020 02:55
Boto3 use in Minio with Rasterio memoryFIle
import boto3
from botocore.client import Config
from rasterio.io import MemoryFile
session = boto3.session.Session()
client = session.client(
service_name="s3",
endpoint_url="http://localhost:9000",
aws_access_key_id='KEY',
aws_secret_access_key="SECRET"
@yuhangch
yuhangch / x.py
Last active December 3, 2020 10:49
Python Zipfile 中文文件名乱码
from zipfile import ZipFile
from pathlib import Path
target_directory = "."
with ZipFile(src, 'r') as f:
for file_name in f.namelist():
file_name = f.extract(file_name, path=target_directory)
try:
@yuhangch
yuhangch / tiny-png.py
Last active December 24, 2020 07:41
Tiny PNG & tinify demo
import os
import tinify
tinify.key = "your key"
root = "./images"
dst_path = "./images-compress"
for origin, _, files in os.walk(root, topdown=False):
for name in files:
@yuhangch
yuhangch / blog
Created December 24, 2020 10:47
hugox V2
#! /bin/bash
blog_path=~/path/to/blog
cd $blog_path
hugo new --editor typora posts/$1.md
@yuhangch
yuhangch / capslock-ime
Last active October 9, 2021 02:12
Auto switch IME for different app && CapsLock > IME switch
SetStoreCapsLockMode False
CapsLock::
{
KeyWait "CapsLock"
time := A_TimeSinceThisHotkey
if (time > 300) {
SetTimer SendCaps, -4
}
else {
@yuhangch
yuhangch / stop-process.cs
Created September 15, 2021 01:01
Sending Ctrl-C signal to another application on Windows
// https://blog.codetitans.pl/post/sending-ctrl-c-signal-to-another-application-on-windows/
[DllImport("kernel32.dll", SetLastError = true)]
static extern bool AttachConsole(uint dwProcessId);
[DllImport("kernel32.dll", SetLastError = true, ExactSpelling = true)]
static extern bool FreeConsole();
[DllImport("kernel32.dll")]
static extern bool SetConsoleCtrlHandler(ConsoleCtrlDelegate handler, bool add);