主页

Python的httpserver多文件显示

写在前面 背景 总要发一些结果文件(通常是文本文件) 给 PM. 但是每次都要 拉取文件到 Mac IM软件发给同事 比较麻烦. 并且每次要保存一份副本. 此时可以在物理机启动一个 httpserver, 然后每次共享链接即可 (内网开放端口在 8000-9000) 方法 ref: python http.server网页打开txt乱码问题解决_txt导入网页变乱码-CSDN博客 nohup python3 -c from http.server import test, SimpleHTTPRequestHandler as RH; RH.extensions_map={k:v+';charset=UTF-8' for k,v in RH.exte...

阅读更多

Python的httpserver优化文件传递

写在前面 一般来说, 如果要拉取一套线上资源. 需要这样 ## 线上 nohup python3 -m http.server 40091 &> /dev/null & ## 如果没有写权限. nohup python -m SimpleHTTPServer 40091 &> /dev/null & ## 如果没有 python3 ## 本地 wget --quiet -m -np -nH -R index.html hostname:40091/{bin,conf,data,shared_lib} 但是如果线上资源中已经有了 index.html(可能是之前上线时候忘记删掉了. 但是后续又新增了文件. 这就导致拉取文件缺失了. ...

阅读更多

Shell打通跳板机访问剪贴板

背景 之前写了 vim 中打通开发机和 mac 剪贴板的方式, 最近突发奇想感觉直接在 shell 里面也可以实现, 下面来看看 脚本 #!/bin/bash # 检查是否有输入 if [ -t 0 ]; then echo "Usage: cat file | $0" exit 1 fi # 读取标准输入内容 content=$(cat) # 使用 base64 编码 encoded=$(echo -n "$content" | base64 -w 0) # 输出 ANSI 控制序列到终端 echo -e "\e]52;c;${encoded}\a" 使用 chmod +x copy mv copy ~/local/bin cat file_you...

阅读更多

Shell常用的提效工具,脚本

写在前面 alias 篇 export LANG="zh_CN.utf8" export LC_CTYPE="zh_CN.UTF-8" export MANPATH=/usr/local/share/man:$HOME/local/share/man:$MANPATH ulimit -c unlimited alias vi=vim alias vimdiff='vimdiff -c "windo set wrap" ' alias vb='vi ~/.bashrc' alias vt='vi ~/code/tool/linux_tool.sh' alias sb='source ~/.bashrc' alias vv="vi ~/.vimrc" alias ll="ls -a...

阅读更多

Cuda性能测试工具

写在前面 cuda工具集 nvprof 自测计时类 //utils.h #pragma once #include <chrono> #include <iostream> #include <cuda_runtime.h> using namespace std::chrono; #define CUDA_CHECK(call) \ do { \ cudaError_t err = ca...

阅读更多

Cuda硬件基础

写在前面 nvcc编译常见选项 /home/opt/cuda-10.1/bin/nvcc -g -G -arch=sm_35 \ -I../../include/ \ -Xcompiler "-std=gnu++14 -D_GLIBCXX_USE_CXX11_ABI=1" \ -ccbin /opt/compiler/gcc-8.2/bin/gcc \ -Xlinker "-rpath,/opt/compiler/gcc-8.2/lib:/opt/lib64" \ "$@" \ -lcudadevrt \ --relocatable-device-code true && \ ./a.out ...

阅读更多

Cuda 实现softmax与优化

写在前面 https://leetgpu.com/challenges/softmax https://leetgpu.com/challenges/softmax-attention 前置知识 safe-softmax 的原理与推导 https://arxiv.org/pdf/1805.02867 传统的 softmax 是 \(y=Softmax(x)\ \ \text{define as:}\\ y_i=\frac{e^{x_i}}{\sum\limits_{j=1}^Ve^{x_j}}\) 但是直接计算的过程中存在过大或者过小的问题. 于是有了下面的 safe-softmax \(y_i=\frac{e^{x_i-\max_{k=1}^Vx_k...

阅读更多

Cuda 实现归约 reduction 与优化

写在前面 https://leetgpu.com/challenges/reduction 可以说是 CUDA 入门的第一个算子, 对于理解并行编程比较有帮助 reduction 实现与 性能测试(CPU vs GPU) #include "utils.h" constexpr int BLOCK_SIZE = 256; __global__ void block_reduce_v1(const float* input, float* partial, int N) { __shared__ float cache[BLOCK_SIZE]; // BLOCK_SIZE must use global variable int tid = thread...

阅读更多

Total views.
您是Zorch的第 个小伙伴
Hits