Skip to content

Instantly share code, notes, and snippets.

View skyline75489's full-sized avatar

Chester Liu skyline75489

View GitHub Profile
@skyline75489
skyline75489 / prompt.ps1
Last active December 17, 2020 10:19
Windows Terminal OSC 9;9 for PowerShell
function prompt {
$p = $($executionContext.SessionState.Path.CurrentLocation)
$converted_path = Convert-Path $p
$ansi_escape = [char]27
"PS $p$('>' * ($nestedPromptLevel + 1)) ";
Write-Host "$ansi_escape]9;9;$converted_path$ansi_escape\"
}
@skyline75489
skyline75489 / prompt.cmd
Last active October 15, 2021 23:49
Windows Terminal OSC 7 for CMD
PROMPT=$E]7;file://%COMPUTERNAME%/$P$E\$P$G
@skyline75489
skyline75489 / prompt.sh
Last active September 22, 2020 02:34
Windows Terminal OSC 7 for Git Bash
__wt_osc7 () {
_win_path="$(cygpath -m $(pwd))"
printf "\033]7;file://%s/%s\033\\" "$HOSTNAME" "$_win_path"
}
[ -n "$BASH_VERSION" ] && [ -n "$WT_SESSION" ] && PROMPT_COMMAND="__wt_osc7"
@skyline75489
skyline75489 / upload.py
Created October 30, 2020 09:24
Upload a local folder using azure.storage.blob==12.5
import os, mimetypes, sys, uuid
from azure.storage.blob import BlobServiceClient, BlobClient, ContainerClient, ContentSettings
connect_str = "CONNECTION_STRING"
blob_service_client = BlobServiceClient.from_connection_string(connect_str)
def upload_file(f):
container_name = "CONTAINER"
@skyline75489
skyline75489 / init_python_env.ps1
Last active January 13, 2021 09:02
Basic Python Environment For Windows
CD $Env:Temp;
Invoke-WebRequest -Uri "https://www.python.org/ftp/python/3.7.9/python-3.7.9-amd64.exe" -OutFile "python-3.7.9-amd64.exe"
.\python-3.7.9-amd64.exe /quiet PrependPath=1 InstallAllUsers=1 TargetDir="C:\Python" Include_test=0;
Start-Sleep 60;
@skyline75489
skyline75489 / gist:545fa5f1305c5034c369c660ec3e597e
Created January 25, 2021 08:24
pytorch-stale-branches-0-25.txt
simple_engine
nn_c_port
jit_frontend
tmp_enable_scalars
merge_variable_tensor
cpp
ext_test_fix
win_py2.7
docker/rocm-1.8.2
always_scriptmodule
@skyline75489
skyline75489 / 1.cpp
Created April 14, 2021 07:30
MSVC bug with nested templates
#include <string>
#include <algorithm>
#include <iostream>
template<typename Result, typename Functor>
struct functor_storage : Functor
{
functor_storage() = default;
functor_storage(const Functor& functor)
: Functor(functor)
@skyline75489
skyline75489 / circle_ci_artifact.py
Last active June 16, 2021 12:43
circle_ci_artifact.py
# Documentation: https://circleci.com/docs/api/v2/
import os
import sys
import time
import re
import shutil
import tempfile
import requests
@skyline75489
skyline75489 / android.bat
Last active March 14, 2022 06:57
Android-2-PC
cd gnirehtet
start /B gnirehtet-run.cmd
cd ..
cd scrcpy-win64-v1.23
start /B scrcpy-console.bat -S -m 1024
cd ..
cd sndcpy-v1.1
start /B sndcpy.bat
@skyline75489
skyline75489 / keyvault.py
Created March 24, 2022 06:28
Use-keyvault-in-AzureVm
from azure.keyvault.secrets import SecretClient
from azure.identity import ClientSecretCredential, DefaultAzureCredential, ManagedIdentityCredential
identity = DefaultAzureCredential(managed_identity_client_id='CLIENT_ID')
client = SecretClient("https://MY_VAULT.vault.azure.net", identity)
r = client.get_secret('MY_SECRET')