Total Pageviews

Sunday, 2 June 2024

考进清北 相当于科举的哪一层


今天考进清华北大,难度上相当于古代科举的哪一层呢?

先说科举的爬级之路吧,首先你得家境优渥,古代的务农率是90%左右,脱产读书的人口只有不到5%,你若投胎不好这一关就过不去。

读了书第一关是考童试,而童试又分县试、府试、院试三层,逐渐闯关,最后成功的话你就获得秀才称号。我在科举博物馆看过数据,秀才的录取率只有1-2%,百中取一。所以我们别看电视剧里只要会识字的就叫秀才,其实很不容易,差不多2000个人里,才有1个秀才,妥妥的地方学霸。

秀才有少量补贴,可免2个男丁的徭役,公堂上不用跪,不会被用刑。

考上秀才后可以参加每3年一次的乡试,通过,则为举人。通过率也很低,根据年份不同在1-3%左右,换算一下就是每10-20万人里才会出一个举人。其实从难度上来说,这就和考上清华北大的难度很接近了,因为清北每年招6000人左右,万分之0.6的录取率,但高考是每年都考的。

举人有国家津贴,还能免上百亩地税,已经可以算是统治阶级。

举人再往上就是会试,进京赶考,3年一届,每次录取100-200人,通过则为进士。这100-200进士最后要到皇上面前再考一次,前三名就是中国人最熟悉的状元/榜眼/探花。

考到进士那已经是学霸中的学霸,混的好的进翰林院,混中央,以后有机会入阁拜相,混的差也是外放县令,相当于县委书记。

我觉得清华北大毕业生的平均水平大概是比不过的.

相关帖子:中国的科举制度的人才等级

用ffmpeg合并多个音频


  1. 创建一个文本文件,列出要合并的音频文件。例如,如果要合并名为“audio1.mp3”、“audio2.mp3”和“audio3.mp3”的文件,可以在文本文件中写入以下内容:
file 'audio1.mp3'
file 'audio2.mp3'
file 'audio3.mp3'
把文本文件保存为 input.txt 

注意:文件名和路径应该根据实际情况进行修改。

  1. 使用“concatenate”功能合并音频。使用以下命令:
ffmpeg -f concat -safe 0 -i input.txt -c copy output.mp3

其中,“-f concat”表示使用concat协议进行合并,-safe 0表示禁用安全检查,-i input.txt表示输入要合并的文件列表,-c copy表示复制原始编解码器,output.mp3表示输出文件名。

完成以上步骤后,多个mp3文件将被合并到一个新的MP3文件中。

注意:在实际使用中,可能需要根据实际情况进行调整。

ref: https://juejin.cn/post/7224125445272076325

--------------------------------------------------------------------------------

基础命令:

1.将xxx.amr转成xxx.mp3:

ffmpeg -i xxx.amr xxx.mp3


2.多个音频拼接为一个:

ffmpeg -i "concat:xxx1.mp3|xxx2.mp3|xxx3.mp3" -acodec copy xxx4.mp3

解释:

-i代表输入参数

contact:xxx1.mp3|xxx2.mp3|xxx3.mp3 代表着需要连接到一起的音频文件

-acodec copy xxx4.mp3 重新编码并复制到新文件xxx4.mp3中


3.多个合成为一个,比如给某用户录音添加背景音乐

ffmpeg -i xxx.mp3 -i xxxbg1.mp3 -i xxxbg2.mp3 -filter_complex amix=inputs=3:duration=first:dropout_transition=2 xxxsave.mp3

解释:

-i代表输入参数

-filter_complex ffmpeg滤镜功能

amix是混合多个音频到单个音频输出

inputs=3代表是3个音频文件,如果更多则代表对应数字

duration 确定最终输出文件的长度

longest(最长)|shortest(最短)|first(第一个文件)

dropout_transition

The transition time, in seconds, for volume renormalization when an input stream ends. The default value is 2 seconds.

-f mp3  输出文件格式

xxxsave.mp3 保存文件


在代码中使用(这里演示的为php的用法):

$amr = $dirname.$filename;   源文件路径

$mp3 = $dirname.$name.'_wgc.mp3'; 保存路径

$command = "/usr/local/bin/ffmpeg -i $amr $mp3";

system($command,$error);


返回结果:

成功返回0,

失败(命令不存在等原因) 返回 非0值


安装方法:

window:

        先去官网下载window版的ffmpeg, 把bin目录放到环境变量中,然后cmd,具体使用命令请自行百度

linux(centos),一般情况可以跳过: 

         安装依赖包

yum install -y automake autoconf libtool gcc gcc-c++

        创建编译源码的目录

mkdir ~/ffmpeg_sources


编译&安装

Note: 如果您不需要特定的编码器,可以跳过相关部分,然后删除编译ffmpeg 时相应的./configure选项。例如,如果不需要libvorbis ,可以跳过这一节,然后从安装ffmpeg的部分去掉--enable-libvorbis


yasm:汇编器,新版本的ffmpeg增加了汇编代码

wget http://www.tortall.net/projects/yasm/releases/yasm-1.3.0.tar.gz 

tar -xzvf yasm-1.3.0.tar.gz 

cd yasm-1.3.0 && ./configure && make && make install


lame:Mp3音频解码

wget http://jaist.dl.sourceforge.net/project/lame/lame/3.99/lame-3.99.5.tar.gz 

tar -xzvf lame-3.99.5.tar.gz 

cd lame-3.99.5 && ./configure && make && make install


amr支持

wget http://downloads.sourceforge.net/project/opencore-amr/opencore-amr/opencore-amr-0.1.3.tar.gz 

tar -xzvf opencore-amr-0.1.3.tar.gz 

cd opencore-amr-0.1.3 && ./configure && make && make install


amrnb支持

wget http://www.penguin.cz/~utx/ftp/amr/amrnb-11.0.0.0.tar.bz2 

tar -xjvf amrnb-11.0.0.0.tar.bz2 

cd amrnb-11.0.0.0 && ./configure && make && make install


amrwb支持

wget http://www.penguin.cz/~utx/ftp/amr/amrwb-11.0.0.0.tar.bz2 

tar -xjvf amrwb-11.0.0.0.tar.bz2 

cd amrwb-11.0.0.0 && ./configure && make && make install


x264


git clone https://code.videolan.org/videolan/x264.git

// 假设装在 xxx 目录下

 ./configure --disable-asm --enable-shared --enable-static --prefix=xxx

make && make install

// 然后在 xxx/share 下建一个 x264 目录,把 x264 源码目录下的 x264.pc 拷到 xxx/share/x264 下

export PKG_CONFIG_PATH=xxx/share/x264  

如上操作需要注意安装目录哦,如果需要安装其他特定的编码器可以自行百度然后编译ffmpeg时加入相应的./configure选项##

###如果需要安装其他特定的编码器可以自行百度然后编译ffmpeg时加入相应的./configure选项


ffmpeg: 最好去官网下载最新的安装包 FFmpeg 使用最新版注意命令操作名称

wget https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2

tar -xjvf ffmpeg-4.1.tar.bz2

cd ffmpeg-4.1

./configure --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-version3 -enable-shared --enable-libx264  --enable-gpl

make && make install

加载配置,最后写入config后,终端运行ffmpeg命令,出现success和已安装的扩展,则运行成功。

ldconfig


附录:

ffmpeg默认安装目录为“/usr/local/lib”,有些64位系统下软件目录则为“/usr/lib64”,编译过程中可能会出现 

“ffmpeg: error while loading shared libraries: libmp3lame.so.0: cannot open shared object file: No such file or directory”等类似的错误,

解决办法是建立软链接:

ln -s /usr/local/lib/libmp3lame.so.0.0.0 /usr/lib64/libmp3lame.so.0


Saturday, 1 June 2024

fyne

Easily build native apps that work everywhere.

An easy to learn toolkit for creating graphical apps for desktop, mobile and web.
Code once and build native apps for all platforms and stores. 

If you can't wait to start building your first Fyne app, you should follow our getting started guide.

If you are new to the Go language, we recommend running through the Go tour before returning to the Fyne documentation.

For developers who prefer to learn from videos we have a collection of getting started tutorials on YouTube.

Features of Fyne

Quality and Design

Built with the best design, test and validation procedures we aim for the highest level of standard in quality and design. All apps should be clear and simple to use and never fail to meet user expectations.

Simple Development

For developers with any experience level - our toolkit is designed with ease of development in mind. We want you to enjoy building great apps with Fyne!

We Love Usability

The Fyne framework is designed for usability at the core. Fyne widgets and layouts adapt cleanly to the user context allowing developers to focus on functionality and not user interface testing.

Easy to install

Fyne apps work with a simple download - no worries about packages or dependencies. Our app explorer will help you find the latest apps, keep everything up to date and stay secure.

from https://fyne.io/

AynaLivePlayer


Bilibili Audio Bot. Written by Golang.

build

go build -o AynaLivePlayer.exe -ldflags -H=windowsgui app/gui/main.go

packaging

fyne package --src path_to_gui --exe AynaLivePlayer.exe --appVersion 0.8.4 --icon path_to_icon

Windows build guide

  1. install golang link
  2. install chocolatey link
  3. install required packages
choco install git
choco install mingw
  1. install fyne
go install fyne.io/fyne/v2/cmd/fyne@latest
  1. clone this repo
git clone --recurse-submodules git@github.com:AynaLivePlayer/AynaLivePlayer.git

if you are using https links

git clone https://github.com/AynaLivePlayer/AynaLivePlayer.git
git submodule set-url pkg/miaosic https://github.com/AynaLivePlayer/miaosic.git
git submodule set-url pkg/liveroom-sdk https://github.com/AynaLivePlayer/liveroom-sdk.git
git submodule update
  1. now you can build (please check makefile for more details)
$env:CGO_LDFLAGS="-LC:\Users\vboxuser\Desktop\AynaLivePlayer\libmpv\lib"
$env:CGO_CFLAGS="-IC:\Users\vboxuser\Desktop\AynaLivePlayer\libmpv\include"
# ... more setup, see makefile
go build -o AynaLivePlayer -ldflags -H=windowsgui app/main.go
from https://github.com/AynaLivePlayer/AynaLivePlayer 

Chatbot-UI


AI chat for every model.

chatbotui.com

The open-source AI chat app for everyone.

Chatbot UI

Demo

View the latest demo here.

Updates

Hey everyone! I've heard your feedback and am working hard on a big update.

Things like simpler deployment, better backend compatibility, and improved mobile layouts are on their way.

Official Hosted Version

Use Chatbot UI without having to host it yourself!

Find the official hosted version of Chatbot UI here.

Updating

In your terminal at the root of your local Chatbot UI repository, run:

npm run update

If you run a hosted instance you'll also need to run:

npm run db-push

to apply the latest migrations to your live database.

Local Quickstart

Follow these steps to get your own Chatbot UI instance running locally.

You can watch the full video tutorial here.

1. Clone the Repo

git clone https://github.com/mckaywrigley/chatbot-ui

2. Install Dependencies

Open a terminal in the root directory of your local Chatbot UI repository and run:

npm install

3. Install Supabase & Run Locally

Why Supabase?

Previously, we used local browser storage to store data. However, this was not a good solution for a few reasons:

  • Security issues
  • Limited storage
  • Limits multi-modal use cases

We now use Supabase because it's easy to use, it's open-source, it's Postgres, and it has a free tier for hosted instances.

We will support other providers in the future to give you more options.

1. Install Docker

You will need to install Docker to run Supabase locally. You can download it here for free.

2. Install Supabase CLI

MacOS/Linux

brew install supabase/tap/supabase

Windows

scoop bucket add supabase https://github.com/supabase/scoop-bucket.git
scoop install supabase

3. Start Supabase

In your terminal at the root of your local Chatbot UI repository, run:

supabase start

4. Fill in Secrets

1. Environment Variables

In your terminal at the root of your local Chatbot UI repository, run:

cp .env.local.example .env.local

Get the required values by running:

supabase status

Note: Use API URL from supabase status for NEXT_PUBLIC_SUPABASE_URL

Now go to your .env.local file and fill in the values.

If the environment variable is set, it will disable the input in the user settings.

2. SQL Setup

In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:

  • project_url (line 53): http://supabase_kong_chatbotui:8000 (default) can remain unchanged if you don't change your project_id in the config.toml file
  • service_role_key (line 54): You got this value from running supabase status

This prevents issues with storage files not being deleted properly.

5. Install Ollama (optional for local models)

Follow the instructions here.

6. Run app locally

In your terminal at the root of your local Chatbot UI repository, run:

npm run chat

Your local instance of Chatbot UI should now be running at http://localhost:3000. Be sure to use a compatible node version (i.e. v18).

You can view your backend GUI at http://localhost:54323/project/default/editor.

Hosted Quickstart

Follow these steps to get your own Chatbot UI instance running in the cloud.

Video tutorial coming soon.

1. Follow Local Quickstart

Repeat steps 1-4 in "Local Quickstart" above.

You will want separate repositories for your local and hosted instances.

Create a new repository for your hosted instance of Chatbot UI on GitHub and push your code to it.

2. Setup Backend with Supabase

1.) Create a new project

Go to Supabase and create a new project.

2. )Get Project Values

Once you are in the project dashboard, click on the "Project Settings" icon tab on the far bottom left.

Here you will get the values for the following environment variables:

  • Project Ref: Found in "General settings" as "Reference ID"

  • Project ID: Found in the URL of your project dashboard (Ex: https://supabase.com/dashboard/project/<YOUR_PROJECT_ID>/settings/general)

While still in "Settings" click on the "API" text tab on the left.

Here you will get the values for the following environment variables:

  • Project URL: Found in "API Settings" as "Project URL"

  • Anon key: Found in "Project API keys" as "anon public"

  • Service role key: Found in "Project API keys" as "service_role" (Reminder: Treat this like a password!)

3. )Configure Auth

Next, click on the "Authentication" icon tab on the far left.

In the text tabs, click on "Providers" and make sure "Email" is enabled.

We recommend turning off "Confirm email" for your own personal instance.

4. )Connect to Hosted DB

Open up your repository for your hosted instance of Chatbot UI.

In the 1st migration file supabase/migrations/20240108234540_setup.sql you will need to replace 2 values with the values you got above:

  • project_url (line 53): Use the Project URL value from above
  • service_role_key (line 54): Use the Service role key value from above

Now, open a terminal in the root directory of your local Chatbot UI repository. We will execute a few commands here.

Login to Supabase by running:

supabase login

Next, link your project by running the following command with the "Project ID" you got above:

supabase link --project-ref <project-id>

Your project should now be linked.

Finally, push your database to Supabase by running:

supabase db push

Your hosted database should now be set up!

Setup Frontend with Vercel

Go to Vercel and create a new project.

In the setup page, import your GitHub repository for your hosted instance of Chatbot UI. Within the project Settings, in the "Build & Development Settings" section, switch Framework Preset to "Next.js".

In environment variables, add the following from the values you got above:

  • NEXT_PUBLIC_SUPABASE_URL
  • NEXT_PUBLIC_SUPABASE_ANON_KEY
  • SUPABASE_SERVICE_ROLE_KEY
  • NEXT_PUBLIC_OLLAMA_URL (only needed when using local Ollama models; default: http://localhost:11434)

You can also add API keys as environment variables.

  • OPENAI_API_KEY
  • AZURE_OPENAI_API_KEY
  • AZURE_OPENAI_ENDPOINT
  • AZURE_GPT_45_VISION_NAME

For the full list of environment variables, refer to the '.env.local.example' file. If the environment variables are set for API keys, it will disable the input in the user settings.

Click "Deploy" and wait for your frontend to deploy.

Once deployed, you should be able to use your hosted instance of Chatbot UI via the URL Vercel gives you.

from https://github.com/mckaywrigley/chatbot-ui

 

 

 

d2l-zh

《动手学深度学习》:面向中文读者、能运行、可讨论。中英文版被70多个国家的500多所大学用于教学。

zh.d2l.ai

动手学深度学习(Dive into Deep Learning,D2L.ai)

第二版:zh.D2L.ai | 第一版:zh-v1.D2L.ai | 安装和使用书中源代码: 第二版 第一版

理解深度学习的最佳方法是学以致用。

本开源项目代表了我们的一种尝试:我们将教给读者概念、背景知识和代码;我们将在同一个地方阐述剖析问题所需的批判性思维、解决问题所需的数学知识,以及实现解决方案所需的工程技能。

我们的目标是创建一个为实现以下目标的统一资源:

  1. 所有人均可在网上免费获取;
  2. 提供足够的技术深度,从而帮助读者实际成为深度学习应用科学家:既理解数学原理,又能够实现并不断改进方法;
  3. 包含可运行的代码,为读者展示如何在实际中解决问题。这样不仅直接将数学公式对应成实际代码,而且可以修改代码、观察结果并及时获取经验;
  4. 允许我们和整个社区不断快速迭代内容,从而紧跟仍在高速发展的深度学习领域;
  5. 由包含有关技术细节问答的论坛作为补充,使大家可以相互答疑并交换经验。

本书的英文版

虽然纸质书已出版,但深度学习领域依然在迅速发展。为了得到来自更广泛的英文开源社区的帮助,从而提升本书质量,本书的新版将继续用英文编写,并搬回中文版。

欢迎关注本书的英文开源项目。

中英文教学资源

加州大学伯克利分校 2019 年春学期 Introduction to Deep Learning 课程教材(同时提供含教学视频地址的中文版课件)。

学术界推荐

"Dive into this book if you want to dive into deep learning!"

— 韩家炜,ACM 院士、IEEE 院士,美国伊利诺伊大学香槟分校计算机系 Michael Aiken Chair 教授

"This is a highly welcome addition to the machine learning literature."

— Bernhard Schölkopf,ACM 院士、德国国家科学院院士,德国马克斯•普朗克研究所智能系统院院长

"书中代码可谓‘所学即所用’。"

— 周志华,ACM 院士、IEEE 院士、AAAS 院士,南京大学计算机科学与技术系主任

"这本书可以帮助深度学习实践者快速提升自己的能力。"

— 张潼,ASA 院士、IMS 院士,香港科技大学计算机系和数学系教授

工业界推荐

"一本优秀的深度学习教材,值得任何想了解深度学习何以引爆人工智能革命的人关注。"

— 黄仁勋,NVIDIA创始人 & CEO

"《动手学深度学习》是最适合工业界研发工程师学习的。我毫无保留地向广大的读者们强烈推荐。"

— 余凯,地平线公司创始人 & CEO

"强烈推荐这本书!我特别赞赏这种手脑一体的学习方式。"

— 漆远,复旦大学“浩清”教授、人工智能创新与产业研究院院长

"《动手学深度学习》是一本很容易让学习者上瘾的书。"

— 沈强,将门创投创始合伙人

贡献

感谢社区贡献者们为每一位读者改进这本开源书。

from  https://github.com/d2l-ai/d2l-zh

 

 

cross-stap-build

 Cross-compile Systemtap scripts.

Docker environment for simple cross-compiling Systemtap scripts.

Build

# docker build -t csb .

Example

# docker run -v /host/shared:/shared:rw csb -a arm -k /shared/arm-kernel-tree /shared/script.stp

Supported architectures

  • x86_64
  • i386
  • arm
  • aarch64
  • mips

Custom changes

  • SystemTap patch for undefined syscalls (arm).
  • Usage of debian-patched elfutils (elfutils upstream misses mips support).

Cross-compilation toolchains

Project uses following toolchains from toolchains.bootlin.com:

from https://github.com/danielpoliakov/cross-stap-build