Hegwin.Me

Time doth transfix the flourish set on youth. And delves the parallels in beauty's brow.

Execute System Commands in Ruby

在Ruby中运行系统命令

There are several ways to invoke system commands in Ruby: 1. Backquotes `` or `%x()`, 2. The `system` method, 3. The `File` class, 4. The Open3 lib. The difference between backquotes and `%x()` and `system` is that: `system` only returns true/false; while `%x` returns the stdout of the command when the command execution succeeds, and an empty string `""` when...

Invoke System TTS in Ruby

利用Ruby调用TTS进行文本发声阅读

I want to make a small app where I give him a set of English words and he can randomly read out the words inside. The reason why I have such an idea is that when I was learning English, I wanted to find a word dictation app, but I couldn't find the right one, so I might as well...

Batch update file extensions in Linux

Linux批量修改文件扩展名

A colleague of mine organized several thousand pdf files and needed to perform some batch operations. After uploading to the server, only to find that the extensions inside are uppercase .PDF, some are lowercase .pdf. This brings some trouble, because we have a program on the server that only recognizes the lowercase extensions; The colleague is working with Windows OS,...