Update personal scripts

This commit is contained in:
Gabriel Arazas 2021-08-09 01:07:46 +08:00
parent 861bc01ac0
commit 5a429485ad
4 changed files with 12 additions and 8 deletions

View File

@ -9,6 +9,8 @@
# ```
# will open a search result page on Google and Arch Wiki
# TODO:
# - Make the config compatible to bangs database from Duckduckgo.
proc usage() {
cat <<HELP
bangs - a ripoff from Duckduckgo bangs, except
@ -102,13 +104,13 @@ if (len(ARGV) == 0) {
for i in @ARGV {
write -- $i | rg --quiet $bangs_format || {
push :search_query $i
append :search_query $i
continue
}
var bang = $(write -- $i | sed --regexp-extended --expression "s/^${bangs_prefix}//")
if (bang in bangs) {
push :valid_bangs $bang
append :valid_bangs $bang
warnf "%s will be used to search." $bang
} else {
warnf "%s is not found in the database." $bang

View File

@ -1,4 +1,5 @@
#!/usr/bin/env bash
#!/usr/bin/env nix-shell
#! nix-shell --pure -i bash -p mktemp wget gnused gawk rofi xclip libnotify
# Simply create a universal emoji selection list.
# The emoji list should be the following file:

View File

@ -1,9 +1,10 @@
#!/usr/bin/env oil
#!/usr/bin/env nix-shell
#! nix-shell -i oil -p coreutils sqlite unzip ripgrep jq file
# Convert a Newpipe database (assuming it was exported within the app) into OPML v2.
# Dependencies:
# * osh (oil shell) v0.8.5
# * osh (oil shell) v0.8.12
# * sqlite3 v3.34.0
# * unzip
# * ripgrep v12.1.1
@ -26,7 +27,7 @@ var NEWPIPE_DB_QUERY = "SELECT name, url, service_id, group_concat(tag, ',') AS
FROM subscriptions
LEFT JOIN feed_group_subscription_join AS subs_join
LEFT JOIN feed_group
ON subs_join.subscription_id = subscriptions.uid AND feed_group.uid = subs_join.group_id) GROUP BY name"
ON subs_join.subscription_id = subscriptions.uid AND feed_group.uid = subs_join.group_id) GROUP BY name ORDER BY name COLLATE NOCASE;"
# Print the beginning of the template.
cat <<OPML

View File

@ -164,7 +164,7 @@ proc prompt(msg, :out, prefix = ">> ") {
}
proc kebab-case(word) {
write -- $word | sed --regexp-extended --expression 's/./\L&/g' --expression 's/\s+/-/g' --expression 's/[^.a-z0-9-]//g' --expression 's/^-+|-+$//g' --expression 's/-+/-/g'
write -- $word | sed --regexp-extended --expression 's/./\L&/g' --expression 's/\s+/-/g' --expression 's/[^a-z0-9-]//g' --expression 's/^-+|-+$//g' --expression 's/-+/-/g'
}
test -f $audio_file || errorf '%s is not a regular file' $audio_file
@ -236,7 +236,7 @@ for index in @(seq $[chapter_len]) {
setvar has_error = true
}
push :job_queue ">&2 printf '[%d/%d] %s\\n' $[index] $[chapter_len] \"$[output_data['chapters'][index - 1]['title']]\" && ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index != chapter_len else ''] ${title_slug}/${filename}"
append :job_queue ">&2 printf '[%d/%d] %s\\n' $[index] $[chapter_len] \"$[output_data['chapters'][index - 1]['title']]\"; ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index != chapter_len else ''] ${title_slug}/${filename}"
}
if (has_error) { exit 1 }