arlyxiao / best-practice

1 stars 0 forks source link

powershell ways #99

Open arlyxiao opened 1 year ago

arlyxiao commented 1 year ago

Run local script

https://stackoverflow.com/questions/4037939/powershell-says-execution-of-scripts-is-disabled-on-this-system

powershell -ExecutionPolicy Bypass -File script.ps1

Add scoop into path

https://github.com/ScoopInstaller/Scoop/issues/3951

C:\Users\<your account>\scoop

More about scoop

https://wmf.im/p/%E4%BD%BF%E7%94%A8-scoop-%E7%AE%A1%E7%90%86-windows-%E8%BD%AF%E4%BB%B6%E5%AE%89%E8%A3%85/

Proxy Script Executable

Set-ExecutionPolicy RemoteSigned
& "C:\Users\username\tool\proxy.ps1"
set HTTP_PROXY=http://127.0.0.1:8080

Make beauty

https://shaohanyun.top/posts/env/win_terminal/

Set environment

$env:HEX_HTTP_CONCURRENCY=1
$env:HEX_HTTP_TIMEOUT=120

List variables and delete

ls env:
del evn:HEX_HTTP_TIMEOUT
arlyxiao commented 1 year ago

starship config

[battery]
full_symbol = "🔋"
charging_symbol = "🔌"
discharging_symbol = "⚡"

[[battery.display]]
threshold = 30
style = "bold red"

[character]
error_symbol = "[✖](bold red) "

[cmd_duration]
min_time = 10_000  # Show command duration over 10,000 milliseconds (=10 sec)
format = " took [$duration]($style)"

[directory]
truncation_length = 5
format = "[$path]($style)[$lock_symbol]($lock_style) "

[git_branch]
format = " [$symbol$branch]($style) "
symbol = "🍣 "
style = "bold yellow"

[git_commit]
commit_hash_length = 8
style = "bold white"

[git_state]
format = '[\($state( $progress_current of $progress_total)\)]($style) '

[git_status]
conflicted = "⚔️ "
ahead = "🏎️ 💨 ×${count}"
behind = "🐢 ×${count}"
diverged = "🔱 🏎️ 💨 ×${ahead_count} 🐢 ×${behind_count}"
untracked = "🛤️  ×${count}"
stashed = "📦 "
modified = "📝 ×${count}"
staged = "🗃️  ×${count}"
renamed = "📛 ×${count}"
deleted = "🗑️  ×${count}"
style = "bright-white"
format = "$all_status$ahead_behind"

[hostname]
ssh_only = false
format = "<[$hostname]($style)>"
trim_at = "-"
style = "bold dimmed white"
disabled = true

[julia]
format = "[$symbol$version]($style) "
symbol = "ஃ "
style = "bold green"

[memory_usage]
format = "$symbol[${ram}( | ${swap})]($style) "
threshold = 70
style = "bold dimmed white"
disabled = false

[package]
disabled = true

[java]
disabled = true

[python]
format = "[$symbol$version]($style) "
style = "bold green"

[rust]
format = "[$symbol$version]($style) "
style = "bold green"

[time]
time_format = "%T"
format = "🕙 $time($style) "
style = "bright-white"
disabled = false

[username]
style_user = "bold dimmed blue"
show_always = false

[nodejs]
format = "via [🤖 $version](bold green) "
arlyxiao commented 1 year ago

proxy

$proxy='http://192.168.1.100:8080'
$ENV:HTTP_PROXY=$proxy
$ENV:HTTPS_PROXY=$proxy