Motivational messages
xcybex Motivational Messages
- Goal: write a motivational message generator (in small groups)
- Possible outputs: shell wall, HTML file (on web directory), printer, audio (text-to-speech)
- input:
- process:
- output:
- design the workflow: what will be the workflow/strategy?
Life Hack Publications:
- Life hack coach
- print publication
Scripting on the Pi
methods
> write to `some-command` between backticks is evaluated (executed) by the shell before the main commandand the output of that execution is used by that command | pipe
Tools:
Input reading:
- cat
- wget - network downloader
- sed - to read specific file lines: sed -n LINENUMBERp e.g sed -n 4p sed -n 5,10p
- wc - word/line/character counter
ascii art
- figlet
- toilet
- cowsay
- jp2a
- install it: sudo apt-get install jp2a
- jpg image
- do the conversion
social tools
- write username - chat with the users
- wall - message to all users
echo HI WORLD | figlet -f /home/pi/figlet-fonts/ticksslant.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/weird.flf > /dev/ttyUSB0 echo "yolo" | figlet -f /home/pi/figlet-fonts/madrid.flf
and the command to print a jp2a is..?
jp2a -f *insert link* > /dev/ttyUSB0
jp2a -f --colors --background=light
Text Processing:
- sed - stream editor for replacing terms/character. e.g. where e is replaced by 3: sed 's/e/3/g'
cat mona.txt | sed 's/0/?/g' cat mona.txt | sed 's/e/3/g'| sed 's/o/0/g'| sed 's/a/4/g'
- sort - sort (alphabetically) lines of text files
sort --random-sort userlist.txt | head -n 1
- dadadodo - markov-chain based text generator
- text-to-speech: espeak
cat silvio.txt | dadadodo -c 1 - | espeak
art works
Artybollocks generator https://artybollocks.com/ Templates + variables
https://twitter.com/tweet_captain
https://twitter.com/proust2000 http://pzwiki.wdka.nl/mediadesign/User:Jonas_Lund/In-Search-Of-Lost-Time
- cron jobs
- bash scripting
bash scripting resources
- https://en.wikibooks.org/wiki/Bash_Shell_Scripting
- http://linuxcommand.org/lc3_writing_shell_scripts.php Writing Shell Scripts
http://wiki.bash-hackers.org/doku.php
Dot matrix printers
dot matrix prinrt: technicalities. can design typeface in bit data is to receive and print out characters (and make noise https://vimeo.com/6868193)
The User https://www.youtube.com/watch?v=grUniaqzXtU
piping command: what does it mean to pipe? | echo "something something" |wc -w| figlet
octal
Motivational messages - work groups
Tancredi, Paloma, Artemis, Simon team
outcome
script
/home/txtgenerator1/mem.sh
#!/bin/sh dir=/home/txtgenerator1 A=`sort -R $dir/A.txt | head -n 1` B=`sort -R $dir/B.txt | head -n 1` C=`sort -R $dir/C.txt | head -n 1` D=`sort -R $dir/swear.txt | head -n 1` IMG=$dir/img/`sort -R $dir/img/IMG.txt| head -n 1` echo Do $A to make $B. echo $C...$D!!!hello echo $IMG TEXT="Do $A to make $B." TEXT2="$C." convert $IMG -resize 1300x \ -font "Nimbus-Mono-L-Bold" -pointsize 45 -fill white -stroke black -strokewidth 2 -blur 0x50 \ -gravity northwest -annotate +25+25 "$TEXT" -gravity southwest -annotate +25+25 "$TEXT2" $dir/motivation.jpg
C=`cat C.txt | sort -R | head -n 1`
echo $C
MEME GENERATOR --> convert ascii-code-t.jpg -font Impact-Regular -fill white -pointsize 79 -stroke black -strokewidth 3 -gravity southwest -annotate +25+25 'BLAH BLAH BLAH' test.jpg
convert ascii-code-t.jpg -font Impact-Regular -fill white -pointsize 79 -stroke black -strokewidth 3 -gravity northwest -annotate +25+25 'BLAH BLAH BLAH' test.jpg
get fonts that convert accepts convert -list font
cronjob: performs a task very so often crontab -e
Bo, Bi, Pedro, Rita group
https://pad.xpub.nl/p/LINKEDIN
outcome
http://145.24.139.232/~pedrosaclout/linkedinproject/
script
/home/pedrosaclout/public_html/linkedinproject/generator.sh
#!/bin/sh dir=/home/pedrosaclout/public_html/linkedinproject profession=`cat $dir/professions.txt | sort -R | head -n 1` subject=`cat $dir/subject.txt | sort -R | head -n 1` goal=`cat $dir/goal.txt | sort -R | head -n 1` education=`cat $dir/education.txt | sort -R | head -n 1` quotes=`cat $dir/quotes.txt | sort -R | head -n 1` adjectives=`cat $dir/adjectives.txt | sort -R | head -n 1` name=`cat $dir/names.txt | sort -R | head -n 1` hobby=`cat $dir/hobby.txt | sort -R | head -n 1` experience=`cat $dir/experience.txt | sort -R | head -n 1` template=`cat $dir/template.txt| sort -R | head -n 1` echo $template | sed "s/PROFESSION/$profession/g" | sed "s/EXPERIENCE/$experience/g" | sed "s/SUBJECT/$subject/g" | sed "s/GOAL/$goal/g" | sed "s/EDUCATION/$education/g" | sed "s/QUOTE/$quotes/g" | sed "s/ADJECTIVES/$adjectives/g" | sed "s/NAME/$name/g" | sed "s/HOBBY/$hobby/g" | sed "s/EXPERIENCE/$experience/g" > $dir/index.html