<commit_before># Please set your SOUNDBOARD_CMD in your ~/.profile

alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'

findsounds(){
	cd $SOUNDBOARD_PATH
	find | grep -i "$@" |  sed -e 's/^\.\///'
	cd $cwd
}

soundboard() {
	test -z "$SOUNDBOARD_CMD"    && SOUNDBOARD_CMD="curl"
	test -z "$SOUNDBOARD_PREFIX" && SOUNDBOARD_PREFIX="localhost:8080/play/"
	cwd=$PWD
	debug "soundboard args: '$@'"
	if echo "$@" | grep '\.\(mp3\|wav\|mp4\)$'
	then
		debug "playing file directly"
		file="$@"
	elif test -d "$SOUNDBOARD_PATH"
	then
		debug "playing regex"
		file=`findsounds $@ | head -n 1`
		warn "unmatched files:"
		findsounds $@ | tail -n +2 | awk '{ print "   "$0}'
		warn ""
	else
		error "SOUNDBOARD_PATH:$SOUNDBOARD_PATH not found"
	fi
	file=`urlencode "$file"`
	warn "$SOUNDBOARD_CMD $SOUNDBOARD_OPTS $SOUNDBOARD_PREFIX$file"
	$SOUNDBOARD_CMD $SOUNDBOARD_OPTS "$SOUNDBOARD_PREFIX$file"
}
alias play='soundboard'

isZsh && source $SL_DIR/omz-plugins/soundboard.zsh

# vim:ft=sh:
<commit_msg>fixed dir bug<commit_after># Please set your SOUNDBOARD_CMD in your ~/.profile

alias urldecode='python -c "import sys, urllib as ul; print ul.unquote_plus(sys.argv[1])"'
alias urlencode='python -c "import sys, urllib as ul; print ul.quote_plus(sys.argv[1])"'

findsounds(){
	cwd=$PWD
	cd $SOUNDBOARD_PATH
	find -type f | grep -i "$@" | sed -e 's/^\.\///'
	cd $cwd
}

soundboard() {
	test -z "$SOUNDBOARD_CMD"    && SOUNDBOARD_CMD="curl"
	test -z "$SOUNDBOARD_PREFIX" && SOUNDBOARD_PREFIX="localhost:8080/play/"
	debug "soundboard args: '$@'"
	if echo "$@" | grep '\.\(mp3\|wav\|mp4\)$'
	then
		debug "playing file directly"
		file="$@"
	elif test -d "$SOUNDBOARD_PATH"
	then
		debug "playing regex"
		file=`findsounds "$@" | head -n 1`
		warn "matched file: $file"
		warn "unmatched files:"
		findsounds "$@" | tail -n +2 | awk '{ print "   "$0}'
		warn ""
	else
		error "SOUNDBOARD_PATH:$SOUNDBOARD_PATH not found"
	fi
	file=`urlencode "$file"`
	warn "$SOUNDBOARD_CMD $SOUNDBOARD_OPTS $SOUNDBOARD_PREFIX$file"
	$SOUNDBOARD_CMD $SOUNDBOARD_OPTS "$SOUNDBOARD_PREFIX$file"
}
alias play='soundboard'

isZsh && source $SL_DIR/omz-plugins/soundboard.zsh

# vim:ft=sh:

{'fraction_non_alphanumeric': 0.16564685314685315, 'fraction_numerical': 0.009615384615384616, 'mean_word_length': 4.463007159904534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4637670', 'n_tokens_mistral': 1006, 'n_tokens_neox': 922, 'n_words': 220}