当前位置: 首页 > news >正文

【LUA】转载github自用二改模版——调节音量、显示七日天气、历史剪贴板、系统信息显示

二改模版笔记

自动重新加载HS

function reloadConfig(files)doReload = falsefor _,file in pairs(files) doif file:sub(-4) == ".lua" thendoReload = trueendendif doReload thenhs.reload()end
end
myWatcher = hs.pathwatcher.new(os.getenv("HOME") .. "/.hammerspoon/", reloadConfig):start()
hs.alert.show("Config loaded")

调节音量

function changeVolume(diff)return function()local current = hs.audiodevice.defaultOutputDevice():volume()local new = math.min(100, math.max(0, math.floor(current + diff)))if new > 0 thenhs.audiodevice.defaultOutputDevice():setMuted(false)endhs.alert.closeAll(0.0)hs.alert.show("Volume " .. new .. "%", {}, 0.5)hs.audiodevice.defaultOutputDevice():setVolume(new)end
endhs.hotkey.bind({"shift","ctrl",'command'}, 'Down', changeVolume(-3))
hs.hotkey.bind({"shift","ctrl",'command'}, 'Up', changeVolume(3))

显示七日天气

local urlApi = 'http://v1.yiketianqi.com/free/api'
local menubar = hs.menubar.new()
local menuData = {}local weaEmoji = {lei = '🌩️',qing = '☀️',shachen = '😷',wu = '🌫',xue = '❄️',yu = '🌧',yujiaxue = '🌨',yun = '☁️',zhenyu = '🌧',yin = '⛅️',default = ''
}function updateMenubar()menubar:setTooltip("Weather Info")menubar:setMenu(menuData)
endfunction getWeather()hs.http.doAsyncRequest(urlApi, "GET", nil,nil, function(code, body, htable)if code ~= 200 thenprint('get weather error:'..code)returnendrawjson = hs.json.decode(body)city = rawjson.citymenuData = {}for k, v in pairs(rawjson.data) doif k == 1 thenmenubar:setTitle(weaEmoji[v.wea_img])if v.win_speed == "<3级" thentitlestr = string.format("%s  %s %s  🌡️%s-%s°C", city,weaEmoji[v.wea_img], v.wea, v.tem_night, v.tem_day)elsetitlestr = string.format("%s  %s 🌡️%s-%s°C  💨%s %s %s", city,weaEmoji[v.wea_img],v.tem_night, v.tem_day, v.win_speed,  v.win, v.wea)enditem = { title = titlestr }table.insert(menuData, item)table.insert(menuData, {title = '-'})elseif v.win_speed == "<3级" thentitlestr = string.format("%s  %s 🌡️%s-%s°C     %s",  v.date, weaEmoji[v.wea_img], v.tem_night, v.tem_day, v.wea)elsetitlestr = string.format("%s  %s 🌡️%s-%s°C  💨%s %s %s",  v.date, weaEmoji[v.wea_img],v.tem_night, v.tem_day, v.win_speed, v.win, v.wea)enditem = { title = titlestr }table.insert(menuData, item)endendupdateMenubar()end)
endmenubar:setTitle('👀')
getWeather()
updateMenubar()
hs.timer.doEvery(3000, getWeather)

剪贴板

其中设置这个为true的话,可以直接插入
local pasteOnSelect = false -- Auto-type on click

--[[From https://github.com/victorso/.hammerspoon/blob/master/tools/clipboard.luaModified by Diego Zamboni
]]---- Feel free to change those settings
local frequency = 0.8 -- Speed in seconds to check for clipboard changes. If you check too frequently, you will loose performance, if you check sparsely you will loose copies
local hist_size = 100 -- How many items to keep on history
local label_length = 70 -- How wide (in characters) the dropdown menu should be. Copies larger than this will have their label truncated and end with "…" (unicode for elipsis ...)
local honor_clearcontent = false --asmagill request. If any application clears the pasteboard, we also remove it from the history https://groups.google.com/d/msg/hammerspoon/skEeypZHOmM/Tg8QnEj_N68J
local pasteOnSelect = false -- Auto-type on click-- Don't change anything bellow this line
local jumpcut = hs.menubar.new()
jumpcut:setTooltip("Clipboard history")
local pasteboard = require("hs.pasteboard") -- http://www.hammerspoon.org/docs/hs.pasteboard.html
local settings = require("hs.settings") -- http://www.hammerspoon.org/docs/hs.settings.html
local last_change = pasteboard.changeCount() -- displays how many times the pasteboard owner has changed // Indicates a new copy has been made--Array to store the clipboard history
local clipboard_history = settings.get("so.victor.hs.jumpcut") or {} --If no history is saved on the system, create an empty historyfunction subStringUTF8(str, startIndex, endIndex)if startIndex < 0 thenstartIndex = subStringGetTotalIndex(str) + startIndex + 1endif endIndex ~= nil and endIndex < 0 thenendIndex = subStringGetTotalIndex(str) + endIndex + 1endif endIndex == nil then return string.sub(str, subStringGetTrueIndex(str, startIndex))elsereturn string.sub(str, subStringGetTrueIndex(str, startIndex), subStringGetTrueIndex(str, endIndex + 1) - 1)end
end--返回当前截取字符串正确下标
function subStringGetTrueIndex(str, index)local curIndex = 0local i = 1local lastCount = 1repeat lastCount = subStringGetByteCount(str, i)i = i + lastCountcurIndex = curIndex + 1until(curIndex >= index)return i - lastCount
end--返回当前字符实际占用的字符数
function subStringGetByteCount(str, index)local curByte = string.byte(str, index)local byteCount = 1if curByte == nil thenbyteCount = 0elseif curByte > 0 and curByte <= 127 thenbyteCount = 1elseif curByte>=192 and curByte<=223 thenbyteCount = 2elseif curByte>=224 and curByte<=239 thenbyteCount = 3elseif curByte>=240 and curByte<=247 thenbyteCount = 4endreturn byteCount
end-- Append a history counter to the menu
function setTitle()if (#clipboard_history == 0) thenjumpcut:setTitle("✂") -- Unicode magicelsejumpcut:setTitle("✂") -- Unicode magic--      jumpcut:setTitle("✂ ("..#clipboard_history..")") -- updates the menu counterend
endfunction putOnPaste(string,key)if (pasteOnSelect) thenhs.eventtap.keyStrokes(string)pasteboard.setContents(string)last_change = pasteboard.changeCount()elseif (key.alt == true) then -- If the option/alt key is active when clicking on the menu, perform a "direct paste", without changing the clipboardhs.eventtap.keyStrokes(string) -- Defeating paste blocking http://www.hammerspoon.org/go/#pasteblockelsepasteboard.setContents(string)last_change = pasteboard.changeCount() -- Updates last_change to prevent item duplication when putting on pasteendend
end-- Clears the clipboard and history
function clearAll()pasteboard.clearContents()clipboard_history = {}settings.set("so.victor.hs.jumpcut",clipboard_history)now = pasteboard.changeCount()setTitle()
end-- Clears the last added to the history
function clearLastItem()table.remove(clipboard_history,#clipboard_history)settings.set("so.victor.hs.jumpcut",clipboard_history)now = pasteboard.changeCount()setTitle()
endfunction pasteboardToClipboard(item)-- Loop to enforce limit on qty of elements in history. Removes the oldest itemswhile (#clipboard_history >= hist_size) dotable.remove(clipboard_history,1)endtable.insert(clipboard_history, item)settings.set("so.victor.hs.jumpcut",clipboard_history) -- updates the saved historysetTitle() -- updates the menu counter
end-- Dynamic menu by cmsj https://github.com/Hammerspoon/hammerspoon/issues/61#issuecomment-64826257
populateMenu = function(key)setTitle() -- Update the counter every time the menu is refreshedmenuData = {}if (#clipboard_history == 0) thentable.insert(menuData, {title="None", disabled = true}) -- If the history is empty, display "None"elsefor k,v in pairs(clipboard_history) doif (string.len(v) > label_length) thentable.insert(menuData,1, {title=subStringUTF8(v,0,label_length).."…", fn = function() putOnPaste(v,key) end }) -- Truncate long stringselsetable.insert(menuData,1, {title=v, fn = function() putOnPaste(v,key) end })end -- end if elseend-- end forend-- end if else-- footertable.insert(menuData, {title="-"})table.insert(menuData, {title="Clear All", fn = function() clearAll() end })if (key.alt == true or pasteOnSelect) thentable.insert(menuData, {title="Direct Paste Mode ✍", disabled=true})endreturn menuData
end-- If the pasteboard owner has changed, we add the current item to our history and update the counter.
function storeCopy()now = pasteboard.changeCount()if (now > last_change) thencurrent_clipboard = pasteboard.getContents()-- asmagill requested this feature. It prevents the history from keeping items removed by password managersif (current_clipboard == nil and honor_clearcontent) thenclearLastItem()elsepasteboardToClipboard(current_clipboard)endlast_change = nowend
end--Checks for changes on the pasteboard. Is it possible to replace with eventtap?
timer = hs.timer.new(frequency, storeCopy)
timer:start()setTitle() --Avoid wrong title if the user already has something on his saved history
jumpcut:setMenu(populateMenu)hs.hotkey.bind({"cmd", "shift"}, "v", function() jumpcut:popupMenu(hs.mouse.getAbsolutePosition()) end)

系统信息显示

--- 显示系统信息
--- 可显示CPU\内存\硬盘\网络等实时信息
--- Created by sugood(https://github.com/sugood).
--- DateTime: 2022/01/14 22:00
---local menubaritem = hs.menubar.new()
local menuData = {}-- ipv4Interface ipv6 Interface
local interface = hs.network.primaryInterfaces()-- 该对象用于存储全局变量,避免每次获取速度都创建新的局部变量
local obj = {}function init()if interface thenlocal interface_detail = hs.network.interfaceDetails(interface)if interface_detail.IPv4 thenlocal ipv4 = interface_detail.IPv4.Addresses[1]table.insert(menuData, {title = "IPv4:" .. ipv4,tooltip = "Copy Ipv4 to clipboard",fn = function()hs.pasteboard.setContents(ipv4)end})endlocal mac = hs.execute('ifconfig ' .. interface .. ' | grep ether | awk \'{print $2}\'')table.insert(menuData, {title = 'MAC:' .. mac,tooltip = 'Copy MAC to clipboard',fn = function()hs.pasteboard.setContents(mac)end})obj.last_down = hs.execute('netstat -ibn | grep -e ' .. interface .. ' -m 1 | awk \'{print $7}\'')obj.last_up = hs.execute('netstat -ibn | grep -e ' .. interface .. ' -m 1 | awk \'{print $10}\'')elseobj.last_down =  0obj.last_down =  0endlocal date=os.date("%Y-%m-%d %a");table.insert(menuData, {title = 'Date: '..date,tooltip = 'Copy Now DateTime',fn = function()hs.pasteboard.setContents(os.date("%Y-%m-%d %H:%M:%S"))end})table.insert(menuData, {title = '打开:监  视  器    (⇧⌃A)',tooltip = 'Show Activity Monitor',fn = function()bindActivityMonitorKey()end})table.insert(menuData, {title = '打开:磁盘工具    (⇧⌃D)',tooltip = 'Show Disk Utility',fn = function()bindDiskKey()end})table.insert(menuData, {title = '打开:系统日历    (⇧⌃C)',tooltip = 'Show calendar',fn = function()bindCalendarKey()end})menubaritem:setMenu(menuData)
endfunction scan()if interface thenobj.current_down = hs.execute('netstat -ibn | grep -e ' .. interface .. ' -m 1 | awk \'{print $7}\'')obj.current_up = hs.execute('netstat -ibn | grep -e ' .. interface .. ' -m 1 | awk \'{print $10}\'')elseobj.current_down  = 0obj.current_up = 0endobj.cpu_used = getCpu()obj.disk_used = getRootVolumes()obj.mem_used = getVmStats()obj.down_bytes = obj.current_down - obj.last_downobj.up_bytes = obj.current_up - obj.last_upobj.down_speed = format_speed(obj.down_bytes)obj.up_speed = format_speed(obj.up_bytes)obj.display_text = hs.styledtext.new('▲ ' .. obj.up_speed .. '\n'..'▼ ' .. obj.down_speed , {font={size=9}, color={hex='#FFFFFF'}, paragraphStyle={alignment="left", maximumLineHeight=18}})obj.display_disk_text = hs.styledtext.new(obj.disk_used ..'\n'.. 'SSD ' , {font={size=9}, color={hex='#FFFFFF'}, paragraphStyle={alignment="left", maximumLineHeight=18}})obj.display_mem_text = hs.styledtext.new(obj.mem_used ..'\n'.. 'MEM ' , {font={size=9}, color={hex='#FFFFFF'}, paragraphStyle={alignment="left", maximumLineHeight=18}})obj.display_cpu_text = hs.styledtext.new(obj.cpu_used ..'\n'.. 'CPU ' , {font={size=9}, color={hex='#FFFFFF'}, paragraphStyle={alignment="left", maximumLineHeight=18}})obj.last_down = obj.current_downobj.last_up = obj.current_uplocal canvas = hs.canvas.new{x = 0, y = 0, h = 24, w = 30+30+30+60}-- canvas[1] = {type = 'text', text = obj.display_text}canvas:appendElements({type = "text",text = obj.display_cpu_text,-- withShadow = true,trackMouseEnterExit = true,},{type = "text",text = obj.display_disk_text,-- withShadow = true,trackMouseEnterExit = true,frame = { x = 30, y = "0", h = "1", w = "1", }},{type = "text",text = obj.display_mem_text,-- withShadow = true,trackMouseEnterExit = true,frame = { x = 60, y = "0", h = "1", w = "1", }},{type = "text",text = obj.display_text,-- withShadow = true,trackMouseEnterExit = true,frame = { x = 90, y = "0", h = "1", w = "1", }})menubaritem:setIcon(canvas:imageFromCanvas())canvas:delete()canvas = nil
endfunction format_speed(bytes)-- 单位 Byte/sif bytes < 1024 thenreturn string.format('%6.0f', bytes) .. ' B/s'else-- 单位 KB/sif bytes < 1048576 then-- 因为是每两秒刷新一次,所以要除以 (1024 * 2)return string.format('%6.1f', bytes / 2048) .. ' KB/s'-- 单位 MB/selse-- 除以 (1024 * 1024 * 2)return string.format('%6.1f', bytes / 2097152) .. ' MB/s'endend
endfunction getCpu()local data = hs.host.cpuUsage()local cpu = (data["overall"]["active"])return formatPercent(cpu)
endfunction getVmStats()local vmStats = hs.host.vmStat()-- --1024^2-- local megDiv = 1048576-- local megMulti = vmStats.pageSize / megDiv-- local totalMegs = vmStats.memSize / megDiv  --总内存-- local megsCached = vmStats.fileBackedPages * megMulti   --缓存内存-- local freeMegs = vmStats.pagesFree * megMulti   --空闲内存-- --第一种方法使用 APP内存+联动内存+被压缩内存 = 已使用内存-- --local megsUsed =  vmStats.pagesWiredDown * megMulti -- 联动内存-- --megsUsed = megsUsed + vmStats.pagesUsedByVMCompressor * megMulti -- 被压缩内存-- --megsUsed = megsUsed + (vmStats.pagesActive +vmStats.pagesSpeculative)* megMulti  -- APP内存-- --第二种方法使用 总内存-缓存内存-空闲内存 = 已使用内存-- local megsUsed = totalMegs - megsCached - freeMegs--第三种方法,由于部分设备pageSize获取不正确,所以只能通过已使用页数+缓存页数+空闲页数计算总页数local megsUsed =  vmStats.pagesWiredDown -- 联动内存megsUsed = megsUsed + vmStats.pagesUsedByVMCompressor -- 被压缩内存megsUsed = megsUsed + vmStats.pagesActive +vmStats.pagesSpeculative -- APP内存local megsCached = vmStats.fileBackedPages   --缓存内存local freeMegs = vmStats.pagesFree   --空闲内存local totalMegs = megsUsed + megsCached + freeMegslocal usedMem = megsUsed/totalMegs * 100return formatPercent(usedMem)
endfunction getRootVolumes()local vols = hs.fs.volume.allVolumes()for key, vol in pairs(vols) dolocal size = vol.NSURLVolumeTotalCapacityKeylocal free = vol.NSURLVolumeAvailableCapacityKeylocal usedSSD = (1-free/size) * 100if ( string.find(vol.NSURLVolumeNameKey,'Macintosh') ~= nil) thenreturn formatPercent(usedSSD)endendreturn ' 0%'
endfunction formatPercent(percent)if ( percent <= 0 ) thenreturn "  1%"elseif ( percent < 10 ) thenreturn "  " .. string.format("%.f", percent) .. "%"elseif  (percent > 99 )thenreturn "100%"elsereturn string.format("%.f", percent) .. "%"end
endlocal setSysInfo= function()--    if config ~=nil and config[1].showSysInfo ~= 'on' thenif 1 thenif(menuBarItem ~= nil and menuBarItem:isInMenuBar() == false) thenreturnendif (menuBarItem == nil) thenprint("设置状态栏:系统信息")menuBarItem= hs.menubar.new()elseif (menuBarItem:isInMenuBar() == false) thenmenuBarItem:delete()menuBarItem= hs.menubar.new()endinit()scan()if obj.timer thenobj.timer:stop()obj.timer = nilend-- 三秒刷新一次obj.timer = hs.timer.doEvery(3, scan):start()end
endfunction initData()setSysInfo()--监听系统信息开关的状态,判断是否要重置hs.timer.doEvery(1, setSysInfo)
end-- 初始化
initData()

相关文章:

【LUA】转载github自用二改模版——调节音量、显示七日天气、历史剪贴板、系统信息显示

二改模版笔记 自动重新加载HS function reloadConfig(files)doReload falsefor _,file in pairs(files) doif file:sub(-4) ".lua" thendoReload trueendendif doReload thenhs.reload()end end myWatcher hs.pathwatcher.new(os.getenv("HOME") .. &…...

Pymysql将爬取到的信息存储到数据库中

爬取平台为电影天堂 获取到的数据仅为测试学习而用 爬取内容为电影名和电影的下载地址 创建表时需要建立三个字段即可 import urllib.request import re import pymysqldef film_exists(film_name, film_link):"""判断插入的数据是否已经存在""&qu…...

linux中常用的命令

一&#xff1a;tree命令 &#xff08;码字不易&#xff0c;关注一下吧&#xff0c;w~~w) 以树状形式查看指定目录内容。 tree --树状显示当前目录下的文件信息。 tree 目录 --树状显示指定目录下的文件信息。 注意&#xff1a; tree只能查看目录内容&#xff0c;不能…...

关闭idea之后,项目还在运行,端口被占用

今天在写项目的时候&#xff0c;中途安装了一个插件&#xff0c;而且插件显示需要重启idea&#xff0c;重启的时候项目正在运行&#xff0c;重启之后发现idea没有显示有项目正在运行&#xff0c;当我要开启项目的时候&#xff0c;发现无法开启&#xff0c;显示端口被占用了&…...

Java的JVM学习一

一、java中的内存结构如何划分 栈和堆的区别&#xff1a; 栈负责处理运行&#xff0c;堆负债处理存储。 区域名称作用虚拟机栈用于存储正在执行的每个Java方法&#xff0c;以及其方法的局部变量表等。局部变量表存放了便器可知长度的各种基本数据类型&#xff0c;对象引用&am…...

C++之平衡二叉搜索树查找

个人主页&#xff1a;[PingdiGuo_guo] 收录专栏&#xff1a;[C干货专栏] 大家好&#xff0c;我是PingdiGuo&#xff0c;今天我们来学习平衡二叉搜索树查找。 目录 1.什么是二叉树 2.什么是二叉搜索树 3.什么是平衡二叉搜索树查找 4.如何使用平衡二叉搜索树查找 5.平衡二叉…...

如何将Mac连接到以太网?这里有详细步骤

在Wi-Fi成为最流行、最简单的互联网连接方式之前&#xff0c;每台Mac和电脑都使用以太网电缆连接。这是Mac可用端口的标准功能。 如何将Mac连接到以太网 如果你的Mac有以太网端口&#xff0c;则需要以太网电缆&#xff1a; 1、将电缆一端接入互联网端口&#xff08;可以在墙…...

Unity点乘和叉乘

目录 前言 点乘 一、点乘是什么&#xff1f; 二、应用 三、使用步骤 1.代码示例 叉乘 一、叉乘是什么&#xff1f; 二、应用 三、使用步骤 1.代码示例 总结 前言 Unity中经常会用到向量的运算来计算目标的方位&#xff0c;朝向&#xff0c;角度等相关数据&#xff0…...

【ACL 2023】Enhancing Document-level EAE with Contextual Clues and Role Relevance

【ACL 2023】Enhancing Document-level Event Argument Extraction with Contextual Clues and Role Relevance 论文&#xff1a;https://aclanthology.org/2023.findings-acl.817/ 代码&#xff1a;https://github.com/LWL-cpu/SCPRG-master Abstract 与句子级推理相比&…...

Vue ECharts X轴 type为value的数据格式 + X轴固定间隔并向上取整十位数 - 附完整示例

ECharts&#xff1a;一个基于 JavaScript 的开源可视化图表库。 目录 效果 一、介绍 1、官方文档&#xff1a;Apache ECharts 2、官方示例 二、准备工作 1、安装依赖包 2、示例版本 三、使用步骤 1、在单页面引入 echarts 2、指定容器并设置容器宽高 3、数据处理&am…...

统计成绩(c++题解)

题目描述 半期考试结束了&#xff0c;几多欢喜几多愁&#xff01;作为竞赛的选手&#xff0c;迟早是要经历大风大浪的&#xff0c;这点小小的涟漪无须太在意。但是对于成绩&#xff0c;还是要好好的分析一下的。 有N个学生&#xff0c;每个学生的数据包括学号、姓名、3门课的…...

【Qt】—— Hello World程序的实现

目录 &#xff08;一&#xff09;使⽤"按钮"实现 1.1 纯代码方式实现 1.2 可视化操作实现 &#xff08;二&#xff09;使⽤"标签"实现 2.1 纯代码方式实现 2.2 可视化操作实现 &#xff08;一&#xff09;使⽤"按钮"实现 1.1 纯代码方式实…...

谷歌浏览器网站打不开,显示叹号

问题&#xff1a; 您与此网站之间建立的连接不安全请勿在此网站上输入任何敏感信息&#xff08;例如密码或信用卡信息&#xff09;&#xff0c;因为攻击者可能会盗取这些信息。 了解详情 解决方式&#xff1a; 网上有很多原因&#xff0c;亲测为DNS问题&#xff0c;设置&…...

怎么去除图片中不需要的部分?这三种高效方法快来试一下

在数字图像处理的浩瀚世界中&#xff0c;去除图片中不必要部分的任务&#xff0c;宛如一幅细致的画卷&#xff0c;需精心描绘。这些不必要部分&#xff0c;可能是背景、水印、无关紧要物体或错误部分&#xff0c;它们如同图片中的瑕疵&#xff0c;需要被巧妙地修饰或去除。这不…...

yolov5导出onnx模型问题

为了适配C工程代码&#xff0c;我在导出onnx模型时&#xff0c;会把models/yolo.py里面的forward函数改成下面这样&#xff0c; #转模型def forward(self, x):z [] # inference outputfor i in range(self.nl):x[i] self.m[i](x[i]) # convbs, _, ny, nx x[i].shape # x(…...

JS第一课简单看看这是啥东西

1.什么是JavaScript JS是一门编程语言&#xff0c;是一种运行在客户端(浏览器)的编程语言&#xff0c;主要是让前端的画面动起来&#xff0c;注意HTML和CSS不是编程语言&#xff0c;他俩是一种标记语言。JS只要有浏览器就能运行不用跟Python或者Java一样上来装一个jdk或者Pyth…...

2023年常用网络安全政策标准整合

文章目录 前言一、政策篇(一)等级保护(二)关键信息基础设施保护(三)数据安全(四)数据出境安全评估(五)网络信息安全(六)应急响应(七)网络安全专用产品检测认证制度(八)个人信息保护(九)商用密码二、标准篇前言 2023年,国家网络安全政策和标准密集发布,逐渐…...

Redis -- 背景知识

“知识就是力量” -- 弗朗西斯培根 目录 特性 为啥Redis快? 应用场景 Redis不能做什么&#xff1f; Redis是在内存中存储数据的一个中间件&#xff0c;用作为数据库&#xff0c;也可以用作为缓存&#xff0c;在分布式中有很高的威望。 特性 In-memory data structures&…...

如何在Shopee平台上进行手机类目选品?

在Shopee平台上进行手机类目的选品是一个关键而复杂的任务。卖家需要经过一系列的策略和步骤&#xff0c;以确保选品的成功和销售业绩的提升。下面将介绍一些有效的策略&#xff0c;帮助卖家在Shopee平台上进行手机类目选品。 先给大家推荐一款shopee知虾数据运营工具知虾免费…...

班级管理神器,教师在线发布系统

现如今&#xff0c;班级管理也需要与时俱进。传统的管理方式不仅效率低下&#xff0c;而且容易出错。为了更好地管理班级&#xff0c;教师需要一个强大的工具来帮助他们发布信息和管理学生。 发布系统是一款专门为教师设计的数字化管理工具。通过系统&#xff0c;老师们就可以…...

【Spring Boot 3】异步线程任务

【Spring Boot 3】异步线程任务 背景介绍开发环境开发步骤及源码工程目录结构总结背景 软件开发是一门实践性科学,对大多数人来说,学习一种新技术不是一开始就去深究其原理,而是先从做出一个可工作的DEMO入手。但在我个人学习和工作经历中,每次学习新技术总是要花费或多或…...

JAVA斗地主逻辑-控制台版

未排序版&#xff1a; 准备牌->洗牌 -> 发牌 -> 看牌: App程序入口&#xff1a; package doudihzu01;public class App {public static void main(String[] args) {/*作为斗地主程序入口这里不写代码逻辑*///无参创建对象&#xff0c;作为程序启动new PokerGame();…...

Harmony的自定义组件和Page的数据同步

在开发过程中会经常使用自定义组件,就会遇到一个问题,在页面中引入组件后,如何把改变的值传递到自定义组件中呢,这就用到了装饰器,在这是单向传递的,用的装饰器是@State和@Prop @State在page页面中监听数据的变化 @Prop在自定义组件中监听page页面传递过来的变化值,并赋…...

【Vue3+Vite】路由机制router 快速学习 第四期

文章目录 路由简介路由是什么路由的作用 一、路由入门案例1. 创建项目 导入路由依赖2. 准备页面和组件3. 准备路由配置4. main.js引入router配置 二、路由重定向三、编程式路由(useRouter)四、路由传参(useRoute)五、路由守卫总结 路由简介 路由是什么 路由就是根据不同的 URL…...

python脚本实现浏览器驱动chromedriver的版本自动升级

chromedriver的版本号与chrome浏览器版本不匹配时在运行程序时就会报错 用下面的脚本可以自动安装chromedriver的最新版本到指定路径 from webdriver_manager.utils import get_browser_version_from_os from webdriver_manager.chrome import ChromeDriverManager import re…...

npm使用国内淘宝镜像

一、命令配置 1、设置淘宝镜像源 npm config set registry https://registry.npmmirror.com2、查看镜像使用状态 npm config get registry如果返回https://registry.npmmirror.com/,说明配置的是淘宝镜像。 如果返回https://registry.npmjs.org/,说明配置的是官网镜像。 二…...

# Redis 分布式锁如何自动续期

Redis 分布式锁如何自动续期 何为分布式 分布式&#xff0c;从狭义上理解&#xff0c;也与集群差不多&#xff0c;但是它的组织比较松散&#xff0c;不像集群&#xff0c;有一定组织性&#xff0c;一台服务器宕了&#xff0c;其他的服务器可以顶上来。分布式的每一个节点&…...

数据结构 归并排序详解

1.基本思想 归并排序&#xff08;MERGE-SORT&#xff09;是建立在归并操作上的一种有效的排序算法,该算法是采用分治法&#xff08;Divide andConquer&#xff09;的一个非常典型的应用。 将已有序的子序列合并&#xff0c;得到完全有序的序列&#xff0c;即先使每个子序列有序…...

服务器C盘突然满了,是什么问题

随着时代的发展、互联网的普及&#xff0c;加上近几年云计算服务的诞生以及大规模普及&#xff0c;对于服务器的使用目前是非常普遍的&#xff0c;用户运维的主要对象一般也主要是服务器方面。在日常使用服务器的过程中&#xff0c;我们也会遇到各式各样的问题。最近就有遇到用…...

【深度学习】ND4J-科学计算库

目录 简介 基础用法 基础信息 数组创建 打印数组 变更维度&堆叠 加减乘除 累加/最大/最小 转换操作 矩陈乘法 索引/迭代 深拷贝/引用传递/视图 引用传递 视图 深拷贝 其它 简介 ND4J主要是JVM的科学计算库&#xff0c;内置了很多计算方法&#xff0c;目的…...