Browse Source

first commit in new repo

master
chris 5 months ago
commit
acd2f0370c
  1. 181
      flood.py
  2. 14
      flood.sh
  3. 30
      randflood.sh

181
flood.py

@ -0,0 +1,181 @@ @@ -0,0 +1,181 @@
#!/usr/bin/python
# -*- coding: UTF-8 -*-
# 2018-02-16
# CB trying to create a little program
# that fills a terminal console with text
import sys
import os
import random
import time
import subprocess
os.system('clear')
# terminal colors
# https://i.stack.imgur.com/KTSQa.png
colors = ['\033[95m',
'\033[94m',
'\033[91m',
'\033[93m',
'\033[92m',
'\033[0m',
'\033[1m' # bold,
'\033[213m',
'\033[202m',
'\033[11m',
'\033[9m',
'\033[52m',
'\033[226',
'\033[8m'
#'\033[4m' # underline
]
gobbledegook = ''
alpha=['a','b','c','d','e','f','g','h','i','j','k','l','n','o','p','q','r','s','t','u','v','w','x','y','z', ' ', '1','2','3','','','!','¡','?','¿','...',',''(',')','&',' ',' ',' ',' ']
for x in range (0, random.randint(1,25)):
gobbledegook = random.choice(alpha) + gobbledegook
# list of words/phrases
words = ["hello world ",
" RESIST ",
" R E S I S T ",
" FUCK TRUMP!",
" dismantle the patriarchy ",
" CODE like a GIRL ",
" B L A C K L I V E S M A T T E R ",
"0101001010100110101001101010100110",
"000020020",
"8*B#&^BD^*V*^%&@^^^&&@",
"15625UD%@6!&^@",
gobbledegook,
gobbledegook,
gobbledegook,
gobbledegook,
gobbledegook
]
# list of commands to run, use the results as input for printing
# list of characters to choose from. everything will be created using these
text = ['0',
'1',
'-',
'|',
'[',
']',
'^^^^^',
'@',
'?',
'#',
'',
'',
'',
'',
'',
'',
'',
',',
'',
'',
'',
'',
'',
'.',
'=', '©',
'',
'$',
'',
'Ò',
'ø',
'',
random.choice(words),
random.choice(words),
random.choice(words),
random.choice(words),
random.choice(words),
random.choice(words)
]
# a random selection of items from the text list
rantext = random.choice(text)
# generate a random length combination of the possible text items
rantext = ''
for x in range (0, random.randint(1,10)):
rantext = random.choice(text) + rantext
# randomly choose one of the text options
textchoice = random.choice(text)
fillstylechoices = ['one','random']
fillstyle = random.choice(fillstylechoices)
if fillstyle == "one":
fill = textchoice
upperRange = 9000
elif fillstyle == "random":
fill = rantext
upperRange = 900
# choices for end of each text block
endchoices = ['',' ','']
# choose an end type
endchoice = random.choice(endchoices)
# choose whether each item is on a new line
newlinechoices = ['yes','no']
newlinechoice = random.choice(newlinechoices)
# choose whether to use 1 color or many
colortypes = ['one','many']
colortype = random.choice(colortypes)
if colortype == "one":
# choose a single random color to use
color = random.choice(colors)
for x in range(0, upperRange):
# SET THE COLOR FOR EACH CHARACTER
if colortype == "one":
# use a single color
sys.stdout.write(color)
else:
# use many colors randomly
sys.stdout.write(random.choice(colors))
if newlinechoice == "yes":
sys.stdout.write("")
if newlinechoice == "no":
sys.stdout.flush()
# PRINT THE CHARACTER
sys.stdout.write(fill)
if newlinechoice == "yes":
sys.stdout.write("")
if newlinechoice == "no":
sys.stdout.flush()
# PRINT AN ENDING THING (space, no space, etc.)
for x in range(random.randint(1,30)):
sys.stdout.write(endchoice)
if newlinechoice == "yes":
sys.stdout.write("")
elif newlinechoice == "no":
sys.stdout.flush()
#os.system("ls /Users/chris/Library/Application\ Support/SuperCollider/downloaded-quarks/Dirt-Samples kj

14
flood.sh

@ -0,0 +1,14 @@ @@ -0,0 +1,14 @@
#!/bin/bash
for run in {1..100000}
do
# generate a random number for a sleep timer
python flood.py
# https://stackoverflow.com/questions/35243565/how-to-generate-random-numbers-between-0-and-1-in-bash
# sleep $(bc -l <<< "scale=4 ; ${RANDOM}/32767")
# sleep $(bc -l <<< "scale=4 ; ${RANDOM}/32767")
# sleep $(bc -l <<< "scale=4 ; ${RANDOM}/32767")
# sleep $(bc -l <<< "scale=4 ; ${RANDOM}/32767")
# sleep $(bc -l <<< "scale=4 ; ${RANDOM}/32767")
sleep 1
done

30
randflood.sh

@ -0,0 +1,30 @@ @@ -0,0 +1,30 @@
#!/bin/bash
RED='\033[0;31m'
GREEN='\033[0;32'
# generate a random series of characters
array[0]="poops "
array[1]="0100101010010010101001001"
array[2]="abcdefgfedcba"
array[3]="--*--*--*--*"
array[4]=" !! "
array[5]="|||||||||||||||||||"
array[6]="~~**~~** "
array[7]="__________________"
array[8]="++++++++++++++++++"
array[9]="000000000000000000"
#echo ${array[$index]}
#for run in {1..9999}
#do
size=${#array[@]}
index=$(($RANDOM % $size))
for run in {1..1000}
do
#echo -ne "$(tput setaf 1)Red text $(tput setab 7)and white background$(tput sgr 0)"
#printf "*$%%#^^ **#888882 001001"
echo -ne ${array[$index]}
done
# sleep 0.25
#done
Loading…
Cancel
Save