User:Silviolorusso/Terminal session

From XPUB & Lens-Based wiki

10 October - Terminal session /part 1

In developing his mechanical loom, Joseph Marie Jacquard implemented punched cards. It was 1801. Punched cards were a crucial innovation that would eventually affect the whole computer industry because they were the only way to store data.

A company called Dehomag, subsidiary to IBM, was leading the punchcards movement.

Then the punchcard technology became deprecated for the connection with Nazism: punch cards allowed Nazis to have scientific control over the repressed people. People started to think punchcards were allowing a repressive control over people.

The terminal concept was a sort of response to punchcards: instead of punching cards, writing command and data into a terminal. In fact the first terminal was not much more than a typing machine. Computer were made in a modular way: terminal were meant only to send data and to display it, not to precess them.

VT100 is an example of "dumb" terminal.

In parallel to terminal, serial consoles came to exist. A serial console allowed the admin to connect to the system through it. Now the difference between serial consoles and terminal is pretty blurred.


>>>>>>>>>>>>>>>> time jump >>>>>>>>>>>>>>>>>>>


(UNICS) UNIX, fully operating system, developed in 1969 by employers of Packard Bell research lab. The idea was to be able to breakdown everything in small parts. Modular. Doug Mcllroy:

<quote> This is the Unix philosophy: Write programs that do one thing and do it well. Write programs to work together. Write programs to handle text streams, because that is a universal interface. </quote>

The philosophy took off. More than 40 years after every simple computer is directly related to this principle.

Unix → NeXTSTEP (Steve Jobs), total failure → again in mac OS X

GNU started with the GNU manifesto 1980's by Richard Stallman

Stallman was working at AI labs and he witnesses the transformation of computing as a collaborative working to a commercial enterprise. No recipes, bits of code could be shared anymore. Bill Gates and others prevented that because it was considered harmful for the enterprise.
Four freedoms GNU:

  • The freedom to run the program, for any purpose (freedom 0).
  • The freedom to study how the program works, and change it so it does your computing as you wish (freedom 1). ** Access to the source code is a precondition for this.
  • The freedom to redistribute copies so you can help your neighbor (freedom 2).
  • The freedom to distribute copies of your modified versions to others (freedom 3). By doing this you can give the whole community a chance to benefit from your changes. Access to the source code is a precondition for this.


How to enforce this legally? GPL license, a sort of hack on copyright.

Stallman and others started to rewrite bits of code and release those in GPL.

Linux: just a Kernel without operating system. GNU didn't have a kernel. Good opportunitiy. GNU + LINUX.

Do one thing and do it well? How? Pipeline! What to pipe? Std (standard) streams in Unix (stdin / stdout / stderr)

Terminal: text-based as metaphoric as gui

commandlinefu.com: list of recipes command

LIST OF SHELL COMMANDS

ls : list
grep : find a line
ps : processes
man : manual
less : simple text viewer
alias : create alias
vim : text editor
pwd : where I am?
mkdir : make directory
cd : change directory
touch : create file
for do done : iteration loops
while : iteration loop, while something is true iterate some commands
whereis : where is software?
source: refresh
echo : print function
ssh : connect to a player
sh : a shell
bash : other shell
zsh : another one
chmod +x : change modes of a file
dmesg : list all kernel messages
> : pipe writes to file
| : pipe
\ : cut oneliner
seq : sequence number
sed : editor text to pipe

ARGUMENTS
&: run in background

FILES AND FOLDERS AND VARIABLES
.bashrc : config of bash
/dev/mem : ram
/dev/dsp : audiocard
~ : home
$HOST: name of the computer
$USER: name of the user

SHELL SHORTCUTS
TAB: Completion

>>>>>>>>>>>>>>>>>>>GIFMAKA >>>>>>>>>>>>>>>>>>>>>>>>>>>>>

 
#!/bin/sh

# Extract three PNG frames from a movie | $1 movie name | $2 time position in seconds | $3 number of frames
ffmpeg -i $1 -r 25 -ss $2 -vframes $3 $1-%03d.png

# convert PGN to single GIF

for FRAME in $(seq -f %03g $3)
do
	convert $1-$FRAME.png $1-$FRAME.gif
	rm $1-$FRAME.png
done

# combine all individual GIF in an animated one
FWD=$(/bin/ls $1-*.gif)
BWD=$(echo "${FWD}" | sed 1d | sort -r | sed 1d)

gifsicle --delay 4 --loopcount=0 --colors 256 \
$FWD $BWD > $1-anim.gif 

# remove files
rm $FWD

Examples of use of GIFMAKA capturing frames from Vampire in Venice directed by Augusto Caminito.

Day 2

Dadadodo: software based on Markof chain

Example:

   The cat is awesome. The cat is nice. The dog is horrible.
   The cat 66%     is   awesome      33%
       dog 33%          nice         33%
                        horrible     33%

Music field paranoia: Markov chain to generate pop songs.

A scientific text generated using Markov chain was officially accepted in a conference.

Smart example of usage of the dadadodo: http://tos.kuri.mu/, terms of services subverted.

Another: Network Theory spam machine

8 bit structure:

1 bit 0 : 0 1 : 1

2 bit 00 : 0 01 : 1 10 : 2 11 : 3

3 bit 000 : 0 001 : 1 010 : 2 011 : 3 100 : 4 101 : 5 110 : 6 111 : 7

up to 256...


ASCII original set in 7 bit system → then 8 bit


music only with bitshifting and oneliners

http://en.wikipedia.org/wiki/Bitwise_operation

My examples of bitshifting music:


  't>>3 | t>>5 | t*(t<<7) | (t>>2)&(t<<2) | t>>7 | t<<1'
  't>>2 | t^(t>>7)*t | t|(t>>7)'


C commands: &: AND | : OR ^ : XOR >>1% : bitshifting, shifts the bits to right (or left)

Linux Softwares wget : get file from the internet? lynx: browser espeak: speech synthesis curl : like wget but with more options