自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(56)
  • 问答 (6)
  • 收藏
  • 关注

原创 gin框架使用logrus日志模块

gin框架使用logrus日志模块,自定义输出格式

2023-02-01 17:37:54 484 1

原创 springboot+VUE的session跨域

VUE const service = axios.create({ baseURL: process.env.VUE_APP_BASE_API, withCredentials: true, // session跨域打开 timeout: 3000}) SpringBoot @Configurationpublic class WebConfig implements WebMvcConfigurer { @Override public void ..

2022-01-06 18:04:18 591

原创 Java springboot之拦截器

拦截器 LoginHandlerInterceptor.javapackage com.example.demo1.component;import org.springframework.web.servlet.HandlerInterceptor;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;/** * @author kog * @创建人: k.

2021-12-30 18:17:12 573

原创 Java Springboot前后端分离,重定向

@ResponseBody@GetMapping("/hello")public ModelAndView testHello() { // 重定向 return new ModelAndView("/");}

2021-12-30 15:46:02 2816

原创 python之websocket

简易的客户端和服务端通信,不包含验证和加密客户端# websocket协议通信import threadingimport timeimport websocketdef when_message(ws, message): print('接收到的消息:' + message)# 当建立连接后,死循环不断输入消息发送给服务器# 这里需要另起一个线程def when_open(ws): def run(): while True:

2021-10-23 11:45:55 6719

原创 Python写入到Excel

import xlsxwriter as xwclass T(): def __init__(self): self.initExcel() def initExcel(self): self.workbook = xw.Workbook("./职位信息.xlsx") # 创建工作簿 self.worksheet1 = self.workbook.add_worksheet("sheet1") # 创建子表 self.

2021-06-22 12:26:56 117

原创 golang的CGO_ENABLED交叉编译(Linux, Windows)

安装mingw-w64 kog@kogdeMacBook-Pro % brew install mingw-w64==> Downloading https://homebrew.bintray.com/bottles/gmp-6.2.1.big_sur.bottle.tar.gz==> Downloading from https://d29vzk4ow07wi7.cloudfront.net/6a44705536f25c4b9f8547d44d129ae3b3657755039..

2021-05-13 14:36:52 14299 10

原创 go正则表达式

package mainimport ( "fmt" "regexp")func main(){ reg := regexp.MustCompile(`正则表达式`) val := reg.FindAllString("需要匹配的字符串", -1) // -1匹配所有 fmt.Println(val)}

2021-05-07 11:42:51 94

原创 SQL重复字段取第一个

SELECT s.* FROM ( SELECT *, row_number() over ( PARTITION BY [重复的字段] ORDER BY [排序字段] ) AS group_idx FROM [表名] ) s WHERE s.group_idx = 1

2021-05-06 15:56:04 800

原创 golang日期字符串的互转

绝不BB 上代码package mainimport ( "fmt" "time")func main() { // 日期转字符串 currentTime := time.Now() fmt.Println("Current Time in String: ", currentTime.String()) fmt.Println("MM-DD-YYYY : ", currentTime.Format("01-02-2006")) fmt.Println("YYYY-MM-DD :

2021-04-29 15:50:00 5013

原创 beego的orm原生SQL查询

这种是我目前看到最简单的写法了(没有之一) 欢迎打脸 func testdata(){ o := orm.NewOrm() var list []orm.Params nums, err := o.Raw("select 1 as 'haha'").Values(&list) if nums == 0 { } fmt.Println(list,err)}

2021-04-27 15:47:05 444 2

原创 Go判断文件是否存在,不存在创建

看代码_, exist := os.Stat("logs")if os.IsNotExist(exist) { os.Mkdir("logs", os.ModePerm)}

2021-04-25 11:45:06 964

原创 python中input设置超时

暂时没有想到更好的方案 希望大家给点意见import osimport threadingdef input_func(): global val val = input('请输入:\n')val = "默认值"t = threading.Thread(target=input_func)t.start()t.join(3) # 等待3秒print("这个是{}".format(val))os.kill(os.getpid(), 9)...

2021-04-23 16:41:14 1271

原创 element表单正则验证

添加pattern 正则规则写在/的中间 非常简单好用rules: { sship: [ { required: true, message: '请输入IP', trigger: 'blur' }, { required: true, pattern: /^\d{0,3}\.\d{0,3}\.\d{0,3}\.\d{0,3}$/, message: '请检查ip格式',...

2021-04-16 16:33:45 427 1

原创 element走马灯手动切换

template <el-carousel ref="carousel" :autoplay="false" arrow="always" trigger="click" :loop="false" indicator-position="none"> <el-carousel-item v-for="item in 6" :key="item"> <div>第{...

2021-04-13 15:40:30 2713

原创 GO的ssh连接方案

不BB直接看代码 package mainimport ( "fmt" gossh "golang.org/x/crypto/ssh" "net")// 连接信息type Cli struct { user string pwd string addr string client *gossh.Client session *gossh.Session LastResult string}// 连接对象func

2021-04-02 10:54:15 3779 2

原创 GoLand项目导入报红,项目正常运行

setting--> Go Moudules--> 勾上Enable Go modules intergration

2021-01-21 15:47:17 1960

原创 vue-admin-template左侧点击刷新

@/layout/components/Sidebar/Link.vue<template> <!-- eslint-disable vue/require-component-is --> <component v-bind="linkProps(to)"> <slot /> </component></template><script>import { isExternal } from

2021-01-14 16:56:18 323

原创 Golang发起GET POST请求

package mainimport ( "bytes" "encoding/json" "fmt" "io/ioutil" "net/http" "time")func httpGet() { //func Get(url string) (resp *Response, err error) //url := "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=wx1.

2020-11-25 20:32:08 207

原创 beego不建立模型,ORM执行SQL

main.gopackage mainimport ( _ "beegoDemo001/routers" "fmt" "github.com/astaxie/beego" "github.com/astaxie/beego/logs" "github.com/astaxie/beego/orm" _ "github.com/go-sql-driver/mysql" "os")//初始化连接数据库func init() { //此处可以读取你的config配置 //u.

2020-10-13 12:29:00 234

转载 Golang操作MySQL

怕原作者删了转载一波(侵删)go get github.com/go-sql-driver/mysqlpackage main; import ( "database/sql" _ "github.com/go-sql-driver/mysql" // 包的初始化,执行包中所有的init()方法 具体参见http://blog.csdn.net/wanglei9876/article/details/50475864 "fmt") func main() {

2020-10-03 22:31:16 102

原创 小程序圆形进度条

目录结构circle.js/* components/circle/circle.js */Component({ options: { multipleSlots: true // 在组件定义时的选项中启用多slot支持 }, properties: { draw: { //画板元素名称id type: String, value: 'draw' }, per: { //百分比 通过此值转换成step type:.

2020-09-27 21:58:27 1090 3

原创 Go交叉编译,后台启动执行、停止

编译Mac下编译Linux, Windows平台的64位可执行程序:CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build test.goCGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build test.goLinux下编译Mac, Windows平台的64位可执行程序:CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build test.goCGO_ENABLED=0 G

2020-09-27 11:36:24 761

原创 subprocess.Popen杀执行中的线程、子线程、当前进程

不想打字 看案例./mytest.pyfrom time import sleepsleep(1000)print(hello world!!)在执行./mytest.py假设此进程已经卡死command = r'''python ./mytest.py'''cmd = subprocess.Popen(command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True

2020-09-24 16:11:34 977

原创 Golang beego跨域请求及中间件

跨域请求 (推荐抽离)package routersimport ( "github.com/astaxie/beego" "github.com/astaxie/beego/plugins/cors")func init() { //跨域配置 beego.InsertFilter("*", beego.BeforeRouter, cors.Allow(&cors.Options{ AllowAllOrigins: true, //AllowOrigins:

2020-09-18 15:35:05 793

原创 go get 报错:dial tcp 34.64.4.113:443: i/o timeout解决方案

切换为国内资源即可go env -w GO111MODULE=on设置环境代理go env -w GOPROXY=https://goproxy.cn,direct

2020-09-16 14:50:55 10623 2

原创 Golang文件写入常用的三种方式

走起 package mainimport ( "bufio" "fmt" "io/ioutil" "os")func writeByte(path, str string) { fileObj, err := os.OpenFile(path, os.O_WRONLY|os.O_APPEND|os.O_CREATE, 132) if err != nil { fmt.Println(err) return } defer func() { err := fil

2020-09-14 14:01:32 1988

原创 Golang文件读取常用的三种方式

golang读取文件

2020-09-14 12:44:15 748

原创 flask跨域 blueprint跨域和restful跨域

蓝图的跨域是用了flask-cors库中的CORS, 此方法跨域只处理装饰器式的路由, restful是继承Resource的所以该跨域并不能生效 两种方案根据需求选择方案一(蓝图的跨域直接使用CORS库即可)from flask_cors import CORSapp = Flask(__name__)CORS(app, supports_credentials=True)if __name__ == "__main__": app.run()方案二(restful的跨域使

2020-09-04 12:50:23 805

原创 判断无损连接

很多资料讲解比较抽象下文相对比较通俗易懂,个人理解如有错误欢迎指正当分解ρ只有两组的时候这种情况相对较好判断,有先有公式: R1∩R2→R1-R2或R1∩R2→R2-R1这两个条件满足任何一个都是无损连接都不满足即为有损连接 例如:设有关系模式R(U,V,W,X,Y,Z),其函数依赖集:F={U→V,W→z,Y→U,WY→X},现有下列分解:ρ={UVY,WXYZ}(摘自软考题)R(UVY) ∩ R(WXYZ) 得出Y R1-R2 得出UV R2-R1 得出WXZ 此处注...

2020-08-02 11:11:50 7330 15

原创 Django跨域问题配置

在任意有jQuery的网站上先测试是否存在跨域问题$.ajax({ url:'/xxx/测试接口', type:'get', success:function(res){ console.log(res) }})安装django-cors-headerspip3 install django-cors-headers配置setting.pyINSTALLED_APPS = [ 'django.contrib.admin', .

2020-07-23 14:17:03 102

原创 Mac本.bash_profile不生效

如果不存在创建一个文件 然后source ~/.bash_profile即可不生效创建.zshrc 因为每次打开终端最先加载的是.zshrc(也可以直接在这里配置环境变量,不便于维护) 在.zshrc 添加source ~/.bash_profile

2020-06-30 10:05:13 478

原创 vim cat指定到行

vim指定到行# 在打开文件时,跳转到文件的第n行 vim +n filenamevim +15 ./test.sh# 编辑的过程中跳转到行数 英文状态下冒号行号回车 :n:15cat只能区间读取# 显示文件前面10行cat 文件名 | head -n 10# 显示文件最后10行cat 文件名 | tail -n 10# 从10行开始显示,显示10行以后的所有行cat 文件名 | tail -n +10 # 从10行到50行 此处tail和head不能互换位置c

2020-06-29 09:44:27 339

原创 shell字符串,列表操作等

字符串包含 类似in#!/bin/bashfunction1(){ abcd="1234" } function1 &&a='34'if [[ $abcd == *$a* ]]then echo "包含" else echo "不包含" fiwhoami | grep -qE 'kog2|kog1'$? # 返回为0包含 1或其他不包含占位符/截取字符串/字符串操作a="abcd"b="12.

2020-06-28 16:33:53 2216

原创 小程序API接口集中管理

小程序api使用不多但是每处都定义不方便后期维护于是我们便集中管理 直接在utils文件下新增api.js(定义api接口) https.js(后台请求,域名配置) 目录结构如下api.jsimport { http } from './https';// 接口定义function getApi(params) { http('/project/projectInfos',...

2020-05-08 09:28:57 738

原创 小程序中间证书Apache配置https

小程序苹果能访问 安卓不能访问多半是中间证书的问题 中间证书可以通过第三方网址生成 https://www.myssl.cn/tools/downloadchain.html 首先安装Apache可以参考我的另一篇文章 https://blog.csdn.net/weixin_42662249/article/details/96483380 先测试Apache正常启动 /Ap...

2020-04-21 17:10:40 574

原创 python线程快速了解

import threadingimport timedef func1(): print('--非守护线程开始--') time.sleep(2) print('--非守护线程结束--')def func2(): print('--守护线程开始--') time.sleep(4) print('--守护线程结束--')if __...

2020-04-10 09:20:47 98

原创 原生JS全屏非F11

var fullscreenfun = function(full){ // 全屏 if (full){ if(document.exitFullScreen){ document.exitFullscreen() } //兼容火狐 if(document.mozCancelFullS...

2020-04-09 18:03:59 135

原创 python名片生成二维码 无线网连接

话不多说上代码# -*- coding:utf-8 -*-# 参考文档:# https://blog.csdn.net/woshinia/article/details/8896444''' BEGIN:VCARD\n #名片开始 VERSION:3.0\n #版本3.0 FN:%s\n #...

2020-04-01 15:44:13 568

原创 python读取hive数据及部分配置

先配置hadoopetc/hadoop/hdfs-site.xml 添加<!-- web访问hdfs --><property> <name>dfs.webhdfs.enabled</name> <value>true</value> </property>etc/hadoop/core-...

2020-03-12 15:21:30 1187

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除