首页
友情链接
关于
Search
1
欢迎使用 Typecho
11,964 阅读
2
Playwright使用记录
3,170 阅读
3
Windows上GCC安装
2,029 阅读
4
Unity独立安装后添加IL2CPP等编译组件
1,869 阅读
5
(Windows)以一种访问权限不允许的方式做了一个访问套接字的尝试处理
1,541 阅读
全部博文
游戏开发
Unity
Godot Engine
GDScript
编程代码
C#编程
GoLang编程
PowerShell
开发工具
笔记备忘
登录
Search
标签搜索
docker
Godot
GCC
CMS
Proto.Actor
Actor模型
winpty
msys2
Unity
IL2CPP
package
golang
ssh
proxy
proxychains
minikube
k8s
n2n
PowerShell
ChatGPT
玖亖伍
累计撰写
27
篇文章
累计收到
216
条评论
首页
栏目
全部博文
游戏开发
Unity
Godot Engine
GDScript
编程代码
C#编程
GoLang编程
PowerShell
开发工具
笔记备忘
页面
友情链接
关于
搜索到
27
篇与
的结果
2023-03-27
Ubuntu配置clang环境并编译示例程序
操作步骤添加 gpg 秘钥:wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -添加源 vim /etc/apt/sources.list.d/llvm.list# Focal (20.04) LTS deb http://apt.llvm.org/focal/ llvm-toolchain-focal main deb-src http://apt.llvm.org/focal/ llvm-toolchain-focal main更新 apt 包信息: sudo apt update安装 clang、lld 和 libc++:sudo apt install install clang-17 clang-tools-17 clang-17-doc libclang-common-17-dev libclang-17-dev libclang1-17 clang-format-17 python3-clang-17 clangd-17 clang-tidy-17 sudo apt install lld-17 sudo apt install libc++-17-dev libc++abi-17-devLinux 程序编译:clang++ --std=c++17 -o main main.cppWindows 程序(交叉)编译:clang++ --std=c++17 -target x86_64-pc-windows-gnu -mconsole -o main.exe main.cpp示例程序目录结构:. ├── main.cpp └── pocketpy.hmain.cpp内容:#include <iostream> #include "pocketpy.h" using namespace pkpy; using namespace std; int main(int argc, char** argv) { cout << "C++: hello world!" << endl; VM* vm = new VM(true); // Hello world! vm->exec("print('Python: Hello world!')", "main.py", EXEC_MODE); // Create a list vm->exec("a = [1, 2, 3]", "main.py", EXEC_MODE); // Eval the sum of the list PyVar result = vm->exec("sum(a)", "<eval>", EVAL_MODE); std::cout << py_cast<i64>(vm, result) << endl; // 6 pkpy_delete(vm); return 0; }pocketpy.h 来自项目 blueloveTH/pocketpy:PocketPy is a lightweight(~6000 LOC) Python interpreter for game engines.PocketPy是一个轻量级的Python解释器,为嵌入至游戏引擎而设计。参考LLVM Debian/Ubuntu nightly packagesWelcome to PocketPyPocketPy issues | c example #41
2023年03月27日
175 阅读
1 评论
1 点赞
2023-03-14
windows上docker运行nextcloud
端口映射: 58080 --> 80挂载路径: D:\nextcloud-data --> :/var/www/html环境变量:使用的数据库: SQLITE_DATABASE: nextcloud默认管理员账户: NEXTCLOUD_ADMIN_USER: admin默认管理员密码: NEXTCLOUD_ADMIN_PASSWORD: admin完整命令docker run -d -p 58080:80 -v //d/nextcloud-data:/var/www/html -e SQLITE_DATABASE=nextcloud -e NEXTCLOUD_ADMIN_USER=admin -e NEXTCLOUD_ADMIN_PASSWORD=admin nextcloud:production运行成功后,浏览器打开 http://localhost:58080/ 等待一会儿就会看到如下的页面:<!--参考:https://app.pluralsight.com/library/courses/docker-web-development/table-of-contentshttps://hub.docker.com/_/nextcloud-->
2023年03月14日
76 阅读
0 评论
0 点赞
2023-03-10
ChatGPT用Python实现一个一元二次方程求解的程序
我: Python实现一个一元二次方程求解的程序ChatGPT: 以下是 Python 实现一元二次方程求解的程序:import math def solve_quadratic_equation(a, b, c): """Solve the quadratic equation ax^2 + bx + c = 0.""" # 计算判别式 discriminant = b**2 - 4*a*c # 根据判别式的正负性分类讨论 if discriminant > 0: # 有两个实根 x1 = (-b + math.sqrt(discriminant)) / (2*a) x2 = (-b - math.sqrt(discriminant)) / (2*a) return x1, x2 elif discriminant == 0: # 有一个实根 x = -b / (2*a) return x else: # 无实根 return None # 测试 # 现有方程: y^2 + 10*y = 144 a = 1 b = 10 c = -144 print(solve_quadratic_equation(a, b, c)) # 输出 (8.0, -18.0)该程序定义了一个名为 solve_quadratic_equation 的函数,接受三个参数:方程的系数 a、b 和 c。函数根据判别式的正负性分类讨论,给出方程的解。最后,程序测试了方程 y^2 + 10y - 144 = 0 的解,并输出结果 (8.0, -18.0)。以下是运行程序验证的结果:
2023年03月10日
117 阅读
0 评论
0 点赞
2023-03-06
文件检索相关命令行工具
BATA cat(1) clone with wings.特性:语法高亮Git 集成不可打印(non-printable)字符可视化自动分页fzfA command-line fuzzy finderfdA simple, fast and user-friendly alternative to 'find'ripgrep((rg))ripgrep recursively searches directories for a regex pattern while respecting your gitignoreripgrep 常用命令示例:# 查看支持的类型(type)列表 rg --type-list # 添加一个自定义的类型 mmkkdd, 后缀名为 *.md, 排除.git、bin、obj、node_modules文件夹,搜索 babel rg --type-add "mmkkdd:*.md" -g "!**/.git" -g "!**/bin" -g "!**/obj" -g "!**/node_modules" --type mmkkdd -- babel # 添加一个自定义的类型 myscript, 后缀名包含 *.ps1,*.cmd,*.bat, 排除.git、bin、obj、node_modules文件夹,搜索 dotnet rg --type-add "myscript:*.{ps1,cmd,bat}" -g "!**/.git" -g "!**/bin" -g "!**/obj" -g "!**/node_modules" --type myscript -- dotnet注意: 参数用引号包裹时,windows上用双引号 ", 类Unix 上用单引号 '。
2023年03月06日
67 阅读
0 评论
0 点赞
2023-01-18
PowerShell片段
简单片段查找命令(示例: 包含Module的命令)Get-Command | Out-String -Stream | Select-String -Pattern "Module" -SimpleMatch -CaseSensitive查看帮助(示例: 查看命令Get-InstalledModule的帮助)Get-Help -Name Get-InstalledModule在线查找模块(示例: 搜索模块Pode)Find-Module -Filter Pode信任仓库PSGallery# 查看仓库 Get-PSRepository # 信任仓库 Set-PSRepository -Name 'PSGallery' -InstallationPolicy Trusted安装包(示例: 安装模块Pode)Install-Module -Name Pode -AllowClobber -Force自定义对象(类似于 C# 的 匿名类型)[PSCustomObject]@{ 'Command' = [string]'git' }查看对象成员# 实例化对象 $obj = [PSCustomObject]@{ 'Command' = [string]'git' } # 查看全部对象 $obj | Get-Member # 仅查看属性 $obj | Get-Member -MemberType NoteProperty定义类并使用# 定义类 ClassDemo class ClassDemo { [int]$One [string]$Two ClassDemo() {} ClassDemo([int]$one, [string]$two) { $this.One = $one $this.Two = $two } [string]ToString(){ return ("ClassDemo(One={0},Two={1})" -f $this.One, $this.Two) } } # 3种方式实例化 ClassDemo # 1. 使用 ::new() $object1 = [ClassDemo]::new(1,"2") # 2. 使用 New-Object $object2 = New-Object ClassDemo -Property @{ One = 1; Two = "2" } # 3. 使用类型转换 $object3 = [ClassDemo]@{ One = 1; Two = "2" }功能封装判断命令行命令是否存在function IsCommandExists { <# .SYNOPSIS 判断命令行命令是否存在 .DESCRIPTION 判断命令行命令是否存在 .PARAMETER Command 命令 .EXAMPLE PS> IsCommandExists -Command git .EXAMPLE PS> 'git' | IsCommandExists .EXAMPLE PS> [PSCustomObject]@{ 'Command' = [string]'git' } | IsCommandExists .LINK https://learn.microsoft.com/zh-cn/powershell/module/microsoft.powershell.core/about/about_automatic_variables #> [OutputType([bool])] param( [Parameter(Mandatory=$true, ValueFromPipeline=$True, ValueFromPipelineByPropertyName=$True)] [string] $Command ) Get-Command -ErrorAction SilentlyContinue "$Command" | Out-Null if ($?) { return $True } return $False }外部命令行调用# 命令行调用 pwsh 执行 PowerShell 命令 Get-InstalledModule pwsh -NoLogo -Command "& {Get-InstalledModule}"参考PowerShell 文档The PowerShell Best Practices and Style Guide关于基于注释的帮助Strongly type PS custom object propertiesIncorporating Pipelined Input into PowerShell Functions关于类
2023年01月18日
84 阅读
0 评论
0 点赞
2022-12-08
nvm替代者——fnm
fnm.svg### fnm 介绍(Schniz/fnm)GitHub描述: Fast and simple Node.js version manager, built in Rust自译: Rust实现的,迅捷而简单的Node.js版本管理器。fnm 特性nvm 只支持类 Unix 系统,而 fnm 跨平台支持更好,在 macOS、Windows、Linux 均可使用。可完全替代 nvm, fnm 支持 .node-version 和 .nvmrc 文件。fnm 安装macOS: brew install fnmWindows: scoop install fnm 或 choco install fnmLinux: 在 Releases 页面 下载压缩包,解压后将路径添加到环境变量PATHmacOS 和 Linux 还支持脚本安装: curl -fsSL https://fnm.vercel.app/install | bashfnm 使用fnm help 可查看帮助和详细命令
2022年12月08日
344 阅读
0 评论
0 点赞
2022-08-13
Ubuntu上nvm和最新版本nodejs(加速)安装
操作-- 下载nvm安装脚本 wget -c -O nvm-install.sh https://ghproxy.com/https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.1/install.sh -- 将nvm-install.sh中的下载链接前添加 https://ghproxy/ 安装nvm bash nvm-install.sh # 重新加载 ~/.bashrc, 使nvm命令可用 source ~/.bashrc # 设置nodejs国内源 export NVM_NODEJS_ORG_MIRROR=https://npmmirror.com/mirrors/node/ # 安装nodejs nvm install --ltsnvm-install.sh修改Diff@@ -59,14 +59,14 @@ nvm_source() { local NVM_SOURCE_URL NVM_SOURCE_URL="$NVM_SOURCE" if [ "_$NVM_METHOD" = "_script-nvm-exec" ]; then - NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm-exec" + NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm-exec" elif [ "_$NVM_METHOD" = "_script-nvm-bash-completion" ]; then - NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/bash_completion" + NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/bash_completion" elif [ -z "$NVM_SOURCE_URL" ]; then if [ "_$NVM_METHOD" = "_script" ]; then - NVM_SOURCE_URL="https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm.sh" + NVM_SOURCE_URL="https://ghproxy.com/https://raw.githubusercontent.com/${NVM_GITHUB_REPO}/${NVM_VERSION}/nvm.sh" elif [ "_$NVM_METHOD" = "_git" ] || [ -z "$NVM_METHOD" ]; then - NVM_SOURCE_URL="https://github.com/${NVM_GITHUB_REPO}.git" + NVM_SOURCE_URL="https://ghproxy.com/https://github.com/${NVM_GITHUB_REPO}.git" else nvm_echo >&2 "Unexpected value \"$NVM_METHOD\" for \$NVM_METHOD" return 1
2022年08月13日
387 阅读
0 评论
0 点赞
2022-06-29
虚拟组网工具n2n源码编译记录
操作环境: Ubuntu 20.4 LTS系统需要安装的编译相关的工具sudo apt install gcc g++ make git vim autoconf -y# clone源码(使用 https://ghproxy.com/ 加速) git clone https://ghproxy.com/https://github.com/ntop/n2n.git n2n-src # 编译配置 cd n2n-src/ ./autogen.sh ./configure # 编译 make # 安装 sudo make install
2022年06月29日
179 阅读
0 评论
0 点赞
2022-06-02
Ubuntu使用minikube搭建K8S环境
操作记录安装docker# 清理旧的docker(如果安装过的话) sudo apt-get remove docker docker-engine docker.io containerd runc # 安装需要的基础软件(一般都已经存在了) sudo apt-get install ca-certificates curl gnupg lsb-release # 添加GPG curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg # 添加apt源 echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null # 更新本地apt源信息 sudo apt-get update # 安装 sudo apt-get install docker-ce docker-ce-cli containerd.io docker-compose-plugin -y # 将当前用户添加到docker组 sudo usermod -aG docker $USER # 登录到docker组 newgrp docker # 验证 docker run hello-world安装 kubectl# 安装 sudo snap install kubectl --classic # 验证 kubectl version --client安装并启动minikube# 下载 wget -c https://ghproxy.com/https://github.com/kubernetes/minikube/releases/download/v1.25.2/minikube_1.25.2-0_amd64.deb # 安装 sudo dpkg -i minikube_1.25.2-0_amd64.deb rm minikube_1.25.2-0_amd64.deb # 设置使用docker作为驱动 minikube config set driver docker # 启动minikube集群 minikube start --driver=docker --image-mirror-country='cn'配置minikube仪表盘(监听127.0.0.1只能本机访问)以supervisor为例, 如果未安装,请用命令sudo apt install supervisor 安装。minikube dashboard 配置sudo vim /etc/supervisor/conf.d/minikube_dashboard.conf/etc/supervisor/conf.d/minikube_dashboard.conf:[program:minikube_dashboard] user=xxx directory=/home/xxx command=/usr/bin/minikube dashboard --url autostart=true autorestart=true startsecs=5 stopsignal=HUP stopasgroup=true stopwaitsecs=5 stdout_logfile_maxbytes=20MB stdout_logfile=/var/log/supervisor/%(program_name)s-out.log stderr_logfile_maxbytes=20MB stderr_logfile=/var/log/supervisor/%(program_name)s-err.logkubectl proxy 配置(开放端口允许外部访问)sudo vim /etc/supervisor/conf.d/kubectl_proxy.confsudo vim /etc/supervisor/conf.d/kubectl_proxy.conf:[program:kubectl_proxy] user=xxx directory=/home/xxx command=/snap/bin/kubectl proxy --port=8090 --address=0.0.0.0 --accept-hosts='.*' autostart=true autorestart=true startsecs=5 stopsignal=HUP stopasgroup=true stopwaitsecs=5 stdout_logfile_maxbytes=20MB stdout_logfile=/var/log/supervisor/%(program_name)s-out.log stderr_logfile_maxbytes=20MB stderr_logfile=/var/log/supervisor/%(program_name)s-err.log启动dashboard# 进入 supervisor sudo supervisorctlsupervisorctl内操作# 应用配置更新 update # 查看minikube dashboard输出 tail -f minikube_dashboardminikube_dashboard输出如下:supervisor> tail -f minikube_dashboard ==> Press Ctrl-C to exit <== - Using image kubernetesui/metrics-scraper:v1.0.7 - Using image kubernetesui/dashboard:v2.3.1 http://127.0.0.1:42213/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/复制url, 将其中的ip换为机器ip(假设为192.168.1.3), 端口换为代理端口(此处为8090), 即可实现外部访问:http://192.168.1.3:8090/api/v1/namespaces/kubernetes-dashboard/services/http:kubernetes-dashboard:/proxy/参考Install Docker Engine on UbuntuMinikube - Kubernetes本地实验环境minikube startdockerGitHub Proxy 代理加速
2022年06月02日
244 阅读
0 评论
1 点赞
2022-05-24
SSH反向代理的使用
准备工作说明:12.34.56.78 为公网服务器, ssh端口为22192.168.1.2 为内网服务器(未开放访问公网), ssh端口为10022192.168.1.5 为本机, 可访问192.168.1.2和12.34.56.78涉及到的命令# 设置SOCKS5代理 ssh -o StrictHostKeyChecking=no 12.34.56.78 -l user0 -p 22 -D 0.0.0.0:12080 -N -v # 设置反向隧道到代理 ssh -o StrictHostKeyChecking=no 192.168.1.2 -l devops -p 10022 -R 8051:127.0.0.1:12080 -N -v # 本机连接到私域服务器,下面的命令在其上执行 ssh 192.168.1.2 -l devops -p 100221. 修改hosts,绕过DNS解析编辑hosts文件,按需设置: sudo vim /etc/hosts119.84.77.214 mirrors.aliyun.com 140.83.35.89 ghproxy.com 65.52.183.205 packages.microsoft.com2. 安装proxychains获取proxychains源码# 临时设置代理 export ALL_PROXY=socks5://127.0.0.1:8051 # 获取proxychains源码 git clone https://ghproxy.com/https://github.com/rofl0r/proxychains-ng.git proxychains-ng-src # 取消临时代理 unset ALL_PROXYproxychains编译和安装cd proxychains-ng-src/ ./configure make sudo make install sudo make install-config修改proxychains配置添加代理: sudo vim /usr/local/etc/proxychains.conf[ProxyList] socks5 127.0.0.1 80513. 使用示例通过proxychains安装.NET6和Powershellproxychains4 wget -c https://packages.microsoft.com/config/ubuntu/20.04/packages-microsoft-prod.deb -O packages-microsoft-prod.deb sudo proxychains4 apt update # 安装常用和必要软件 sudo proxychains4 apt install -y apt-transport-https software-properties-common w3m tree # 安装 .NET6和pwsh sudo proxychains4 apt install -y dotnet-sdk-6.0 powershell # 验证 dotnet --info pwsh --version运行filebrowserproxychains4 wget -c https://ghproxy.com/https://github.com/filebrowser/filebrowser/releases/download/v2.21.1/linux-amd64-filebrowser.tar.gz tar -zxvf linux-amd64-filebrowser.tar.gz mkdir data-store /home/devops/filebrowser/filebrowser --address "0.0.0.0" --port "2554" --root /home/devops/filebrowser/data-store # 本地代理(本地访问: http://127.0.0.1:2554/) ssh -o StrictHostKeyChecking=no 192.168.1.2 -l devops -p 10022 -L 2554:127.0.0.1:2554 -N -v
2022年05月24日
164 阅读
0 评论
0 点赞
1
2
3