根据给定年份,返回生肖字符串,公元前使用负值即可。(比如2022年,调用使用GetShengXiao(2022),公元前21年,调用使用GetShengXiao(-21))。
// 获取生肖索引
func GetShengXiaoIndex(year int) int {
// 不存在0年
if year == 0 {
panic("err: invalid year")
}
// 公元前补1
if year < 0 {
year += 1
}
idx := (year - 4) % 12
if idx < 0 {
idx += 12
}
return idx
}
// 根据给定年份获取生肖
func GetShengXiao(idx int) string {
return [12]string{"鼠", "牛", "虎", "兔", "龙", "蛇", "马", "羊", "猴", "鸡", "狗", "猪"}[idx]
}
分类: 未分类
-
Go语言获取指定年份生肖
-
使用SSH转发服务器端口到本地
注意远程地址、远程端口号、本地地址、本地端口号需要按照实际情况修改。
function forwardPort() { PROC_NAME="ssh -fR $1" ProcNumber=`ps -ef |grep -w "$PROC_NAME"|grep -v grep|wc -l` if [ $ProcNumber -le 0 ];then echo "$1 is not forward.." ssh -fCNR $1:localhost:$1 root@0.0.0.0 -p 1234 -o ServerAliveInterval=30 else echo "$1 has forwarded.." fi } for port in 1234 4567 do forwardPort $port done注意,如果需要外网访问转发的端口,需要在远程服务器的配置文件(/etc/ssh/sshd_config)中添加:
AllowTcpForwarding yes -
网页、APP跳转应用商店
安卓
- 跳转到应用页面:market://details?id=
- 跳转到搜索:market://search?q=
IOS
- 应用页面:itms-apps://itunes.apple.com/app/id 114211089
-
Linux服务器Swap配置
简单记录文件形式的Swap使用与配置方式。
1. 交换文件大小配置原则
- 内存<2G,配置实际内存的两倍
- 内存>2G,配置为4G即可
- 内存>4G,追求极致性能,不需要配置交换
2. 创建交换文件
# 创建一个名称为swap的文件,大小为1GB # if 输入文件名称,此处使用/dev/zero即可 # of 输出文件名称,使用期望的文件名即可 # bs 同时设置读入/输出的块大小为多少个字节 # count 拷贝多少个块,块大小等于bs指定的字节数 dd if=/dev/zero of=/swap bs=1M count=1024 # 配置交换文件权限 chmod 0600 /swap # 将文件设置为交换文件 mkswap /swap # 启用指定交换文件 swapon /swap # 查看交换文件状态 swapon -s # 添加交换文件自动挂载 echo "/swap swap swap defaults 0 0" >> /etc/fstab3. 删除交换文件
# 关闭指定交换文件 swapoff /swap # 删除文件 rm /swap # 删除自动挂载配置 vi /etc/fstab -
MySQL8 GTID双主配置
记录一下MySQL8中配置GTID双主的方式。
需要添加以下配置信息:
vim /etc/my.cnf # 添加 [mysqld] # 两台服务器的server-id不能一致 server-id=1 gtid_mode=on enforce-gtid-consistency=true具体使用到的SQL语句:
# 创建一个账号用于另一台主机复制数据 # create user 'slave'@'0.0.0.0' identified by 'this is your password'; # 授权 grant REPLICATION SLAVE on *.* to 'slave'@'0.0.0.0'; # 查看主机状态 SHOW MASTER STATUS; # 以下为另一台服务器执行内容 CHANGE REPLICATION SOURCE to SOURCE_HOST = '0.0.0.0', SOURCE_PORT = 3306, SOURCE_USER = 'slave', SOURCE_PASSWORD = 'this is your password'; # 停止并重置复制 STOP REPLICA; reset REPLICA; # 开始复制并查看复制状态 START REPLICA; SHOW REPLICA STATUS; -
Nextcloud安全最佳实践
- 复杂密码
- Suspicious Login
- 两步认证,启用至少一项
- *Two-Factor TOTP Provider
- *Two-Factor Authentication via Nextcloud Notification
- *Two-Factor WebAuthn
- Two-Factor Email
-
MySQL给已存在的主键字段添加自增AUTO_INCREMENT
每次都记不起来,记录一下…
# 添加自增约束 alter table table_name modify column COLUMN_NAME COLUMN_TYPE auto_increment; # 配置自增起始值 alter table table_name auto_increment=10000; -
Debian配置自动清理Journal日志
Debian系统上(红帽系Linux发行版应该也是一样的),
systemd-journald服务负责管理journal日志。这些日志可以占用大量的磁盘空间,特别是当系统持续运行并且产生大量日志条目时。可以配置systemd-journald的日志保留策略来自动清理这些日志。1. 编辑
systemd-journald的配置文件systemd-journald的主要配置文件是/etc/systemd/journald.conf。sudo vim /etc/systemd/journald.conf2. 配置日志保留策略
在配置文件中,你可以设置以下选项来控制日志的保留:
SystemMaxUse=: 设置系统日志可使用的最大磁盘空间。例如,SystemMaxUse=50M会限制系统日志使用最多50MB的磁盘空间。SystemKeepFree=: 设置保留的空闲磁盘空间。例如,SystemKeepFree=1G会确保至少有1GB的空闲磁盘空间不会被日志使用。MaxRetentionSec=: 设置日志条目的最大保留时间。例如,MaxRetentionSec=1month会自动删除超过一个月的日志条目。
3. 重新加载配置并重启服务
在修改配置文件后,你需要重新加载
systemd的配置并重启systemd-journald服务。sudo systemctl daemon-reload sudo systemctl restart systemd-journald4. 检查配置是否生效
使用
journalctl命令来检查journal的当前状态和配置。journalctl --disk-usage # 查看当前占用空间 journalctl --vacuum-size=50M # 可以用这个命令手动清理日志到指定大小,但通常不需要这样做,因为自动清理应该已经配置好了。5. 监控磁盘使用情况
为了确保你的日志清理策略按预期工作,建议定期监控服务器的磁盘使用情况。你可以使用
df命令来检查磁盘空间的使用情况。6. 注意事项
- 在修改任何系统配置文件之前,最好先备份原始文件。
systemd-journald的日志清理策略是基于磁盘空间使用量或日志条目的保留时间来工作的,所以确保你设置的策略符合你的实际需求。- 如果你的系统上有大量的日志生成,并且磁盘空间有限,你可能还需要考虑其他日志管理策略,如将日志发送到远程日志服务器或定期归档旧日志。
-
使用Docker Compose部署NextCloud和WordPress
一、全局配置
name: lnmp services: caddy: image: caddy:latest volumes: - ./www:/var/www/html - ./caddy/etc:/etc/caddy - ./caddy/data:/data - ./caddy/config:/config ports: - 80:80 - 443:443/tcp - 443:443/udp logging: driver: "json-file" options: max-size: "10m" max-file: 3 restart: always redis: image: redis:latest volumes: - ./redis/config:/etc/redis - ./redis/data:/data restart: always command: /etc/redis/redis.conf mysql: image: mysql:latest volumes: - ./mysql/config:/etc/mysql - ./mysql/data:/var/lib/mysql - ./mysql/mysql-files:/var/lib/mysql-files cap_add: - SYS_NICE security_opt: - seccomp:unconfined environment: MYSQL_ROOT_PASSWORD: password ports: - 3306:3306 restart: always php: build: ./php volumes: - ./php/config:/usr/local/etc - ./php/logs:/var/log/php - ./www:/var/www/html depends_on: - caddy - mysql - redis cap_add: - SYS_PTRACE logging: driver: "json-file" options: max-size: "10m" max-file: 3 restart: always imaginary: image: nextcloud/aio-imaginary:latest restart: always command: -concurrency 2 -enable-url-source environment: - PORT=90001. PHP
PHP官方的镜像启用和安装的扩展比较少,直接使用会导致WordPress和Nextcloud的健康检查一堆信息,所以使用Dockerfile来基于官方镜像构建一个专用的镜像,PHP需要的扩展包括:
- gd(png/jpeg/gif/webp/avif)
- imagick
- opcache(考虑性能)
- apcu(Nextcloud的本地缓存)
- zip(影响WordPress插件安装)
- redis(WordPress的对象缓存和Nextcloud的分布式缓存)
- gmp
- intl
FROM registry.cn-beijing.aliyuncs.com/ianzhi/php:8.4-fpm-alpine # 配置国内镜像 RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories # 安装构建扩展相关依赖 RUN apk add --no-cache --update --virtual .build-deps $PHPIZE_DEPS # MySQL RUN docker-php-ext-install pdo_mysql mysqli \ && docker-php-ext-enable pdo_mysql mysqli # 常用扩展 RUN docker-php-ext-install pcntl exif bcmath sysvsem \ && docker-php-ext-enable opcache exif bcmath pcntl sysvsem # apcu RUN pecl install apcu && docker-php-ext-enable apcu # zip扩展 RUN apk add --no-cache --update libzip=1.11.4-r0 libzip-dev=1.11.4-r0 unzip \ && docker-php-ext-install zip \ && docker-php-ext-enable zip # redis RUN pecl install https://pecl.php.net/get/redis-6.2.0.tgz \ && docker-php-ext-enable redis # intl RUN apk add --no-cache --update icu icu-dev \ && docker-php-ext-configure intl \ && docker-php-ext-install intl \ && docker-php-ext-enable intl # imagick RUN apk add --no-cache --update imagemagick-dev imagemagick-svg \ && pecl install https://pecl.php.net/get/imagick-3.8.0.tgz \ && docker-php-ext-enable imagick # gd RUN apk add --no-cache --update libpng libpng-dev libavif-dev libjpeg-turbo-dev freetype-dev freetype libjpeg-turbo libavif \ && docker-php-ext-configure gd --with-freetype --with-jpeg --with-avif \ && docker-php-ext-install gd \ && docker-php-ext-enable gd # ffmpeg nextcloud需要视频转码时启用 # RUN apk add --no-cache ffmpeg # gmp nextcloud使用加密时使用 # RUN apk add --no-cache --update gmp-dev \ # && docker-php-ext-install gmp \ # && docker-php-ext-enable gmp # pgsql # RUN apk add --no-cache --update libpq-dev postgresql-dev \ # && docker-php-ext-install pdo_pgsql \ # && docker-php-ext-enable pdo_pgsql # 删除构建依赖 RUN apk del --no-network .build-deps # 配置文件 RUN cp /usr/local/etc/php/php.ini-production /usr/local/etc/php/php.ini -
HTTP status and The meaning
Here are some of the most common HTTP status codes and their meanings:
- 1xx – Informational: These status codes indicate that the request has been received and is being processed.
- 100 Continue: The server has received the request headers and is waiting for the request body.
- 101 Switching Protocols: The server has switched to a different protocol, such as HTTP/2.
- 2xx – Success: These status codes indicate that the request has been successfully received, understood, and accepted.
- 200 OK: The request has been successfully completed.
- 201 Created: The request has been fulfilled and a new resource has been created.
- 202 Accepted: The request has been accepted for processing, but the processing has not been completed yet.
- 3xx – Redirection: These status codes indicate that further action needs to be taken in order to complete the request.
- 301 Moved Permanently: The requested resource has been moved permanently to a new location.
- 302 Found: The requested resource has been temporarily moved to a new location.
- 304 Not Modified: The requested resource has not been modified since the last time it was requested.
- 4xx – Client Error: These status codes indicate that the request contains bad syntax or cannot be fulfilled.
- 400 Bad Request: The request cannot be understood by the server.
- 401 Unauthorized: The request requires authentication.
- 404 Not Found: The requested resource could not be found.
- 5xx – Server Error: These status codes indicate that the server has encountered an error while processing the request.
- 500 Internal Server Error: An unexpected error has occurred on the server.
- 503 Service Unavailable: The server is temporarily unavailable.
- 504 Gateway Timeout: The server did not receive a timely response from another server.
There are many other HTTP status codes, but these are some of the most common ones. You can find a complete list of HTTP status codes here: https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
- 1xx – Informational: These status codes indicate that the request has been received and is being processed.
-
SEO如何优化网站标题
网站标题是SEO优化中非常重要的一部分,以下是一些可以优化网站标题的建议:
- 确保网站标题是简短、明了和有吸引力的,以吸引更多的用户点击访问。
- 将网站标题中的关键词进行合理的排列,以提高网站在搜索引擎中的排名。
- 将网站标题中的关键词进行加粗或标记,以提高关键词的可见性和重要性。
- 使用H标签来突出显示网站标题,以提高用户体验和SEO效果。
- 定期更新网站标题,以反映网站内容和主题的变化,以吸引更多的用户点击访问。
- 使用网站分析工具来监控和优化网站的性能,以确保网站标题能够被正确地处理和索引。
需要注意的是,网站标题的优化需要结合整个SEO优化策略来进行,以达到最好的效果。
-
How to calculate the similarity of two articles using PHP
How to calculate the similarity of two articles using PHP?
- Using the
similar_text()function: This is a built-in function in PHP that calculates the similarity of two strings. It returns the number of matching characters in the two strings, or the similarity in percent if the third parameter is passed.
PHP
$similarity = similar_text($article1, $article2); if ($similarity > 0.75) { echo "The two articles are very similar."; } else { echo "The two articles are not very similar."; }Use code with caution. Learn morecontent_copy
- Using the
levenshtein()function: This is another built-in function in PHP that calculates the Levenshtein distance between two strings. The Levenshtein distance is a measure of how similar two strings are, and it is calculated by counting the number of edits (insertions, deletions, or substitutions) required to transform one string into the other.
PHP
$levenshtein_distance = levenshtein($article1, $article2); if ($levenshtein_distance < 10) { echo "The two articles are very similar."; } else { echo "The two articles are not very similar."; }Use code with caution. Learn morecontent_copy
- Using a custom algorithm: You can also write your own custom algorithm to calculate the similarity of two articles. This could involve using a variety of factors, such as the number of common words, the number of common phrases, the order of the words, and the grammatical structure of the articles.
Once you have calculated the similarity of two articles, you can use it to do a variety of things, such as:
- Detecting plagiarism: You can use the similarity of two articles to detect plagiarism. If the similarity is high, then it is likely that one of the articles is a plagiarized version of the other.
- Recommending similar articles: You can use the similarity of two articles to recommend similar articles to users. For example, if a user reads an article about “how to cook a steak,” you could recommend other articles about “how to cook a chicken” or “how to cook a fish.”
- Clustering articles: You can use the similarity of two articles to cluster articles together. This could be useful for organizing articles in a database or for creating a search engine.
I hope this helps!
- Using the
-
how to improve the rank of search results in google
There are many factors that affect a website’s ranking in Google search results, but some of the most important include:
- Content: Your website’s content should be high-quality, informative, and relevant to the keywords you are targeting.
- Keywords: You should use keywords throughout your website’s content, but in a natural way. Avoid keyword stuffing, which can actually hurt your rankings.
- Backlinks: Backlinks are links from other websites to yours. The more backlinks you have from high-quality websites, the better your rankings will be.
- Technical SEO: Your website’s technical SEO should be sound. This includes factors such as page speed, mobile-friendliness, and security.
- User experience: Google also considers user experience when ranking websites. This means that your website should be easy to use and navigate.
Here are some specific steps you can take to improve your website’s ranking in Google search results:
- Do keyword research: Identify the keywords that people are using to search for the products or services you offer.
- Create high-quality content: Write content that is informative, relevant, and well-written. Use your target keywords throughout your content, but in a natural way.
- Optimize your website for search engines: Use the right keywords in your website’s title tags, meta descriptions, and other on-page elements.
- Build backlinks: Get backlinks from other high-quality websites. This will help to improve your website’s authority and ranking.
- Fix any technical SEO issues: Make sure your website is mobile-friendly, secure, and loads quickly.
- Monitor your results: Use Google Search Console to track your website’s ranking and make adjustments as needed.
Improving your website’s ranking in Google search results takes time and effort, but it is worth it. By following the tips above, you can improve your chances of ranking higher in search results and attracting more visitors to your website.
Here are some additional tips that may help you improve your search ranking:
- Use long-tail keywords: Long-tail keywords are more specific than short-tail keywords, and they are often easier to rank for.
- Create fresh content: Google favors websites that are updated regularly. Make sure you are adding new content to your website on a regular basis.
- Promote your website: Share your website’s content on social media and other online channels. This will help to increase your website’s visibility and improve your ranking.
I hope this helps!
-
php: /usr/local/lib/libcurl.so.4: no version information available (required by php)
出现原因是安装了多个版本的库,ubuntu的一些库似乎增加了一些附加补丁,导出的符号与ubuntu有关联的版本信息,但在标准的库中是没有的。
可以通过:
find / -name libcurl.so*查找系统中安装的所有的对应的库版本及位置。解决方案:
- 删除出现问题的/usr/local/lib/libcurl.so.4
- 寻找系统库中对应库的版本,建立软链
ln -s /usr/lib/x86_64-linux-gnu/libcurl.so.4.5.0 /usr/local/lib/libcurl.so.4
-
MySQL创建分区表
背景:一个记录表,类似日志的信息,查询大量集中在某个用户个人的数据,分区需要尽量保证一个人的数据在一个分区里。因此采用通过user_id进行hash分区的方式。
-- 将分区字段添加为主键 alter table logs modify column id int not null; alter table logs drop primary key; alter table logs add primary key(id, user_id); alter table logs modify column id int not null auto_increment; -- 创建带分区的表 CREATE TABLE `logs_withs_partitions` ( `id` int NOT NULL AUTO_INCREMENT, `user_id` int NOT NULL, ... PRIMARY KEY (`id`,`user_id`) ) PARTITION BY HASH(user_id) PARTITIONS 5; -- 将数据复制到带分区的表 insert into logs_withs_partitions select * from logs; -- 重命名表 rename table logs to logs_without_partitions; rename table logs_withs_partitions to logs; -- 删除不带分区的表 drop table logs_without_partitions; -
use multiple simple queries or a join
The decision of whether to use multiple simple queries or a join depends on the specific requirements of the query.
- Multiple simple queries are often used when the data that you need is not related. For example, if you need to get the name of all users and the title of all posts, you could use two separate queries:
SQL
SELECT name FROM users; SELECT title FROM posts;Use code with caution. Learn morecontent_copy
- Joins are used when the data that you need is related. For example, if you need to get the name of all users and the title of all posts that they have written, you could use a join:
SQL
SELECT users.name, posts.title FROM users JOIN posts ON users.id = posts.author_id;Use code with caution. Learn morecontent_copy
Joins can be more efficient than multiple simple queries, because they only have to access the database once. However, joins can be more complex to write, and they can be more difficult to understand.
In general, you should use joins whenever possible. However, if the data that you need is not related, or if you are not familiar with joins, then you can use multiple simple queries.
Here are some additional factors to consider when deciding whether to use multiple simple queries or a join:
- The size of the datasets. If the datasets are small, then multiple simple queries may be a better option. However, if the datasets are large, then a join may be a better option.
- The performance requirements. If you need to get the results quickly, then a join may be a better option. However, if performance is not a critical factor, then multiple simple queries may be a better option.
- The complexity of the query. If the query is complex, then a join may be a better option. However, if the query is simple, then multiple simple queries may be a better option.
Ultimately, the decision of whether to use multiple simple queries or a join is a trade-off between performance and complexity. You should choose the option that best meets the specific requirements of your query.
-
Windows rclone挂载sftp
手动挂载命令:
rclone mount sftp:/mnt o: --cache-dir %SystemRoot%TEMP --allow-other --vfs-cache-mode writes --vfs-cache-max-age 60s --allow-non-empty创建服务:
// 安装nssm winget install nssm // 创建服务 nssm install rclone配置信息(具体路径需要根据实际情况来确定):
Path: C:UsersAdministratorDocumentsbinrclone.exe Arguments: mount config:/root A: --volname sftp --config C:UsersAdministratorAppDataRoamingrclonerclone.conf遇到的问题
1. 无法修改文件
是因为nssm默认使用LocalSystem用户。
任务管理器-服务-右键rclone选择打开服务->找到rclone右键选择属性->登录->选择此账户->点击右侧浏览->弹出框中选择高级->立即查找->选择一个本地账户比如Adminstrator->一路确定。
-
MySQL多层级树形结构表的搜索查询优化
业务中有思维导图的功能,涉及到大量的树形结构搜索、查询相关的功能,使用场景上查询量远高于增删改操作,记录一下当前的解决方案。
一、表结构
简化的表结构类似
create table nodes ( id int primary key auto_increment, name varchar(255) not null default '' comment '节点名称', parent_id int not null default 0 comment '上级节点', index nodes_parent_id_index (parent_id), index nodes_name_index (name) );二、当前解决方案
更新表结构:
-- 添加字段 alter table nodes add column path text not null comment '节点路径'; -- 创建索引 create index nodes_path_index on nodes(path); -- 更新历史数据 update nodes current left join nodes parent on current.parent_id = parent.id set path = ifnull(concat(parent.path, ',', current.parent_id), '0'); -- 插入更新后执行 update nodes current left join nodes parent on current.parent_id = parent.id set path = ifnull(concat(parent.path, ',', current.parent_id), '0'); where current.id = 198; -- 级联删除 delete from nodes where id = 198; delete from nodes where (path like '0,5,198,%' and parent_id = 198);1. 查询ID为“5”的节点的所有子级、孙子级中name包含“搜索词”的记录
更新表后的查询方式:
-- 查询父级节点记录,获取到父级的path select * from nodes where id = 5; -- 通过父级path进行模糊查询 select * from nodes where (parent_id = 5 or path like '0,5,%') and name like '%搜索词%';可以创建一个触发器,在插入、修改数据时,更新子级的path。
2. 查询ID为“5”的节点的所有父级
-- 获取当前节点 select * from nodes where id = 5; -- 使用当前节点的path查询所有父级 select * from nodes where find_in_set(id, '0,5'); -- 或者也可以使用in select * from nodes where id in (5);因为有缓存,所以都尽量使用的简单查询,不使用缓存可以使用子查询。
-
7个高效的学习方法
1 建立思维导图
学习时,我们接收的信息不一定是成体系的,所以,最好能通过清晰的框架来筛选信息,避免无效信息的干扰。
你可以分为三个步骤来做:搭建框架、优化框架、填充框架。
建立适配自己的思维导图,让散乱的知识点各归其所,运用时就可以按“图”检索,快速调取。
2 用自己的语言叙述
初学的知识大多属于“短时记忆”。要想记得牢、记得久,需要经过充分的、有一定深度的加工,把“短时记忆”转化为“长时记忆”。
“加工”是指对知识点进行整合处理,关键在于,用自己的语言叙述出来,把需要记忆的知识点,用自己的语言逻辑和语言习惯连“点”成“线”,串成有逻辑的内容。
当你能用自己的语言,准确复述出需要记住的内容的时候,这些知识无形中已经转化成你自己的知识和经验。
3 记“少”不记“多”,由“少”再记“多”
记忆大段文字的诀窍在于,先选取最核心的那句话进行记忆,巩固扎实后再去记细节。
如果一味贪多,很容易导致当时全背下来了,可需要用时一紧张,忘记了前后顺序,然后像“多米诺骨牌效应”一般,整个儿“倒塌”。
要有取舍的勇气和决心。先记“少而精华”的核心主干,再逐渐添加“多而延展”的枝杈。
4 学会运用“番茄工作法”
手机的消息提示音、突然冒出来的念头、窗外的动静…… 这些都是学习路上的 “绊脚石”。“番茄工作法”就是帮你排除干扰、保持专注的好帮手。
具体做法很简单:把时间分成25分钟的学习时间和5分钟的休息时间,每半个小时为一个单位。完成4个单位后,可以休息15到30分钟,专注高效完成任务。
这种 “短时间专注 + 碎片化休息” 的模式,能让大脑始终保持高效运转,避免因长时间学习而产生的疲惫感。
5 提高“阅读附加值”
不少网友有这样的困惑:“阅读几百页甚至几千页的书,怎样将书本知识转化为自己的知识?”
一本书,阅读之前,是一本普普通通的印刷品。阅读之后,我们才能产生新联想和新感悟,于是就产生了“阅读附加值”。没有产生“阅读附加值”,就属于“无效阅读”和“微效阅读”。
阅读过程中,遇到能给自己启发的新观点、新知识,需要进行深度思考,把各类知识“串联”起来,由此及彼、深入开掘,力求有新的发现。
6 学会“换台”
学习的过程中,两个小时内始终学习同一门学科和两个小时内交替学习不同学科的知识,其中产生的效果可能是非常不一样的。
其实这个道理很好理解。好比健身,你今天的目的是练手臂线条,但是你不可能在一两个小时的时间里面做的全是关于训练手臂力量的器械。中间也会混杂着其它部位练习,来保证手臂肌肉有一个恢复的时间。
交替学习,通过对不同学科的切换,转换思维,保证的是让大脑有调整时间,进而提高学习效率。
7 调动积极情绪
当你能不带负面情绪地持续做某件事,当积累一定时间和取得一定成果后,自然就会对这件事产生兴趣。对读书学习产生兴趣的方法,就是每天拿出固定的一段时间,不带任何负面情绪地读书学习。
怀着愉悦的心情去学习,同时要明白:我们真正需要的知识,需要通过不断地艰难攀登来获取;我们真正需要的能力,需要通过不断地实践来锤炼;我们真正需要的经验,需要时间来检验。这一切不容易,但是当我们学有所成时,一切都很值得。
收藏自《人民日报》夜读(https://mp.weixin.qq.com/s/LwThqTathe2MNjAmhJKB6g)。