initial commit uwu
This commit is contained in:
commit
6cfe8a3e2e
|
@ -0,0 +1 @@
|
|||
venv/
|
|
@ -0,0 +1,29 @@
|
|||
# Introducing... ls stories!
|
||||
|
||||
Have you wanted to see what your friends are up to in their terminals?
|
||||
Well, wonder no more! I got distracted from important things again and now this exists!
|
||||
|
||||
![Screenshot of command output](https://sapphic.pw/8VR27)
|
||||
|
||||
## Installation
|
||||
|
||||
First, create a virtual environment and install the dependencies:
|
||||
```sh
|
||||
cd path/to/repo
|
||||
|
||||
python -m venv venv
|
||||
source venv/bin/activate
|
||||
|
||||
pip install -r requirements.txt
|
||||
```
|
||||
|
||||
|
||||
Then, just put this in your `.bashrc`/`.zshrc`/`etc` file and replace the path:
|
||||
|
||||
```sh
|
||||
function ls() {
|
||||
# ~25% chance of seeing new stories
|
||||
[ "$RANDOM" -lt 8191 ] && (cd path/to/repo/ ; ./stories.py )
|
||||
command ls $@
|
||||
}
|
||||
```
|
|
@ -0,0 +1 @@
|
|||
names==0.3.0
|
|
@ -0,0 +1,25 @@
|
|||
#!./venv/bin/python
|
||||
|
||||
import names
|
||||
import random
|
||||
import shutil
|
||||
|
||||
# pretty formatting!
|
||||
titleformat = '\x1b[3;31m'
|
||||
storyformat = '\x1b[1;0;41m'
|
||||
reset = '\x1b[0m'
|
||||
|
||||
# get terminal size to make the output centered
|
||||
termsize = shutil.get_terminal_size((80, 20))
|
||||
|
||||
# create a random amount of stories between 1 and 6
|
||||
stories = f'{storyformat}[ name ]{reset} ' * random.randint(1, 6)
|
||||
|
||||
# replace each placeholder name with a random first or full name
|
||||
for _ in range(stories.count('name')):
|
||||
stories = stories.replace('name', random.choice(
|
||||
[names.get_full_name(), names.get_first_name()]), 1
|
||||
)
|
||||
# output the unholy text
|
||||
print(f'{titleformat}New stories:{reset}'.center(termsize.columns))
|
||||
print(stories.center(termsize.columns) + '\n')
|
Loading…
Reference in New Issue