Advertisement
Handroid

Bbb23 username generator – Version 1.4.2.bash

Nov 23rd, 2019
471
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. # Bbb23 username generator PRO  module – The simplest way to automatically generate Bbb-'ish usernames! And it's even open-source!
  2. # Portable script! Source code can be copy-pasted into terminal. Use “bbb23 -h” for help.
  3. version=1.4.2 # Coming soon: With combined parameters support using “getopts”.
  4. # Coming soon: Debug log.
  5. # Originally written by Handroid7.
  6. # You are encouraged to fork, distribute this code.
  7. # Feel free to modify for customization.
  8.  
  9. alias Bbb=Bbb23
  10. alias bbb23=Bbb23
  11. alias BBB=Bbb23
  12. alias bbb=Bbb23
  13.  
  14. d8() { date +%Y%m%d%H%M%S ;}
  15.  
  16. complete -W '\-n \-b \-t \-h --help' bbb23 Bbb23 bbb Bbb BBB
  17.  
  18. function runx() {
  19.   for ((n=0;n<$1;n++))
  20.     do ${*:2}
  21.   done
  22. }
  23.  
  24. function randomletter { head /dev/urandom | tr -dc A-Z | head -c 1 ;}
  25. function randomnumber { head /dev/urandom | od -d | head -n 1 | tail -c 2 | head -c 1 ;} # Different method for variety.
  26.  
  27. function Bbb23 {
  28.  
  29. letter1=$(randomletter)
  30.  
  31. printf "$letter1" #                           # B
  32. printf "$letter1" |tr '[:upper:]' '[:lower:]' #  #  b
  33. printf "$letter1" |tr '[:upper:]' '[:lower:]' #  #   b
  34. printf "$(randomnumber)""$(randomnumber)" #      #    23
  35.  
  36. # Options
  37.  
  38. if [[ "$@" == *"-b"* ]] ; then printf "\n" ; fi #           # Line break if demanded.
  39.  
  40.   if [[ ! "$@" == *"-n"* ]] && [[ ! "$@" == *"-h"* ]]; then # Requires spaces instead of tabulator (indent) due to copy-paste mess-up.
  41.    if [[ ! $(( $(date +%S) % 2 )) == 0 ]]
  42.    then
  43.         xdg-open "https://www.youtube.com/embed/Dg6HQ8RlPGQ?loop=1&autoplay=1&playlist=Dg6HQ8RlPGQ" #         # Easter-egg. Plays the song that reminds me of Bbb23 for unknown reasons, depending on which second the command was run. Pass “-n” option to deactivate.
  44.         xdg-open "https://en.wikipedia.org/wiki/User:Bbb23" #         # Glance at Bourdeilles while listening to that music. Get that ultimate Bbb23 experience.
  45.         if [ ! -f Bourdeilles_view.jpg ] ;then ( curl -s -O https://upload.wikimedia.org/wikipedia/commons/8/82/Bourdeilles_view.jpg )&
  46.     fi # Probably the first picture you ever got to stare at after you discovered that your Wikipedia account has been plundered.
  47.   fi
  48. fi
  49.  
  50.  
  51. BBBrhythm() { sleep "${1:-.298}" ;} # Usually exactly 0.3 seconds (200 beats per minute), but compensating for latency. Manually decrease to “.297” or similar, if your computer is slower.
  52. BBBdance() { while :; do
  53. printf B;BBBrhythm
  54. printf b;BBBrhythm
  55. printf b;BBBrhythm
  56. printf 2;BBBrhythm
  57. printf 3;BBBrhythm
  58. BBBrhythm
  59. printf "\b\b\b\b\b     \b\b\b\b\b"
  60. BBBrhythm;BBBrhythm
  61. done ;}
  62.  
  63.  
  64.  
  65.                       # Help
  66.  
  67. if [[ "$@" == *"-h"* ]] || [[ "$@" == *"help"* ]]; then echo -e "
  68. \e[102m\e[30m\nBbb23 username generator – user manual.\e[0m"'
  69.  
  70. -h           Show help.
  71. -n           Deactivate music easter egg that plays “Dum Dee Dum” depending on whether the current second is odd or even. Odd = play music.
  72. -b           Break line at the end. Same as “echo $(bbb23)”.
  73. -t           Bbb23 error code mode. Matched to “Dum Dee Dum” music.
  74.  
  75. Possible usages:
  76. echo $(bbb23 -n -b)                                       Generates plain output with line break, without playing music.
  77. runx 100 bbb23 -n -b >>username_suggestions.txt           Generates a list of 100 suggested usernames. Choose your file name.
  78. runx  10 bbb23 -n -b |tee -a username_suggestions.txt     Generates a list of  10 suggested usernames while printing them into the terminal.
  79. '
  80. fi
  81.  
  82.  
  83. if [[ "$@" == *"-t"* ]] || [[ "$@" == "" ]]; then
  84. printf "\n\n\e[101mError:\e[0m[CODE]\b\b\b\b\b\b";sleep .85;printf " ";BBBdance
  85. fi
  86.  
  87. }
  88.  
  89. read -p "Press to test Bbb23 name generator version $version.";echo -e "Test initiated. Version: $version \n";Bbb23 -n -b -h -t
  90. : #
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement