Skip to content

Commit 007a185

Browse files
authored
Update .bashrc
1 parent ceed773 commit 007a185

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Linux/.bashrc

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,21 @@ function fix_validate_jsonl()
277277
fi
278278
}
279279
export -f fix_validate_jsonl
280+
function gen_random_string()
281+
{
282+
local R_LIMIT="${1:-32}"
283+
local X="X"
284+
local T_IN_T=$(printf '%s' "${X}$(printf '%.0sX' $(seq 1 "${R_LIMIT}"))")
285+
local T_IN="$(echo "${T_IN_T}" | head -c 251 | tr -d '[:space:]')"
286+
local T_OUT=$(mktemp -u "${T_IN}XXXX")
287+
echo "${T_OUT}" | tr -d "[:space:]" | head -c "${R_LIMIT}"
288+
}
289+
export -f gen_random_string
290+
function gen_random_string_date()
291+
{
292+
echo "$(gen_random_string ${1:-2})-$(date --utc +'%Y-%m-%dT%H-%M-%SZ%2N_%p_UTC')" | tr -d '[:space:]'
293+
}
294+
export -f gen_random_string_date
280295
function init_fzf()
281296
{
282297
if [[ "$(command -v bat)" && "$(command -v fd)" && "$(command -v fzf)" && "$(command -v tree)" ]]; then

0 commit comments

Comments
 (0)