mirror of
https://github.com/foo-dogsquared/dotfiles.git
synced 2025-01-30 22:57:54 +00:00
Update personal scripts again
This commit is contained in:
parent
1cf031e170
commit
cb091a5128
@ -18363,6 +18363,10 @@
|
||||
"name": "GitHub",
|
||||
"url": "https://github.com/search?utf8=%E2%9C%93&q={{{s}}}"
|
||||
},
|
||||
"gha": {
|
||||
"name": "GitHub Actions",
|
||||
"url": "https://github.com/marketplace?type=actions&query={{{s}}}"
|
||||
},
|
||||
"ghacks": {
|
||||
"name": "Ghacks",
|
||||
"url": "https://www.ghacks.net/?s={{{s}}}"
|
||||
@ -29837,7 +29841,7 @@
|
||||
},
|
||||
"melpa": {
|
||||
"name": "MELPA",
|
||||
"url": "http://melpa.milkbox.net/#/?q={{{s}}}"
|
||||
"url": "http://melpa.org/#/?q={{{s}}}"
|
||||
},
|
||||
"melvyl": {
|
||||
"name": "Melvyl Catalog (University of California Libraries)",
|
||||
@ -41975,6 +41979,10 @@
|
||||
"name": "Shutterstock",
|
||||
"url": "http://www.shutterstock.com/cat.mhtml?searchterm={{{s}}}"
|
||||
},
|
||||
"swh": {
|
||||
"name": "Software Heritage",
|
||||
"url": "https://archive.softwareheritage.org/browse/search/?q={{{s}}}&with_visit=true&with_content=true"
|
||||
},
|
||||
"shz": {
|
||||
"name": "Shazam",
|
||||
"url": "http://www.shazam.com/de/search/{{{s}}}"
|
||||
|
36
bin/bangs
36
bin/bangs
@ -5,12 +5,37 @@
|
||||
|
||||
# Examples:
|
||||
# ```
|
||||
# bangs hello there !g !aw
|
||||
# bangs hello there ~g ~aw
|
||||
# ```
|
||||
# will open a search result page on Google and Arch Wiki
|
||||
|
||||
proc usage() {
|
||||
cat <<HELP
|
||||
bangs - a ripoff from Duckduckgo bangs, except
|
||||
you can open multiple pages in one go.
|
||||
|
||||
Usage:
|
||||
bangs [SEARCH_QUERY...] [BANGS...]
|
||||
|
||||
A bang is absolutely necessary to indicate what search pages
|
||||
to open.
|
||||
|
||||
While there is a default config, you should create your own list
|
||||
by setting a config file at '\${XDG_CONFIG_HOME}/bangs/config.json'.
|
||||
The config is simply a JSON file with the bang as the key and an
|
||||
object with 'url' and 'name'.
|
||||
|
||||
Examples:
|
||||
- Google and Duckduckgo search
|
||||
bangs hello world ~g ~ddg
|
||||
|
||||
- Change the bangs prefix
|
||||
BANGS_PREFIX="--" bangs how to program in python --g --yt
|
||||
HELP
|
||||
}
|
||||
|
||||
# These are the default bangs available.
|
||||
# Bangs are alphanumeric keys that shouldn't have whitespace characters.
|
||||
# Bangs are any keys that shouldn't have whitespace characters.
|
||||
const config_dir = "${XDG_CONFIG_HOME:-"$HOME/.config"}/bangs"
|
||||
const config_file = "${config_dir}/config.json"
|
||||
const default_config = {
|
||||
@ -38,7 +63,7 @@ const default_config = {
|
||||
|
||||
const bangs_prefix = "${BANGS_PREFIX:-~}"
|
||||
const bangs_placeholder = "${BANGS_PLACEHOLDER:-{{{s}}}}"
|
||||
const bangs_format = / %start $bangs_prefix word+ %end /
|
||||
const bangs_format = / %start $bangs_prefix !space+ %end /
|
||||
const valid_bangs = %()
|
||||
const search_query = %()
|
||||
if test -f $config_file {
|
||||
@ -67,6 +92,11 @@ proc warnf(format, @msg) {
|
||||
>&2 printf "$format\\n" @msg
|
||||
}
|
||||
|
||||
if (len(ARGV) == 0) {
|
||||
usage
|
||||
exit 0
|
||||
}
|
||||
|
||||
for i in @ARGV {
|
||||
write -- $i | rg --quiet $bangs_format || {
|
||||
push :search_query $i
|
||||
|
@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell --pure -i bash -p curl jq fzf coreutils findutils iputils
|
||||
#! nix-shell --pure -i bash -p curl jq fzf coreutils findutils iputils cacert
|
||||
|
||||
# A quick command line interface for creating a gitignore with the API from https://gitignore.io.
|
||||
# This script comes with a simple caching to avoid creating too much requests.
|
||||
@ -11,7 +11,7 @@ CACHE_FILE="${XDG_CACHE_DIR:-$HOME/.cache}/gitignore-io.langs.json"
|
||||
# Check if the language list is downloaded for the last hour (3600 seconds).
|
||||
if [[ ! -e $CACHE_FILE ]] || test $(expr $(date "+%s") - $(date -r $CACHE_FILE "+%s")) -gt 3600
|
||||
then
|
||||
ping -q -c 4 "gitignore.io" && curl --silent --location "https://gitignore.io/api/list?format=json" --output $CACHE_FILE
|
||||
curl --silent --location --output $CACHE_FILE "https://gitignore.io/api/list?format=json"
|
||||
fi
|
||||
|
||||
KEYS=$(jq 'keys | .[] | @text' --raw-output $CACHE_FILE | fzf --multi | while read lang; do echo " .[\"$lang\"].contents"; done | paste -s -d ',')
|
||||
|
@ -232,7 +232,7 @@ for index in @(seq $[chapter_len]) {
|
||||
setvar has_error = true
|
||||
}
|
||||
|
||||
push :job_queue "ffmpeg -loglevel quiet -nostdin -i '${audio_file}' -ss ${start} $['-to ' + end if index != chapter_len else ''] ${title_slug}/${filename}"
|
||||
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}"
|
||||
}
|
||||
|
||||
if (has_error) { exit 1 }
|
||||
|
Loading…
Reference in New Issue
Block a user