blob: aeba80344da8ec9659fbd30b86a1aba41538fad0 (
plain)
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
|
The repository contains a collection of random scripts and short programs.
# Requirements
- Ruby 3 for Ruby scripts.
- For Haskell: The GHC compiler and cabal build system. The programs can be then
built and run with `cabal run program-name -- --options`.
# Contents
1. [7digital](#7digital)
2. [cross\_toolchain.rb](#cross_toolchainrb)
3. [rename.rb](#renamerb)
4. [pg\_jekyll.rb](#pg_jekyllrb)
5. [locopy](#locopy)
## 7digital
7digital sells digital music but they can't handle files with non-English names.
`7digital` takes 2 arguments, a zip archive with audio files and a target
directory. It extracts the archive into the directory and renames its contents
according to the meta information saved in the audio files. The audo file format
is "{2-digit track number} - {song title}.{extension}". Each file is put into
a subdirectory named after the album.
## cross\_toolchain.rb
`bin/cross_toolchain.rb` builds a cross toolchain for 32-bit RISC-V (G). The
script should work on Mac OS with preinstalled GNU tools and case-sensitive file
system and Linux. The resulting GCC is to be found in
`./tmp/rootfs/bin/riscv32-unknown-linux-gnu-*`.
## rename.rb
Changes the extension of all files matching a pattern in the given directory.
Call the `rename.rb` without arguments to see the usage information and an
example.
## pg\_jekyll.rb
This script was used to migrate blog posts from a PostgreSQL database to a
static site generator in Jekyll-like format. `pg_jekyll.rb` cannot be used as
is: the query and columns should be adjusted for a concrete case, but it can
be a starting point and example for such a migration. Also it expects
environment variables `USER` and `DBNAME` to be present in the environment.
Pages are written into the `posts/` directory. A column named `slug` is used
for the name with `.html` extension.
## locopy
locopy updates Wordpress `siteurl` and `home` options and sets them to
some address, so that the Wordpress instance can run locally.
locopy reads Wordpress database configuration from the `wp-config.php` that
it should be able to find. Invokation example:
```sh
locopy wordpress --root /path/to/wordpress --siteurl "http://localhost:8083"
```
|