Obsidian templater日记模板添加一个随机问题和Templater Javascript

简介 每天日记里写同样的东西,感觉有点无聊,想问自己一些问题,每天不同。 查到有插件random structural diary,我想要的功能就是这样,但是没懂这个插件怎么放进template。 想要的功能很简单,所以自己写一个:新建一个日记时,从一个自己设定的问题列表中选择一个,打印在日记中。 写一个简单的脚本 randomDailyQuestion.js: 1 2 3 4 5 6 7 8 9 10 11 12 function randomDailyQuestion() { let myQuestionArray = []; myQuestionArray.push("Question apple"); myQuestionArray.push("Question banana"); myQuestionArray.push("Question orange"); let randomIndex = Math.floor(Math.random() * myQuestionArray.length); let randomQuestion = myQuestionArray[randomIndex]; return randomQuestion; } module.exports = randomDailyQuestion (语法全问GPT,比自己搜快多了) Templater设置 设置存放程序的目录: 加入template 在对应的template代码中加入刚才的脚本,比如这里是在日期下面加了这个问题: # <% tp.date.now("dddd MMMM Do YYYY") %> <% tp.user.randomDailyQuestion(tp) %> 最终结果 上面两行显示为: 每次会打印其中一个问题。 警告 注意,个人知识管理(personal knowledge management, PKM)并不等于实际的工作(除非你是这方面的博主)。不要花大量时间在这些花里胡哨的东西上面。去干活!!!...

FPGA LED呼吸灯

FPGA Verilog简单的LED呼吸灯,作为新板子的亮灯程序。 这个LED在输出高电平时点亮。 主要的想法: CMP_MAX限制最大占空比,因为发现在占空比较大时,改变占空比时,亮度变化不大,效果不明显。 PWM_CNT_MAX设置PWM频率 DUTY_CNT_MAX设置占空比变化的频率 CMP_STEP设置每次占空比变化的步长,通过改变CMP_STEP来改变呼吸灯的频率 flag_duty_increase指示占空比变化的方向 代码 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 module pwm_led ( input clk, input reset_n, output led ); parameter PWM_CNT_MAX = 32'd50_000; //PWM frequency 50M/5e4=1kHz parameter CMP_MAX = 32'd25_000; //max duty ratio CMP_MAX/PWM_CNT_MAX=0....

May 6, 2023 · QY ·  FPGA

A record of what I did to my blog

Since I don’t know the first thing about web design, all of the modifications are from Google or other bloggers. The source will be included. Thanks in advance. 2023-05-15 Organizing content I planned a few blog posts for the basic modelling and control of PMSG. I wanted to put all the relevant posts into a folder, such as content/post/PMSG. Documentation: Content Organization | Hugo (gohugo.io) Demo: hugo-PaperMod/content/posts/papermod Source of the demo: PaperMod (adityatelange....

SIwave

June 4, 2023 · QY

PMSG control

May 15, 2023 · QY