Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/shakibamoshiri/illustrated_perl_one-liners
some Perl one-liners which have been illustrated :)
https://github.com/shakibamoshiri/illustrated_perl_one-liners
illustrated-perl perl perl-one-linter regex
Last synced: 26 days ago
JSON representation
some Perl one-liners which have been illustrated :)
- Host: GitHub
- URL: https://github.com/shakibamoshiri/illustrated_perl_one-liners
- Owner: shakibamoshiri
- Created: 2016-11-16T11:39:36.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2016-12-09T13:34:22.000Z (about 8 years ago)
- Last Synced: 2024-11-08T08:44:55.430Z (3 months ago)
- Topics: illustrated-perl, perl, perl-one-linter, regex
- Language: Shell
- Homepage:
- Size: 14.2 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
This is my idea to put Perl one-liners in more attractive style. So that you can see the output of each one-liners and understand it convenience.
I am a new typist in **C++** and **Perl**, may be you see some mistakes.
Also I am beginner in `writing` English and may be you will find
some mistakes here or on the pictures, so _I apologize about that._I hope this style of Perl one-liner would be fun and useful for you.
Screenshot:
![illustrate Perl one-liners](https://github.com/k-five/illustrated_Perl_one-liners/blob/master/welcome_to_ipol.png)Last shot:
![illustrate Perl one-liners](https://github.com/k-five/illustrated_Perl_one-liners/blob/master/last_shot.png)**License**
I got allowed from [Peteris Krumins](https://github.com/pkrumins)
who have written a book about Perl one-liners and I have read
that book and 99% of the one-liners come from this book. But
a few of them not in the book, like: **generate full password**
or ...# How to use:
First
- `git clone https://github.com/k-five/illustrated_Perl_one-liners`
- `cd illustrated_Perl_one-liners`Then:
1. using **animate**
- `animate *.png` it will show you all png in animation style
- `animate -delay 100 *.png` it will show you with delay of 1 second2. using **gnome-open**
- `gnome-open file.gif` or `gnome-open file.png`3. using **mpv**
- `mpv file.mp4`
- may be you do like download the file and only want to watch in so:
- `mpv https://github.com/k-five/illustrated_Perl_one-liners/1_numbering/mp4/numbering_slideshow.mp4` it is played for you#WARNING :warning:
The two below **handy-code** are JUST for fun and show how to use one-liners in use.
Of course everything that you dump, STILL, belongs to the two dictionaries.# handy-quick-dump with one-liners
### dumps definitions, examples, and sounds file , from [Oxford Dictionary Online](http://www.oxfordlearnersdictionaries.com/)
Unfortunately I could not set device in **Ubuntu** to record a video along audio file, so I had to use picture again :).
We do it in three item:## item one:
The address of the site : http://www.oxfordlearnersdictionaries.com/If you search for a word like *see*, you will see this: (in address bar)
`http://www.oxfordlearnersdictionaries.com/definition/english/see_1?q=see`Put that in a bash file like this:
```bash
#!/bin/bash
lynx -dump -source http://www.oxfordlearnersdictionaries.com/definition/english/$1\_1?q=$1
```Then do this:
`chmod u+x dump_page.sh`Just we need to get a word form user and pass it to the `. dump_page.sh` like this:
`clear; read -p "Enter a word:" word && . dump_page.sh $word`
which it will dump the source page of each word that you want. If you enter a word such as **gloomy** it will dump source for the gloomy word.
Lastly we need Perl one-liners, which it will be:
## item two:
#### dumping examples:
```Perl
perl -lne 'push @M,"$1" while /class="x".+?"> ?([A-Z].+?)<(?!class)/g; END{ foreach $file (@M) { print ++$n," : ",$file =~ /.+[.!?]$/g ? "\e[0;32m$file\e[m" : "\e[1;31mmissed example\e[m" } }'```
#### dumping definition:
```Perl
perl -lne 'push @M,"$1" while /class="def".+?"> ?([a-z].+?)<(?!class)/g; END{ foreach $file (@M) { print ++$n," : ",$file =~ / +/g ? "\e[0;32m$file\e[m" : "\e[1;31mmissed example\e[m" } }'```
#### hears pronunciation: (**us**/uk need to use `mpv`)
```Perl
perl -lne 'push @M,"$1" while /data-src-mp3="(.+?\.mp3)/g; END{ print "\e[0;32mUS pronunciation:\e[m"; foreach $file (@M) { $file =~ /us/i && `mpv $file` } }'```
#### downloads pronunciation:(**us**/uk need to use `wget`)
```Perl
perl -lne 'push @M,"$1" while /data-src-mp3="(.+?\.mp3)/g; END{ print "\e[0;32mUS pronunciation:\e[m"; foreach $file (@M) { $file =~ /us/i && `wget -c -q --show-progress $file` } }'```
#### Summary you will have something like this: (finding examples)
```bash
read -p "Enter a word: " word && . dump_page.sh $word | perl -lne 'push @M,"$1" while /class="x".+?"> ?([A-Z].+?)<(?!class)/g; END{ foreach $file (@M) { print ++$n," : ",$file =~ /.+[.!?]$/g ? "\e[0;32m$file\e[m" : "\e[1;31mmissed example\e[m" } }'```
### Animation of how them work:![dumps from oxford dictionary online](https://github.com/k-five/illustrated_Perl_one-liners/blob/master/dump_oxford.gif)
## item three
#### Just enjoy :) -- that's it.---
## slideshow in youtube:
### [illustrated Perl one-liners](https://www.youtube.com/playlist?list=PL_akDzx9nCAFAsKLX4FxLs0xIsosZAoIN)
---
# handy-quick-dump with one-liners
### dumps definitions, examples, and sounds file, from [longman Dictionary Online](http://www.ldoceonline.com)
#### You can do it by yourself.