python部分依赖踩坑
今天所做之事勿候明天,自己所做之事勿候他人。——歌德 今天运行脚本时警告: 123DependencyWarning: SOCKS support in urllib3 requires the installation of optional dependencies: specifically, PySocks.For more information, see https://urllib3.readthedocs.io/en/latest/contrib.html#socks-proxies 我的python版本为2.7.17 于是安装对应的模块 1pip install win-inet-pton 发现还有一个警告: 1CryptographyDeprecationWarningPython 2 is no longer supported by the Python core team 于是我先卸载 1pip uninstall cryptography 然后安装适配的版本 1pip install cryptography==2.6 再次运行即可
python对接oss上传和下载
我用尽全力,过着平凡的一生。——毛姆 首先是下载依赖,文档: https://help.aliyun.com/document_detail/85288.html 我这里是windows: 1pip install oss2 代码也是一如既往的简单,毕竟是python嘛 123456789101112131415161718from io import BytesIOimport oss2ACCESS_KEY_ID = ''ACCESS_KEY_SECRET = ''ENDPOINT = 'oss-cn-chengdu.aliyuncs.com'BUCKET_NAME = 'waibi'AUTH = oss2.Auth(ACCESS_KEY_ID, ACCESS_KEY_SECRET)BUCKET = oss2.Bucket(AUTH, ENDPOINT, BUCKET_NAME)def download_file_bytes(file_name): return BUCKET.get_o...
网站档案馆
一个人追求的目标越高,他的才能就发展得越快,对社会就越有益,我确信这也是一个真理。——玛克西姆·高尔基 分享一个网站可以访问网站历年来的档案存档 https://web.archive.org/ 例如2014年的bilibili 非常有意思
thymeleaf和vue快速入门
时间是个常数,但也是个变数。勤奋的人无穷多,懒惰的人无穷少。——字严 今天中午午休抽时间写了个thymeleaf和vue使用elementUI简单入门Demo 仓库地址:https://gitee.com/VampireAchao/simple-thymeleaf-html.git 前端代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354<!doctype html><html><head> <title>给胖哥的html页面</title> <!-- 引入样式,从这来的 https://element.eleme.cn/#/zh-CN/component/installation#cdn --> <link href="https://unpkg.com/element-ui/lib/theme-chalk/ind...
drag事件
生活最沉重的负担不是工作,而是无聊。——罗曼·罗兰 首先是MDN:https://developer.mozilla.org/zh-CN/docs/Web/API/HTML_Drag_and_Drop_API 然后是代码: 123456789101112131415161718192021222324252627282930313233343536373839404142<!DOCTYPE html><html> <head> <style> .drop-container{ width: 200px; height: 200px; border: 1px solid red; background: #eee; } .drag-ball{ w...
css实现鼠标划入显示拖动条
古之立大事者,不惟有超世之才,亦必有坚忍不拔之志。——苏轼 代码如下: 1234567891011121314151617181920212223242526272829<!DOCTYPE html><html> <head> <style> .ruben-container{ height: calc(100vh - 70vh); width: calc(100vw - 70vw); overflow-y: auto; } .ruben-container::-webkit-scrollbar { width: 4px; } .ruben-container::-webkit-scrollbar-thumb{ ...
在SpringBoot单元测试中添加参数
我的肩上是风,风上是闪烁的星群。——北岛《结局或开始·献给遇罗克》 当时是解决一个issue而去查阅的 https://github.com/baomidou/mybatis-plus/issues/4417 最后代码如下: 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566package com.ruben.mybatisplusissue;import javax.annotation.Resource;import org.junit.jupiter.api.Test;import org.junit.jupiter.api.extension.ExtendWith;import org.springframework.boot.SpringApplication;import org.springframework.boot.test.context.SpringBootCo...
jenkins部署jar并启动脚本
等到看你银色满际,等到分不清季节更替,才敢说沉溺。——《水星记》 首先是shell命令 123456789101112# 打包mvn -DskipTests=true -Ptest clean package# 结束进程ps -ef | grep translate_server | awk '{print $2}' | xargs kill -9 || true# 移动mv './target/ruben.jar' '/server/ruben.jar'# 删除日志rm -f '/test/ruben_log.txt' || true# 创建日志touch '/test/ruben_log.txt'# 静默启动nohup sh /server/ruben.sh 这里启动的ruben.sh如下: 12345678#!/bin/bashBUILD_ID=DONTKILLMEfunction start(){nohup java -jar ...
根据进程名模糊查询并结束
酒杯里竟能蹦出友谊来。——盖伊 使用方式非常简单 1ps -ef | grep [进程名] | awk '{print $2}' | xargs kill -9 例如 1ps -ef | grep java | awk '{print $2}' | xargs kill -9 注意如果在jenkins 我们需要使用|| true忽略错误,避免因为没找到对应进程构建失败 1ps -ef | grep java | awk '{print $2}' | xargs kill -9 || true 顺带再聊一个查找目录的命令 1find [路径] -name [名字] 例如 1find / -name java
ubuntu修改jenkins端口问题
昨日种种,皆成今我,切莫思量,更莫哀,从今往后,怎么收获,怎么栽。——胡适 改jenkins端口不生效 首先我去修改了/etc/init.d/jenkins 还有/etc/default/jenkins 将默认8080改成了我的端口 发现不生效,启动时提示启动失败,使用 1systemctl status jenkins.service 查看服务详细状态 查看发现,启动命令仍然是带了--httpPort=8080参数 但是在头两行看到一个 12jenkins.service - Jenkins Continuous Integration Server Loaded: loaded (/lib/systemd/system/jenkins.service; enabled; vendor preset: enabled) 于是编辑 1vim /lib/systemd/system/jenkins.service 发现其中确实有端口8080,改为我的端口后使用 1systemctl daemon-reload 重新加载服务启动命令 再次启动jenkins 1syste...
