wkt blog

  • About
  • About

Month: May 2018

LocalStack–线程隔离的栈结构

by admin/May 16, 2018July 19, 2018/flask, 笔记

  Werkzeug 通过自定义 werkzeug.local.Local 类实现线程隔离的栈结构, 封装了push, pop, 和top方法.可以将对象推入、弹出,也可以快速拿到栈顶对象. 同样具有线程隔离的作用. 并没有直接使用threading.Local . LocalStack作为栈结构的特性 栈是一种先进后出的基本数据结构. from werkzeug.local import LocalStack s = LocalStack() s.push(1) print(s.top) print(s.top) # 获取栈顶元素 print(s.pop()) # 弹出栈顶元素 print(s.top) # 弹出的栈顶元素会删除 s.push(1) s.push(2) print(s.top) print(s.top) print(s.pop()) print(s.pop()) 作为线程隔离的特性 线程隔离的作用是: 使当前对象可以正确的使用自己创建的对象, 而不会使用和破坏其他进程的对象. […]

短域名生成Api及源码

by admin/May 14, 2018July 19, 2018/其他

github源码 demo 生成短域名 提交一个长域名生成短域名 Request Method: POST URL: http://wkt.ooo/api/short Headers: Content-Type: application/json Body: { “long_url”:”https://www.baidu.com/s?wd=hellowlrd&rsv…….” } Response Body { “url”:”http://wkt.ooo/f8B6Y” } 或者选用另外一种方式 cURL (example) curl -X POST “http://wkt.ooo/api/short” -H “Content-Type: application/json” –data ‘{“long_url”:”http://www.baidu.com”}’ Response (example) {“url”:”http://wkt.ooo/f8B6Y”}

vim + tmux窗格平滑切换

by admin/May 11, 2018July 19, 2018/python基础, 其他, 笔记

再也不用担心无法一边打开vim一边运行终端命令了 推荐~/.vimrc和~/.tmux.conf配置, 以实现vim和tmux窗格的平滑切换 vimrc添加并安装 Plugin ‘christoomey/vim-tmux-navigator’ /.tmux.conf 添加: # Smart pane switching with awareness of Vim splits. # See: https://github.com/christoomey/vim-tmux-navigator is_vim=”ps -o state= -o comm= -t ‘#{pane_tty}’ \ | grep -iqE ‘^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'” bind-key -n C-h if-shell “$is_vim” “send-keys […]

tmux快捷键速查

by admin/May 11, 2018July 19, 2018/其他, 常用备份, 笔记

Tmux 快捷键 & 速查表 启动新会话: tmux [new -s 会话名 -n 窗口名] 恢复会话: tmux at [-t 会话名] 列出所有会话: tmux ls 关闭会话: tmux kill-session -t 会话名 关闭所有会话: tmux ls | grep : | cut -d. -f1 | awk ‘{print substr($1, 0, length($1)-1)}’ […]

Recent Posts

  • docker编译arm python
  • Create a virtual serial port that relays data over ssh
  • 在ssh服务器上创建代理, 使所有流量经过ssh客户端
  • linux:将目录里的软连接替换为原始文件
  • IntelliJ Idea: How to open project from the network share

Archives

  • July 2022
  • December 2021
  • September 2021
  • July 2021
  • June 2021
  • December 2020
  • November 2020
  • August 2020
  • July 2020
  • June 2020
  • May 2020
  • April 2020
  • March 2020
  • February 2020
  • December 2019
  • November 2019
  • October 2019
  • September 2019
  • August 2019
  • July 2019
  • June 2019
  • May 2019
  • April 2019
  • March 2019
  • January 2019
  • December 2018
  • November 2018
  • September 2018
  • August 2018
  • May 2018
  • April 2018
  • March 2018
  • February 2018
  • January 2018
  • November 2017
  • October 2017
  • September 2017
  • June 2017
  • May 2017
  • April 2017
  • April 2016

友情链接

  • Harttle
  • 张俊杰的微博客
  • 蔣振飞的博客
  • 饲养员的窝
Proudly powered by WordPress | Theme: ShowMe by NEThemes.