Total Pageviews

Monday, 3 February 2025

三首极美的古诗,唯美了整个春天


时光倏忽,一个转身,春天已经走来了。

冬渐尽,春已归。早春的天气,乍暖还寒,虽有些寒凉,但已不似冬日那般凛冽。

徐徐的春风中透着些许暖意,河畔的柳条也悄悄吐出嫩芽,渐渐有了春天的模样。

在这宜人的季节里,品读三首春天古诗,在诗意中体味早春的美好。

01


诗家清景在新春,绿柳才黄半未匀。

若待上林花似锦,出门俱是看花人。

唐·杨巨源《城东早春》

早春时节,杨巨源来到城东游赏。

眼前,绿柳吐出嫩芽,枝头的鹅黄新绿悄然展开,色泽尚未完全均匀。如此佳景,怎能不让人心生喜悦呢?

杨巨源不禁发出赞叹,这如诗如画的早春景致,正是诗人的最爱。

相比仲春百花齐放、游人如织的热闹,早春的宁静与清新显得难能可贵。少了些喧嚣,多了几分恬静与安逸。

杨巨源这首《城东早春》真是极美,深浅相得,浓淡相宜,美的恰到好处。

02

问春从此去,几日到秦原。

凭寄还乡梦,殷勤入故园。

唐·柳宗元《零陵早春》

这是柳宗元被贬永州时,写下的一首春日思乡诗。

柳宗元生于长安,长于长安,长安有他的回忆,有他的故园,有他温暖的家,还有他的理想。

诗题是早春,诗人却说春天正从此地离开,前往长安,那样从容,那么斑斓。

他想借春风捎去思念,希望春意里的生气盎然,把春的希望与生机带回故乡。

全诗深曲委婉,意味深长。诗中的“梦”字,点出了诗人还乡之心切、思乡之浓烈。“殷勤”二字,道出了诗人对于故乡的深情厚意。

03


雪散因和气,冰开得暖光。

春销不得处,唯有鬓边霜。

唐·白居易《早春》

春日温度渐暖,和风消融了冰雪,温暖了河水。阳光洒在刚刚解冻的河面上,闪烁着温暖的光泽。

然而,在如此温馨的景致中,白居易却心生郁闷。春风所化的不过是田园冰霜,而年华渐老,双鬓结下的“秋霜”又怎能轻易清除呢?

冬去春来,四季更替,总容易感叹光阴如水。转眼间,又添一岁,又多了几根白发,而功名与抱负似乎依旧遥不可及。

苏轼曾说:“休对故人思故国,且将新火试新茶。诗酒趁年华。”

与其怀旧,郁郁不得志,不如怜惜眼前,过好当下,方不负春光,不负春天。


 

 

Sunday, 2 February 2025

笑脸

 

Wagtail_Blog

 A wordpress like blog app implemented in wagtail. Please open issues and merge requests only in gitlab.

gitlab.com/thelabnyc/wagtail_blog/

pipeline status

A WordPress-like blog app implemented in Wagtail.

What is it

After reimplementing WordPress-like blogs over and over again in Wagtail I decided to just make this. Feel free to use as is or copy it as a starting point. It's based on the Wagtail demo blog but is closer to a standard WordPress blog style.

This is a starting point for your wagtail based blog, especially if you are migrating from Wordpress. It's not Wordpress and it's not drop in. You are expected to add your own templates and are given on a skeleton template to start from.

Features

  • Categories and tags with views
  • RSS
  • Basic starter templates with pagination
  • Comments
  • WordPress importer

Installation

You should start with a existing wagtail django project and have a basic understanding of Wagtail before starting. See http://docs.wagtail.io

Tested with Wagtail 2.x and Django 2.2.

  1. pip install wagtail-blog
  2. Add blog to INSTALLED_APPS
  3. Add url(r'^blog/', include('blog.urls', namespace="blog")), to urls.py
  4. python manage.py migrate
  5. Override templates as needed.

Extending

Wagtail blog features abstract base models. If you want to change functionality you may extend this models from blog.abstract and use them how you'd like. Do not add blog to your INSTALLED_APPS if you do this. You'll need to create your own logic to gather context variables. See blog/models.py for an example of this. Wagtail blog doesn't support any way to "drop in" the blog app and just make minor changes to models.

Settings

  • BLOG_PAGINATION_PER_PAGE (Default 10) Set to change the number of blogs per page. Set to None to disable (useful if using your own pagination implementation).
  • BLOG_LIMIT_AUTHOR_CHOICES_GROUP Optionally set this to limit the author field choices based on this Django Group. Otherwise it defaults to check if user is_staff. Set to a tuple to allow multiple groups.
  • BLOG_LIMIT_AUTHOR_CHOICES_ADMIN Set to true if limiting authors to multiple groups and want to add is_staff users as well.

Import from WordPress

The v2 API is the recommended way to import. It has a cleaner, more recent implementation that is easy to extend as needed. The v1 API and xml import use an older, less maintained, codebase and are kept here just in case they are useful to anyone.

Wordpress API v2

This method works with any reasonably modern Wordpress instance and requires no changes to Wordpress and no authentication is needed. It's tested in both wordpress.com and privately hosted Wordpress instances.

Usage

Use the Django management command import_wordpress and provide the slug of the Blog Index Page you wish to add the pages to. For example if you made a Blog Index Page called "blog" and wanted to import my personal wordpress.com hosted blog run:

./manage.py import_wordpress blog --url=https://public-api.wordpress.com/wp/v2/sites/davidmburke.com

Notice the special wordpress.com url schema. For a private wordpress instance it would typically look like https://example.com/wp-json/wp/v2 instead.

Optional Arguments

  • --convert-images (False) set to True to attempt converting images to Wagtail Image objects. Requires beautifulsoup4.
  • --create-users (False) set to True to create new users out of authors.

Extending

See wordpress_import.py. This project can't predict how you host images or implement comments. It's intended to be modified to suit your project's needs.

JSON API Import

Legacy feature

The import feature requires django-contrib-comments and django-comments-xtd

  1. Enable WordPress JSON API
  2. Create a Blog index page and note the title. Let's pretend my blog index page title is "blog"
  3. Run ./manage.py wordpress_to_wagtail blog --url=http://myblog.com username password the username is your WordPress username with full access to the API. Without this you can't access all blog posts.

This works by getting the json data for your posts and making Wagtail pages for them. It then downloads any images it finds and replaces urls to use your site instead of an external site. Blog authors will become Django users. This is a complex process and is prone to error. You should plan to review the import code and fix some issues. Merge requests welcome to improve this feature.

XML file import

Legacy feature

  1. Create a WordPress XML dump by selecting "export" from the "Tools" section of the WordPress admin page.
  2. Create a Blog index page and note the title. Let's pretend my blog index page title is "blog"
  3. Run ./manage.py wordpress_to_wagtail blog --xml=export.xml where export.xml is the XML export file from your source WordPress site.

The xml importer uses the lxml library.

This feature was tested on wordpress XML exports from exactly a few sites. Like the import procedure above, this process is complex and prone to error.

Comments

django-comments-xtd comments work out of the box. Just install it as directed here. Customizing the xtd comment templates should be all you need - but feel free to review this app's templates which you may want to override.

Feel free to contribute other comment implementations.

from https://github.com/thelabnyc/wagtail_blog

ffmpeg压缩视频的命令

ffmpeg -i input.mp4 -s 960x720 -b:v 1M -r 20 out.mp4

Saturday, 1 February 2025

car secrets

 

搭建基于github issue的静态博客程序issueblog

首先fork此项目https://github.com/impasse/IssueBlog,我fork后的项目地址是https://github.com/briteming/iib。然后访问https://github.com/briteming/iib/settings,勾选issues. 然后,新建一些issues. 然后编辑const.js - https://github.com/briteming/iib/blob/master/src/const.js,把owner和repo的值分别改为你的github用户名和仓库名。

访问https://github.com/briteming/iib/blob/master/src/model.js,把第21行,37行,61行,64行的${owner}和${repo}分别替换为你的github用户名和仓库名。

然后访问https://app.netlify.com/,点击页面右上角的add new site, 在弹出的下拉菜单中,选择

importing an existing project.


得到的网站里面的帖子的地址,你是无法直接访问的。”(即无法在新开的 tab 里面访问),解决办法:

在 app.netlify.com 网站,来到添加 build命令那一栏时,添加命令:
npm run build && cd dist && echo '/* /index.html 200' > _redirects

点击页面底部的deploy按钮,等待部署完成,部署完成后,我得到网址https://iib-2.netlify.app/ 。现在,即可直接访问帖子的 网址了,比如https://iib-2.netlify.app/post/12

我重新部署一遍,在获得的新网址https://iib-2.netlify.app/ 里,解决了问题。

https://iib.netlify.app/ 有办法设置直接访问其帖子的网址:

访问https://app.netlify.com/sites/iib/configuration/deploys ,点击configure按钮,在

build command那一栏,输入:npm run build && cd dist && echo '/* /index.html 200' > _redirects  

然后点击save.然后访问https://app.netlify.com/sites/iib/deploys ,点击页面右边的 trigger

deploy-> deploy site ,   等待(重新)部署完成,部署完成后,就可以直接访问网站

https://iib.netlify.app/里面的帖子的网址了,比如https://iib.netlify.app/post/13

 

netspeeder, 翻墙辅助工具

 https://github.com/impasse/netspeeder

https://github.com/briteming/netspeeder