This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Prompt | |
{ | |
if ($?) { | |
$color = "Green" | |
} else { | |
$color = "Red" | |
} | |
Write-Host -NoNewline -ForegroundColor $color '>> ' | |
$pwd = $(Get-Location) | |
if ($pwd.Path -eq $env:USERPROFILE) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private static String numToCN(int n, boolean appendZero, boolean appendOne) { | |
if (n == 0) return ""; | |
if (n < 10) { | |
return (appendZero ? "零" : "") + NUMBER_MAPPING[n]; | |
} else if (n < 100) { | |
return (appendZero ? "零" : "") + (!appendOne && n < 20 ? "" : NUMBER_MAPPING[n / 10]) | |
+ "十" + (n % 10 == 0 ? "" : NUMBER_MAPPING[n % 10]); | |
} else if (n < 1000) { | |
return NUMBER_MAPPING[n / 100] + "百" + | |
numToCN(n % 100, n % 100 < 10, true); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export LANG=zh_CN.UTF-8 | |
alias ls="ls --color=tty" | |
alias e="explorer .; true" | |
# alias for git | |
alias glg="git log --color --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit" | |
alias ga="git add ." | |
alias gco="git checkout" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#NoTrayIcon | |
; #Warn ; Enable warnings to assist with detecting common errors. | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory. | |
; Ctrl + Alt + T: 打开 wsl-terminal | |
^!T::OpenWslTerminal() | |
OpenWslTerminal() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
set -Eeuo pipefail | |
trap cleanup SIGINT SIGTERM ERR EXIT | |
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P) | |
usage() { | |
cat <<EOF | |
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Function Set-NetConnectionSharing { | |
Param( | |
[Parameter(Mandatory=$true)][string] $LocalConnection, | |
[Parameter(Mandatory=$true)][bool] $Enabled, | |
[Parameter(Mandatory=$false)][string] $InternetConnection | |
) | |
Begin { | |
$netShare = $null | |
try { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8" /> | |
<meta name="viewport" content="width=device-width, initial-scale=1" /> | |
<title>test scan files</title> | |
<style type="text/css"> | |
.zone { | |
width: 400px; | |
height: 400px; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Lrc { | |
constructor(text) { | |
this.lrc = Object.freeze(this._parse(text)) | |
} | |
find(time) { | |
return this.lrc[this.findIndex(time)] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
location /_/ { | |
set $location_prefix '/_/'; | |
set $target_uri ''; | |
set $target_host ''; | |
set $target_url ''; | |
access_by_lua_block { | |
local target_uri = ngx.var.request_uri:sub(ngx.var.location_prefix:len() + 1) | |
if (not target_uri:lower():match("^https?://.+")) then |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function parseURL(url) { | |
const regExp = /^(http|https):\/\/(([a-zA-Z0-9-_.]+)(:(\d{1,5}))?)([^?# ]*)(\?([^?#]*))?(#(.*))?$/ | |
const a = regExp.exec(url) | |
if (!a) return | |
const parsedURL = { | |
schema: a[1], | |
host: a[2], | |
hostname: a[3], |
OlderNewer