NAME
zsh-lovers - tips, tricks and examples for the Z shell
SYNOPSIS
Just read it. ;-)
OVERVIEW
Whenever we look at the zsh manual we wonder why there are no examples or those simply things in (shell) life. The zsh contains many features, but there was no manpage with some examples (like procmailex(5)). That’s why we wrote this manpage.
Most of the tricks and oneliner come from the mailinglists zsh-users, zsh-workers, google, newsgroups and from ourself. See section LINKS for details.
Note: This manpage (zsh-lovers(1)) is not an offical part of the Z shell! It’s
just a just for fun - manpage ;)
For comments, bugreports and feedback take a quick look at the section BUGS.
SHELL-SCRIPTING
This section provides some examples for often needed shellscript-stuff. Notice
that you should not use otherwise most examples won’t work.
Parse options in shellscripts. Example taken from ZWS by Adam Chodorowski
(http://www.chodorowski.com/projects/zws/):
parse_options() { o_port=(-p 9999) o_root=(-r WWW) o_log=(-d ZWS.log) zparseopts -K -- p:=o_port r:=o_root l:=o_log h=o_help if [[ $? != 0 || "$o_help" != "" ]]; then echo Usage: $(basename "$0") "[-p PORT] [-r DIRECTORY]" exit 1 fi port=$o_port[2] root=$o_root[2] log=$o_log[2] if [[ $root[1] != '/' ]]; then root="$PWD/$root"; fi } # now use the function: parse_options $*
EXAMPLES
Available subsections are Aliases, Completion, Unsorted/Misc examples, (Recursive) Globbing - Examples, Modifiers usage, Redirection-Examples, ZMV-Examples and Module-Examples.
ALIASES
Suffix aliases are supported in zsh since version 4.2.0. Some examples:
alias -s tex=vim alias -s html=w3m alias -s org=w3m
Now pressing return-key after entering foobar.tex starts vim with
foobar.tex. Calling a html-file runs browser w3m. www.zsh.org and pressing
enter starts w3m with argument www.zsh.org.
Global aliases can be used anywhere in the command line.
Some functions, like _apt and _dpkg, are very slow. You can use a cache in order to proxy the list of results (like the list of available debian packages) Use a cache:
zstyle ':completion:*' use-cache on zstyle ':completion:*' cache-path ~/.zsh/cache
Prevent CVS files/directories from being completed:
zstyle ':completion:*:(all-|)files' ignored-patterns '(|*/)CVS' zstyle ':completion:*:cd:*' ignored-patterns '(*/)#CVS'
Fuzzy matching of completions for when you mistype them:
zstyle ':completion:*' completer _complete _match _approximate zstyle ':completion:*:match:*' original only zstyle ':completion:*:approximate:*' max-errors 1 numeric
And if you want the number of errors allowed by _approximate to increase with the length of what you have typed so far:
zstyle -e ':completion:*:approximate:*' \ max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3))numeric)'
Ignore completion functions for commands you don’t have:
zstyle ':completion:*:functions' ignored-patterns '_*'
With helper functions like:
xdvi() { command xdvi ${*:-*.dvi(om[1])} }
you can avoid having to complete at all in many cases, but if you do, you might want to fall into menu selection immediately and to have the words sorted by time:
zstyle ':completion:*:*:xdvi:*' menu yes select zstyle ':completion:*:*:xdvi:*' file-sort time
Completing process IDs with menu selection:
zstyle ':completion:*:*:kill:*' menu yes select zstyle ':completion:*:kill:*' force-list always
If you end up using a directory as argument, this will remove the trailing slash (usefull in ln)
zstyle ':completion:*' squeeze-slashes true
cd will never select the parent directory (e.g.: cd ../<TAB>):
zstyle ':completion:*:cd:*' ignore-parents parent pwd
Another method for quick change directories. Add this to your ~/.zshrc, then just enter “cd …./dir”
rationalise-dot() { if [[ $LBUFFER = *.. ]]; then LBUFFER+=/.. else LBUFFER+=. fi } zle -N rationalise-dot bindkey . rationalise-dot
UNSORTED/MISC examples
Hint: A list of valid glob Qualifiers can be found in zshexpn(1). See “man 1 zshexpn | less -p” Qualifiers for details.
# Get the names of all files that *don't* match a pattern *anywhere* on the # file (and without ``-L'' because its GNUish) $ print -rl -- *(.^e{'grep -q pattern $REPLY'}) # or $ : *(.e{'grep -q pattern $REPLY || print -r -- $REPLY'}) # random numbers $ echo $[${RANDOM}%1000] # random between 0-999 $ echo $[${RANDOM}%11+10] # random between 10-20 $ echo ${(l:3::0:)${RANDOM}} # N digits long (3 digits) # reverse a word $ echo "${(j::)${(@Oa)${(s::):-hello}}}" # Show newest directory $ ls -ld *(/om[1]) # random array element $ FILES=( .../files/* ) $ feh $FILES[$RANDOM%$#FILES+1] # cat first line in all files in this dir $ for file (*(ND-.)) IFS= read -re < $file # test if a parameter is numeric $ if [[ $1 == <-> ]] ; then echo numeric else echo non-numeric fi # Show me all the .c files for which there doesn't exist a .o file. $ print *.c(e_'[[ ! -e $REPLY:r.o ]]'_) # All files in /var/ that are not owned by root $ ls -ld /var/*(^u:root) # All files for which the owner hat read and execute permissions $ echo *(f:u+rx:) # The same, but also others dont have execute permissions $ echo *(f:u+rx,o-x:) # brace expansion - example $ X=(A B C) $ Y=(+ -) $ print -r -- $^X.$^Y A.+ A.- B.+ B.- C.+ C.- # Fetch the newest file containing the string 'fgractg*.log' in the # filename and contains the string 'ORA-' in it $ file=(fgractg*.log(Nm0om[1])) $ (($#file)) && grep -l ORA- $file # without Zsh $ files=$( find . -name . -o -prune -name 'fgractg*>log' -mtime 0 -print ) > if [ -n "$files" ]; then > IFS=' > ' > set -f > file=$(ls -td $files | head -1) > grep -l ORA- "$file" > fi # keep specified number of child processes running until entire task finished $ zsh -c 'sleep 1 & sleep 3 & sleep 2& print -rl -- $jobtexts' # Remove zero length and .bak files in a directory $ rm -i *(.L0) *.bak(.) # print out files that dont have extensions $ printf '%s\n' ^?*.* $ printf '%s\n' ^?*.[^.]*(D) $ ls -d -- ^?*.*(D) # Finding files which does not contain a specific string $ print -rl file* | comm -2 -3 - <(grep -l string file*)' $ for f (file*(N)) grep -q string $f || print -r $f' # Show/Check whether a option is set or not. It works both with $options as # with $builtins $ echo $options[correct] off $ $options[zle] on # Count the number of directories on the stack $ print $((${${(z)${(f)"$(dirs -v)"}[-1]}[1]} + 1)) # or $ dirs -v | awk '{n=$1}END{print n+1}' # Matching all files which do not have a dot in filename $ ls *~*.*(.) # Show only the ip-address from ``ifconfig device'' # ifconfig from net-tools (Linux) $ print ${${$(LC_ALL=C /sbin/ifconfig eth0)[7]}:gs/addr://} # ifconfig from 4.2BSD {Free,Net,Open}BSD $ print ${$(/sbin/ifconfig tun0)[6]} # Ping all the IP addresses in a couple of class C's or all hosts # into /etc/hosts $ for i in {1..254}; do ping -c 1 192.168.13.$i; done or $ I=1 $ while ( [[ $I -le 255 ]] ) ; do ping -1 2 150.150.150.$I; let I++; done or $ for i in $(sed 's/#.*//' > /etc/hosts | awk '{print $2}') : do : echo "Trying $i ... " : ping -c 1 $i ; : echo '=============================' : done # load all available modules at startup $ typeset -U m $ m=() $ for md ($module_path) m=($m $md/**/*(*e:'REPLY=${REPLY#$md/}'::r)) $ zmodload -i $m # Rename all files within a directory such that their names get a numeral # prefix in the default sort order. $ i=1; for j in *; do mv $j $i.$j; ((i++)); done $ i=1; for f in *; do mv $f $(echo $i | \ awk '{ printf("%03d", $0)}').$f; ((i++)); done $ integer i=0; for f in *; do mv $f $[i+=1].$f; done # Find (and print) all symbolic links without a target within the current # dirtree. $ $ file **/*(D@) | fgrep broken $ for i in **/*(D@); [[ -f $i || -d $i ]] || echo $i $ echo<EMAIL_ADDRESS>$ print -l **/*(-@) # List all plain files that do not have extensions listed in `fignore' $ ls **/*~*(${~${(j/|/)fignore}})(.) # see above, but now omit executables $ ls **/*~*(${~${(j/|/)fignore}})(.^*) # Print out files that dont have extensions (require *setopt extendedglob* # and *setopt dotglob*) $ printf '%s\n' ^?*.* # List files in reverse order sorted by name $ print -rl -- *(On) or $ print -rl -- *(^on) # Synonymic to ``ps ax | awk '{print $1}''' $ print -l /proc/*/cwd(:h:t:s/self//) # Get the PID of a process (without ``ps'', ``sed'', ``pgrep'', .. # (under Linux) $ pid2 () { > local i > for i in /proc/<->/stat > do > [[ "$(< $i)" = *\((${(j:|:)~@})\)* ]] && echo $i:h:t > done > } # for X in 'n' 'o' 'p' 'q' 'r' 's' 't' 'u' 'v' 'w' 'x' 'y'; do ... $ for (( i = 36#n; i <= 36#y; i++ )); do > print ${$(([##36]i)):l} > done # or in combination with ``dc'' $ print {$((##n))..$((##y))}P\ 10P | dc # or with ``eval'' $ eval print '${$(([##36]'{$((36#n))..$((36#y))}')):l}' # foreach in one line of shell $ for f (*) print -r -- $f # copy a directory recursively without data/files $ dirs=(**/*(/)) $ cd -- $dest_root $ mkdir -p -- $dirs # or without zsh $ find . -type d -exec env d="$dest_root" \ sh -c ' exec mkdir -p -- "$d/$1"' '{}' '{}' \; # If `foo=23'', then print with 10 digit with leading '0'. $ foo=23 $ print ${(r:10::0:)foo} # find the name of all the files in their home directory that have # more than 20 characters in their file names print -rl $HOME/${(l:20::?:)~:-}* # Save arrays $ print -r -- ${(qq)m} > $nameoffile # save it $ eval "m=($(cat -- $nameoffile)" # or use $ m=("${(@Q)${(z)"$(cat -- $nameoffile)"}}") # to restore it # get a "ls -l" on all the files in the tree that are younger than a # specified age (e.g "ls -l" all the files in the tree that where # modified in the last 2 days) $ ls -tld **/*(m-2) # This will give you a listing 1 file perl line (not à la ls -R). # Think of an easy way to have a "ls -R" style output with # only files newer than 2 day old. $ for d (. ./**/*(/)) { > print -r -- $'\n'${d}: > cd $d && { > l=(*(Nm-2)) > (($#l)) && ls -ltd -- $l > cd ~- > } > } # If you also want directories to be included even if their mtime # is more than 2 days old: $ for d (. ./**/*(/)) { > print -r -- $'\n'${d}: > cd $d && { > l=(*(N/,m-2)) > (($#l)) && ls -ltd -- $l > cd ~- > } > } # And if you want only the directories with mtime < 2 days to be listed: $ for d (. ./**/*(N/m-2)) { > print -r -- $'\n'${d}: > cd $d && { > l=(*(Nm-2)) > (($#l)) && ls -ltd -- $l > cd ~- > } > } # print 42 ``-'' $ echo ${(l:42::-:)} # or use ``$COLUMS'' $ echo ${(l:$COLUMNS::-:)} # and now with colors (require autoload colors ;colors) $ echo "$bg[red]$fg[black]${(l:42::-:)}" # Redirect STDERR to a command like xless without redirecting STDOUT as well. $ foo 2>>(xless) # but this executes the command asynchronously. To do it synchronously: $ { { foo 1>&3 } 2>&1 | xless } 3>&1 # Rename all MP3-Files from name with spaces.mp3 to Name With Spaces.mp3 $ for i in *.mp3; do > mv $i ${${(C)i}:s/Mp3/mp3/} > done # Match file names containing only digits and ending with .xml (require # *setopt kshglob*) $ ls -l [0-9]##.xml $ ls -l <0->.xml # Remove all "non txt" files $ rm ./^*.txt # Move 200 files from a directory into another $ mv -- *([1,200]) /another/Dir # Convert images (foo.gif => foo.png): $ for i in **/*.gif; convert $i $i:r.png # convert a collection of mp3 files to wave or cdr, # e.g. file.wav -> file.mp3) $ for i (./*.mp3){mpg321 --w - $i > ${i:r}.wav} # Download with LaTeX2HTML created Files (for example the ZSH-Guide): $ for f in http://zsh.sunsite.dk/Guide/zshguide{,{01..08}}.html; do > lynx -source $f >${f:t} > done # Move all files in dir1 and dir2 that have line counts greater than 10 to # another directory say "/more10" $ mv dir[12]/**/*.cr(-.e{'((`wc -l < $REPLY` > 10))'}) /more10 # Make with dpkg a master-list of everyfile that it has installed $ diff <(find / | sort) <(cat /var/lib/dpkg/info/*.list | sort) # Replace this fucking Escape-Sequences: $ autoload colors ; colors $ print "$bg[cyan]$fg[blue]You are a idiot" >> /dev/pts/3 # Get ASCII value of a character $ char=N ; print $((#char)) # Filename "Erweiterung" # Note: The (N) says to use the nullglob option for this particular # glob pattern. $ for i in *.o(N); do > rm $i > done # Rename files; i. e. FOO to foo and bar to BAR $ for i in *(.); mv $i ${i:l} # `FOO' to `foo' $ for i in *(.); mv $i ${i:u} # `bar to `BAR' # Show all suid-files in $PATH $ ls -latg ${(s.:.)PATH} | grep '^...s' # or more complex ;) $ print -l ${^path}/*(Ns,S) # or show only executables with a user given pattern $ print -l ${^path}/*vim*(*N) # gzip files when containing a certain string $ gzip ${(ps:\0:)"$(grep -lZ foobar ./*.txt(.))"} # A small one-liner, that reads from stdin and prints to stdout the first # unique line i. e. does not print lines that have been printed before # (this is similar to the unique command, but unique can only handle # adjacent lines). $ IFS=$'\n\n'; print -rl -- ${(Oau)${(Oa)$(cat file;echo .)[1,-2]}} # Lists every executable in PATH $ print -l ${^path}/*(-*N) # Match all .c files in all subdirectories, _except_ any SCCS subdirectories? $ ls **/*.c~(*/)#SCCS/* # List all `README' - files case-insensitive with max. one typo $ ls **/*(#ia2)readme # case insensitive checking for variables $ if [[ $OSTYPE == (#i)LINUX*(#I) ]]; then > echo "Penguin on board." > else > echo "Not a Linux." > fi
(Recursive) Globbing - Examples
A list of valid glob Qualifiers can be found in zshexpn(1). Note: **/ is equivalent to (*/)#! For example:
$ print (*/)#zsh_us.ps zsh-4.2.3/Doc/zsh_us.ps $ print **/zsh_us.ps zsh-4.2.3/Doc/zsh_us.ps
# Search for `README' in all Subdirectories $ ls -l **/README # find directories that contain both "index.php" and "index.html", or in # general, directories that contain more than one file matching "index.*" $ ls **/*(D/e:'[[ -e $REPLY/index.php && -e $REPLY/index.html ]]':) # or $ ls **/*(D/e:'l=($REPLY/index.*(N)); (( $#l >= 2 ))':) # Find command to search for directory name instead of basename $ print -rl /**/*~^*/path(|/*) # or - without Zsh $ find / | grep -e /path/ -e '/path$' # Print he path of the directories holding the ten biggest C regular files # in the current directory and subdirectories. $ print -rl -- **/*.c(D.OL[1,10]:h) | sort -u # Find files with size == 0 and send a mail $ files=(**/*(ND.L0m+0m-2)) > (( $#files > 0 )) && print -rl -- $files | \ mailx -s "empty files"<EMAIL_ADDRESS># recursive chmod $ chmod 700 **/(.) # Only files $ chmod 700 **/(/) # Only directories # print out all of the files in that directory in 2 columns $ print -rC2 -- ${1:[...]}/*(D:t) # ^- number ob columns # or - if you feel concerned about special characters - use $ list=(${1:[...]}/*(ND:t)) $ (($#list)) && print -rC2 -- ${(V)list} # Search all files in /home/*/*-mail/ with a setting ``chmod -s'' flag # (recursive, include dotfiles) remove the setgid/setuid flag and print # a message $ chmod -s /home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S)) # or with a small script $ for file (/home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S)) { > print -r -- $file > chmod -s $file && print -r fixed $file > } # or use ``zargs'' (require autoload zargs) prevent the arg list too # long error $ zargs /home/*/*-mail(DNs,S) /home/*/*-mail/**/*(DNs,S)) -- chmod -s # List files beginning at `foo23' upwards (foo23, foo24, foo25, ..) $ ls -l foo<23-> # get all files that begin with the date strings from June 4 through # June 9 of 2004 $ ls -l 200406{04..10}*(N) # or if they are of the form 200406XX (require ``setopt extended_glob'' $ ls -l 200306<4-10>.* # remove spaces from filenames $ for a in ./**/*\ *(Dod); do mv $a ${a:h}/${a:t:gs/ /_}; done # Show only all *.c and *.h - Files $ ls -l *.(c|h) # Show only all *.c - files and ignore `foo.c' $ ls *.c~foo.c # show data to *really* binary format $ zsh -ec 'while {} {printf %.8x $n;repeat 8 \ > {read -ku0 a printf \ %.8d $(([##2]#a))};print;((n+=8))}' < binary # Show only world-readable files $ ls -l *(R) # List files in the current directory are not writable by the owner $ print -l ~/*(ND.^w) # find and delete the files which are older than a given parameter # (seconds/minutes/hours) # deletes all regular file in /Dir that are older than 3 hours $ rm -f /Dir/**/*(.mh+3) # deletes all symlinks in /Dir that are older than 3 minutes $ rm -f /Dir/**/*(@mm+3) # deletes all non dirs in /Dir that are older than 30 seconds $ rm -f /Dir/**/*(ms+30^/) # deletes all folders, sub-folders and files older than one hour $ rm ./**/*(.Dmh+1,.DL0) # deletes all files more than 6 hours old $ rm -f **/*(mh+6) # removes all files but the ten newer ones (delete all but last 10 # files in a directory) $ rm ./*(Om[1,-11]) Note: If you get a arg list too long, you use the builtin rm. For example: $ zmodload zsh/files ; rm -f **/*(mh+6) or use the zargs function: $ autoload zargs ; zargs **/*(mh+6) -- rm -f # A User's Guide to the Z-Shell /5.9: Filename Generation and Pattern # Matching find all files in all subdirectories, searching recursively, # which have a given name, case insensitive, are at least 50 KB large, # no more than a week old and owned by the root user, and allowing up # to a single error in the spelling of the name. In fact, the required # expression looks like this: $ ls **/(#ia1)name(LK+50mw-1u0) # Change the UID from 102 to 666 $ chown 666 **/*(u102) # List all files which have not been updated since last 10 hours $ print -rl -- *(Dmh+10^/) # delete only the oldest file in a directory $ rm ./*filename*(Om[1]) # Sort the output from `ls -l' by file size $ ls -fld *(OL) # find most recent file in a directory $ setopt dotglob ; print directory/**/*(om[1]) # Show only empty files which nor `group' or `world writable' $ ls *(L0f.go-w.) # Find - and list - the ten newest files in directories and subdirs. # (recursive) $ print -rl -- **/*(Dom[1,10]) # Print only 5 lines by "ls" command (like ``ls -laS | head -n 5''). $ ls -fl *(DOL[1,5]) # Display the 5-10 last modified files. $ print -rl -- /path/to/dir/**/*(D.om[5,10]) # Find all files without a valid owner. $ chmod someuser /**/*(D^u:${(j.:u:.)${(f)"$(</etc/passwd)"}%%:*}:) # Find all the empty directories in a tree. $ for f in ***/*(/l2); do foo=($f/*(N)); [[ -z $foo ]] && print $f; done # Note:Since Zsh 4.2.1 the glob qualifier F indicates a non-empty directory. # Hence *(F) indicates all subdirectories with entries, *(/^F) means all # subdirectories with no entries. $ ls -ld *(/^F) # Remove empty directories afterwards. $ rmdir ./**/*(/od) 2> /dev/null # Show only files which are owned by group `users'. $ ls -l *(G[users])
Modifiers usage
Modifiers are a powerful mechanism that let you modify the results returned by parameter, filename and history expansion. See zshexpn(1) for details.
# NOTE: Zsh 4.3.4 needed! $ autoload -U age # files modified today $ print *(e:age today now:) # files modified since 5 pm $ print *(e-age 17:00 now-) # ... since 5 o'clock yesterda $ print *(e-age yesterday,17:00 now-) # ... from last Christmas before today $ print *(e-age 2006/12/25 today-) # ... before yesterday $ print *(e-age 1970/01/01 yesterday-) # all files modified between the start of those dates $ print *(e:age 2006/10/04 2006/10/09:) # all files modified on that date $ print *(e:age 2006/10/04:) # Supply times. $ print *(e-age 2006/10/04:10:15 2006/10/04:10:45-) # Remove a trailing pathname component, leaving the head. This works like # `dirname'. $ echo =ls(:h) /bin # Remove all leading pathname components, leaving the tail. This works # like `basename'. $ echo =ls(:t) ls # Remove the suffix from each file (*.sh in this example) $f:e is $f file extension :h --> head (dirname) :t --> tail (basename) :r --> rest (extension removed) $ for f (*.sh) mv $f $f:r # Remove a filename extension of the form `.xxx', leaving the root name. $ echo $PWD /usr/src/linux $ echo $PWD:t linux # Remove all but the extension. $ foo=23.42 $ echo $foo 23.42 $ echo $foo:e 42 # Print the new command but do not execute it. Only works with history # expansion. $ echo =ls(:h) /bin $ !echo:p $ echo =ls(:h) # Quote the substituted words, escaping further substitutions. $ bar="23'42" $ echo $bar 23'42 $ echo $bar:q 23\'42 # Convert the words to all lowercase. $ bar=FOOBAR $ echo $bar FOOBAR $ echo $bar:l foobar # Convert the words to all uppercase. $ bar=foobar $ echo $bar foobar $ echo $bar:u FOOBAR # convert 1st char of a word to uppercase $ foo="one two three four" $ print -r -- "${(C)foo}" One Two Three Four
Redirection-Examples
See zshmisc(1) for more informations (or less ${^fpath}/zmv(N))
# Append `exit 1' at the end of all *.sh - files $ echo "exit 1" >> *.sh # adding files to foobar.tar.gz $ eval set =(gunzip < foobar.tar.gz) ' tar rf $1 additional.txt &&gzip < $1 > foobar.tar.gz' # Redirect output to a file AND display on screen $ foobar >&1 > file1 > file2 > .. # pipe single output to multiple inputs $ zcat foobar.Z >> (gzip -9 > file1.gz) \ >> (bzip2 -9 > file1.bz2) \ >> (acb --best > file1.acb) # Append /etc/services at the end of file `foo' and `bar' $ cat /etc/services >> foo >> bar # Pipe STDERR $ echo An error >&2 2>&1 | sed -e 's/A/I/' # send standard output of one process to standard input of several processes # in the pipeline $ setopt multios $ process1 > >(process1) > >(process2) # initializing a variable and simultaneously keeping terminal output $ setopt multios $ { a=$(command >&1 >& 3 3 > &- 2>&1);} 3>&1 # redirect stderr two times $ setopt multios ; program 2> file2 > file1 2>&1 # Duplicating stdout and stderr to a logfile $ exec 3>&1 > logfile 2>&2 2>&1 >&3 3>&- # redirect stderr (only) to a file and to orig. stderr: $ command 2>&2 2>stderr # redirect stderr and stdout to separate files and both to orig. stdout: $ command 2>&1 1>&1 2>stderr 1>stdout # redirect stderr and stdout to separate files and stdout to orig. stdout # AND stderr to orig. stderr: $ command 2>&2 1>&1 2>stderr 1>stdout # More fun with STDERR ;) $ ./my-script.sh 2> >(grep -v moron >error.log)|process-output >output.log $ echo "Thats STDOUT" >>(sed 's/stdout/another example/' > foobar)
ZMV-Examples (require autoload zmv)
Note: -n means no execution (just print what would happen). At
# Remove illegal characters in a fat32 file system. Illegal characters are # / : ; * ? " < > | # NOTE: ``-Q'' and (D) is to include hidden files. $ unwanted='[:;*?\"<>|]' $ zmv -Q "(**/)(*$~unwanted*)(D)" '$1${2//$~unwanted/}' # Changing part of a filename (i. e. "file-hell.name" -> "file-heaven.name") $ zmv '(*)hell(*)' '${1}heaven${2}' # or $ zmv '*' '$f:s/hell/heaven/' # remove round bracket within filenames # i. e. foo-(bar).avi -> foo-bar.avi $ zmv '*' '${f//[()]/}' # serially all files (foo.foo > 1.foo, fnord.foo > 2.foo, ..) $ autoload zmv $ ls * 1.c asd.foo bla.foo fnord.foo foo.fnord foo.foo $ c=1 zmv '*.foo' '$((c++)).foo' $ ls * 1.c 1.foo 2.foo 3.foo 4.foo foo.fnord # Rename "file.with.many.dots.txt" by substituting dots (exept for the last # one!) with a space $ touch {1..20}-file.with.many.dots.txt $ zmv '(*.*)(.*)' '${1//./ }$2' # Remove the first 4 chars from a filename $ zmv -n '*' '$f[5,-1]' # NOTE: The "5" is NOT a mistake in writing! # Rename names of all files under the current Dir to lower case, but keep # dirnames as-is. $ zmv -Qv '(**/)(*)(.D)' '$1${(L)2}' # replace all 4th character, which is "1", with "2" and so on $ autoload -U zmv $ zmv '(???)1(???[1-4].txt)' '${1}2${2}' # Remove the first 15 characters from a string $ touch<PHONE_NUMBER>11111{a-z} $ autoload zmv $ zmv '*' '$f[16,-1]' # Replace spaces (any number of them) with a single dash in file names $ autload zmv $ zmv -n '(**/)(* *)' '$1${2//( #-## #| ##)/-}' # or - with Bash $ find . -depth -name '* *' -exec bash -c ' > shopt -s extglob > file=$1 > dir=${file%/*} > name=${file##*/} > newname=${name//*([ -]) *([ -])/-} > mv -i -- "$file" "$Dir/$newname"' {} {} \; # Clean up file names and remove special characters $ autoload zmv $ zmv -n '(**/)(*)' '$1${2//[^A-Za-z0-9._]/_}' # Add *.py to a bunch of python scripts in a directory (some of them end # in *.py and give them all a proper extension $ autoload zmv $ zmv -n '(**/)(con*)(#qe,file $REPLY | grep "python script",)' '$1$2.py' # lowercase all extensions (i. e. *.JPG) incl. subfolders $ autoload zmv $ zmv '(**/)(*).(#i)jpg' '$1$2.jpg' # Or - without Zsh $ find Dir -name '*.[jJ][pP][gG]' -print | while read f > do > case $f in > *.jpg) ; > *) mv "$f" "${f%.*}.jpg" ; > esac > done # remove leading zeros from file extension $ autoload zmv $ ls filename.001 filename.003 filename.005 filename.007 filename.009 filename.002 filename.004 filename.006 filename.008 filename.010 $ zmv '(filename.)0##(?*)' '$1$2' $ ls filename.1 filename.10 filename.2 filename.3 filename.4 filename.5 .. # renumber files. $ autoload zmv $ ls * foo_10.jpg foo_2.jpg foo_3.jpg foo_4.jpg foo_5.jpg foo_6.jpg .. $ zmv -fQ 'foo_(<0->).jpg(.nOn)' 'foo_$(($1 + 1)).jpg' $ ls * foo_10.jpg foo_11.jpg foo_3.jpg foo_4.jpg foo_5.jpg ... # adding leading zeros to a filename (1.jpg -> 001.jpg, .. $ autoload zmv $ zmv '(<1->).jpg' '${(l:3::0:)1}.jpg' # See above, but now only files with a filename >= 30 chars $ autoload zmv $ c=1 zmv "${(l:30-4::?:)}*.foo" '$((c++)).foo' # Replace spaces in filenames with a underline $ autoload zmv $ zmv '* *' '$f:gs/ /_' # Change the suffix from *.sh to *.pl $ autoload zmv $ zmv -W '*.sh' '*.pl' # Add a "".txt" extension to all the files within ${HOME} # ``-.'' is to only rename regular files or symlinks to regular files, # ``D'' is to also rename hidden files (dotfiles)) $ autoload zmv $ zmv -Q '/home/**/*(D-.)' '$f.txt' # Or to only rename files that don't have an extension: $ zmv -Q '/home/**/^?*.*(D-.)' '$f.txt' # Recursively change filenames with characters ? [ ] / = + < > ; : " , - * $ autoload zmv $ chars='[][?=+<>;",*-]' $ zmv '(**/)(*)' '$1${2//$~chars/%}' # Removing single quote from filenames (recursively) $ autoload zmv $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}" # When a new file arrives (named file.txt) rename all files in order to # get (e. g. file119.txt becomes file120.txt, file118.txt becomes # file119.txt and so on ending with file.txt becoming file1.txt $ autoload zmv $ zmv -fQ 'file([0-9]##).txt(On)' 'file$(($1 + 1)).txt' # lowercase/uppercase all files/directories $ autoload zmv $ zmv '(*)' '${(L)1}' # lowercase $ zmv '(*)' '${(U)1}' # uppercase # Remove the suffix *.c from all C-Files $ autoload zmv $ zmv '(*).c' '$1' # Uppercase only the first letter of all *.mp3 - files $ autoload zmv $ zmv '([a-z])(*).mp3' '${(C)1}$2.mp3' # Copy the target `README' in same directory as each `Makefile' $ autoload zmv $ zmv -C '(**/)Makefile' '${1}README' # Removing single quote from filenames (recursively) $ autoload zmv $ zmv -Q "(**/)(*'*)(D)" "\$1\${2//'/}" # Rename pic1.jpg, pic2.jpg, .. to pic0001.jpg, pic0002.jpg, .. $ autoload zmv $ zmv 'pic(*).jpg' 'pic${(l:4::0:)1}.jpg' $ zmv '(**/)pic(*).jpg' '$1/pic${(l:4::0:)2}.jpg' # recursively
Module-Examples
Please read zshmodules(1) first!
zsh/pcre (require zmodload zsh/pcre)
# Copy files of a certain period (date indicated in the filenames) $ zmodload zsh/pcre $ ls -d -- *(e:'[[ $REPLY -pcre-match pcre-regexp ]]':) # or $ m() { [[ $1 -pcre-match pcre-regexp ]] } $ ls -d -- *(+m)
zsh/clone (require zmodload zsh/clone)
# Creates a forked instance of the current shell ($! is set to zero) and # execute ``command'' on /dev/tty8 (for this example). $ zmodload zsh/clone $ clone /dev/tty8 && (($! == 0)) && exec command
zsh/datetime (require zmodload zsh/datetime)
$ zmodload zsh/datetime $ alias datereplacement='strftime "%Y-%m-%d" $EPOCHSECONDS' $ export DATE=`datereplacement` $ echo $DATE # strip date from filename $ $ zmodload zsh/datetime $ setopt extendedglob $ touch aaa_bbb_20041212_c.dat eee_fff_20051019_g.dat $ strftime -s pattern \ '???_???_<0-%Y%m%d>_?.dat' $((EPOCHSECONDS - 365 * 24 * 60 * 60 / 2)) $ print -rl -- $~pattern aaa_bbb_20041212_c.dat $ print -rl -- $pattern ???_???_<0-20050815>_?.dat # Search files size == 0, to be based on the file name containing a date # rather than the "last modified" date of the file $ zmodload -i zsh/datetime $ strftime -s file "abc_de_%m%d%Y.dat" $((EPOCHSECONDS - 24 * 60 * 60 )) $ files=(**/$file(N.L0)) $ (( $#files > 0 )) && print -rl -- $files | \ mailx -s "empty files"<EMAIL_ADDRESS>zsh/stat (require zmodload zsh/stat)
# test if a symbolic link links to a certain file $ zmodload -i zsh/stat $ ! stat -LH s foo.ln || [[ $s[link] != "foo.exe" ]] || ln -sf foo.exe foo.ln # comparing file dates $ zmodload zsh/stat $ file1=foo $ file2=bar $ touch bar & sleep 5 & touch foo $ echo $file1 is $(($(stat +mtime $file2) - \ $(stat +mtime $file1))) seconds older than $file2. bar is 5 seconds older than foo # list the files of a disk smaller than some other file $ zmodload zsh/stat $ stat -A max +size some-other-file $ print -rl ./**/*(D.L-$max) # List the top 100 biggest files in a disk $ zmodload zsh/stat $ ls -fld ./**/*(d`stat +device .`OL[1,100]) # Get only the user name and the file names from (like # ls -l * | awk '{print $3" " $8}') $ zmodload zsh/stat $ for file; do > stat -sA user +uid -- "$file" && > print -r -- "$user" "$file" > done # get the difference between actual bytes of file and allocated bytes of file $ zmodload zsh/stat $ print $(($(stat +block -- file) * 512 - $(stat +size -- file))) # Find largest file # ``D'' : to include dot files (d lowercase is for device) # ``O'' : reverse Ordered (o lowercase for non-reverse order) # ``L'' : by file Length (l is for number of links) # ``[1]'': return only first one $ zmodload zsh/stat $ stat +size ./*(DOL[1]) # file size in bytes $ zmodload zsh/stat $ stat -L +size ~/.zshrc 4707 # Delete files in a directory that hasn't been accessed in the last ten days # and send ONE mail to the owner of the files informing him/her of the files' # deletion. $ zmodload zsh/stat zsh/files $ typeset -A f; f=() $ rm -f /path/**/*(.a+10e{'stat -sA u +uidr $REPLY; f[$u]="$f[$u]$REPLY"'}) $ for user (${(k)f}) {print -rn $f[$user]|mailx -s "..." $user} # Get a "ls -l" on all the files in the tree that are younger than a # specified age $ zmodload zsh/stat $ for d (. ./**/*(N/m-2)) > print -r -- $'\n'$d: && cd $d && { > for f (*(Nm-2om)) > stat -F '%b %d %H:%M' -LsAs -- $f && > print -r -- $s[3] ${(l:4:)s[4]} ${(l:8:)s[5]} \ > ${(l:8:)s[6]} ${(l:8:)s[8]} $s[10] $f ${s[14]:+-> $s[14]} > cd ~- > } # get file creation date $ zmodload zsh/stat $ stat -F '%d %m %Y' +mtime ~/.zshrc 30 06 2004 $ stat -F '%D' +mtime ~/.zshrc 06/30/04
zsh/files (require zmodload zsh/files)
# search a directory for files containing a certain string then copy those # files to another directory. $ zmodload zsh/files $ IFS=$'\0' $ cp $(grep -lZr foobar .) otherdirectory
zsh/mapfile (require zmodload zsh/mapfile)
# grepping for two patterns $ zmodload zsh/mapfile $ pattern1="foo" $ pattern2="bar foo" $ print -l ./**/*(DN.e{'z=$mapfile[$REPLY] && [[ $z = *$pattern1* && \ $z = *$pattern2* ]]'}) # or a solution in combination with zsh/pcre $ zmodload -i zsh/mapfile zsh/pcre $ pattern1="foo" $ pattern2="bar foo" $ pcre_compile "(?s)(?=.*?$pattern1).*?$pattern2" $ pcre_study $ print -l ./**/*(DN.e{'pcre_match $mapfile[$REPLY]'}) # equivalent for ``less /etc/passwd | grep -v root'' $ zmodload zsh/mapfile $ IFS=$'\n\n' $ print -rl -- ${${=mapfile[/etc/passwd]}:#*root*} # or - for case insensitive $ setopt extendedglob $ print -rl -- ${${=mapfile[/etc/passwd]}:#*(#i)root*} # If a XML-file contains stuff like ``<TAGA/>'' and ``<TAGB/>'', number # this empty tags (ones ending in '/>') so if encountered in the same # order, the preceeding tags would become ``<TAGA/>1</TAGA>'' and # ``<TAGB/>2</TAGB>'' $ zmodload zsh/mapfile $ cnt=0 $ apfile[data.xml.new]=${(S)mapfile[data.xml]//\ > (#im)<TAGA>*<\/TAGA>/<TAGA>$((++cnt))<\/TAGA>} # removing all files in users Maildir/new that contain ``filename="gone.src'' $ zmodload zsh/{files,mapfile} $ rm -f /u1/??/*/Maildir/new/100*(.e{'[[ $mapfile[$REPLY] == \ *filename=\"gone.scr\"* ]]'}) # Grep out the Title from a postscript file and append that value to the # end of the filename $ autoload -U zmv $ zmodload zsh/mapfile $ zmv '(*).ps' '$1-${${${mapfile[$f]##*%%Title: }%% *}//[^a-zA-Z0-9_]/}.ps'
zsh/mathfunc (require zmodload zsh/mathfunc)
$ zmodload zsh/mathfunc $ echo $(( sin(1/4.0)**2 + cos(1/4.0)**2 - 1 )) -1.1102230246251565e-16 $ echo $(( pi = 4.0 * atan(1.0) )) 3.1415926535897931 $ echo $(( f = sin(0.3) )) 0.29552020666133955 $ print $((1e12 * rand48()))<PHONE_NUMBER>10.23413 $ print $(( rand48(seed) )) 0.01043488334700271
zsh/termcap (require zmodload zsh/termcap)
$ zmodload -ab zsh/termcap echotc $ GREEN=`echotc AF 2` $ YELLOW=`echotc AF 3` $ RED=`echotc AF 1` $ BRIGHTRED=`echotc md ; echotc AF 1` $ print -l ${GREEN}green ${YELLOW}yellow ${RED}red ${BRIGHTRED}brightred
zsh/zpty (require zmodload zsh/zpty)
$ zmodload zsh/zpty $ zpty PW passwd $1 $ zpty PW passwd $1 # ``-r'': read the output of the command name. # ``z'' : Parameter $ zpty -r PW z '*password:' # send the to command name the given strings as input $ zpty -w PW $2 $ zpty -r PW z '*password:' $ zpty -w PW $2 # The second form, with the -d option, is used to delete commands # previously started, by supplying a list of their names. If no names # are given, all commands are deleted. Deleting a command causes the HUP # signal to be sent to the corresponding process. $ zpty -d PW
zsh/net/socket (require zmodload zsh/net/socket)
# ``-l'': open a socket listening on filename # ``-d'': argument will be taken as the target file descriptor for the # connection # ``3'' : file descriptor. See ``A User's Guide to the Z-Shell'' # (3.7.2: File descriptors) $ zmodload zsh/net/socket $ zsocket -l -d 3 # ``-a'': accept an incoming connection to the socket $ zsocket -a -d 4 3 $ zsocket -a -d 5 3 # accept a connection $ echo foobar >&4 $ echo barfoo >&5 $ 4>&- 5>&- 3>&
zsh/zftp (require zmodload zsh/zftp)
$ autoload -U zfinit $ zfinit $ zfparams www.example.invalid myuserid mypassword $ zfopen $ zfcd tips $ zfls -l zshtips.html $ zfput zshtips.html $ zfls -l zshtips.html # Automatically transfer files using FTP with error checking $ autoload -U zfinit ; zfinit $ zftp open host.name.invalid user passwd || exit $ zftp get /remote/file > /local/file; r=$? $ zftp close && exit r # compress and ftp on the fly $ autoload -U zfinit ; zfinit $ zftp open host.name.invalid user password $ zftp get $file | bzip2 > ${file}.bz2 $ zftp close # Recursice ``get'' $ autoload -U zfinit ; zfinit $ zfanon cr.yp.to $ zfcd daemontools $ for file in `zfls` ; do > zfget $file $ done $ zfclose # Upload all regular files in $HOME/foobar (recursive) that are newer than # two hours to ftp.foobar.invalid/path/to/upload $ autoload -U zfinit ; zfinit $ zfopen ftp.foobar.invalid/path/to/upload $ cd $HOME/foobar $ zfput -r **/*(.mh-2) $ zfclose # long list of files on a ftp $ autoload -U zfinit ; zfinit $ zfopen some-host $ zfcd /some/remote/Dir $ cd /some/local/Dir # If the list.txt is located on the remote host, change to # zfget ${(f)"$(zftp get /path/to/remote/list.txt)"} $ zfget ${(f)"$(cat list.txt)"} $ zfclose
zsh/zselect (require zmodload zsh/zselect)
# It's similar to ,---- | $ sg=$(stty -g) | $ stty -icanon min 0 time 50 | $ read yesno | $ stty "$sg" | $ case "$yesno" in | > yes) command1;; | > *) command2;; | > esac `---- $ zmodload zsh/zselect $ if zselect -t 500 -r 0 && read yesno && [ yes = "$yesno" ]; then > command1 > else > command1 > fi
OPTIONS
Navigation options
auto_cd (allow one to change to a directory by entering it as a command). auto_pushd (automatically append dirs to the push/pop list) pushd_ignore_dups (and don’t duplicate them).
Misc
no_hup (don’t send HUP signal to background jobs when exiting ZSH). print_exit_value (show a message with the exit code when a command returns with a non-zero exit code)
History options
hist_verify (let the user edit the command line after history
expansion (e.g. !ls) instead of immediately running it)
Use the same history file for all sessions :
setopt SHARE_HISTORY
Privacy / Security
no_clobber (or set -C; prevent > redirection from truncating the given file if it already exists)
Spelling correction
correct (automatically correct the spelling of commands). correct_all (automatically correct the spelling of each word on the command line) dvorak (dvorak layout)
UNSORTED/MISC
Mailpath: simple multiple mailpath:
mailpath=($HOME/Mail/mbox'?new mail in mbox' $HOME/Mail/tux.u-strasbg'?new mail in tux' $HOME/Mail/lilo'?new mail in lilo' $HOME/Mail/ldap-fr'?new mail in ldap-fr')
Mailpath: dynamic mailpath:
typeset -a mailpath for i in ~/Mail/Lists/*(.); do mailpath[$#mailpath+1]="${i}?You have new mail in ${i:t}." done
Avoid globbing on special commands:
for com in alias expr find mattrib mcopy mdir mdel which; alias $com="noglob $com"
For migrating your bashprompt to zsh use the script bash2zshprompt located in the zsh source distribution under Misc.
For migration from (t)csh to zsh use the c2z tool that converts csh aliases and environment and shell variables to zsh. It does this by running csh, and having csh report on aliases and variables. The script then converts these to zsh startup files. It has some issues and usage information that are documented at the top of this script.
Here are functions to set the title and hardstatus of an XTerm or of GNU Screen to zsh and the current directory, respectively, when the prompt is displayed, and to the command name and rest of the command line, respectively, when a command is executed:
function title { if [[ $TERM == "screen" ]]; then # Use these two for GNU Screen: print -nR $' 33k'$1$' 33'\ print -nR $' 33]0;'$2$'' elif [[ $TERM == "xterm" || $TERM == "rxvt" ]]; then # Use this one instead for XTerms: print -nR $' 33]0;'$*$'' fi } function precmd { title zsh "$PWD" } function preexec { emulate -L zsh local -a cmd; cmd=(${(z)1}) title $cmd[1]:t "$cmd[2,-1]" }
Put the following line into your ~/.screenrc to see this fancy hardstatus:
caption always "%3n %t%? (%u)%?%?: %h%?"
Special variables which are assigned:
$LINENO $RANDOM $SECONDS $COLUMNS $HISTCHARS $UID $EUID $GID $EGID $USERNAME $fignore $mailpath $cdpath
LINKS
- Primary site
- Project-page
- Z shell page at sunsite.dk
- From Bash to Z Shell: Conquering the Command Line - the book
- "Zsh - die magische Shell" (german book about Zsh) by Sven Guckes and Julius Plenz
- Mailinglistarchive
- ZSH-FAQ
- Userguide
- ZSH-Wiki
- A short introduction from BYU
- Mouse-Support ;)
- Curtains up: introducing the Z shell
-
http://www-128.ibm.com/developerworks/linux/library/l-z.html?dwzone=linux
- ZSH-Liebhaberseite (german)
- ZSH-Seite von Michael Prokop (german)
- ZSH Prompt introduction
- ft’s zsh configuration
- Adam’s ZSH page
- Zzappers Best of ZSH Tips
- Zsh Webpage by Christian Schneider
- The zsh-lovers webpage
- IRC channel
-
#zsh at irc.freenode.org
- The Z shell reference-card (included in the zsh-lovers debian-package)
AUTHORS
This manpage was written by Michael Prokop, Christian strcat
Schneider and Matthias Kopfermann. But many ideas have been taken from
zsh-geeks e.g. from the zsh-mailinglists (zsh-users and zsh-workers),
google, newsgroups and the zsh-Wiki.
Thanks for your cool and incredible tips. We learned much from you!
In alphabetic order:
Andrew 'zefram' Main - http://www.fysh.org/~zefram/ Barton E. Schaefer - http://www.well.com/user/barts/ Matthias Kopfermann - http://www.infodrom.north.de/~matthi/ Oliver Kiddle - http://people.freenet.de/opk/ Paul Falstad - http://www.falstad.com/ Peter Stephenson - http://homepage.ntlworld.com/p.w.stephenson/ Richard Coleman Stephane Chazelas - http://stephane.chazelas.free.fr/ Sven Guckes - http://www.guckes.net/ Sven Wischnowsky - http://w9y.de/zsh/zshrc
SEE ALSO
Manpages of zsh:
zsh Zsh overview zshall Tthe Z shell meta-man page zshbuiltins Zsh built-in commands zshcalsys zsh calendar system zshcompctl zsh programmable completion zshcompsys Zsh completion system zshcompwid Zsh completion widgets zshcontrib User contributions to zsh zshexpn Zsh expansion and substitution zshmisc Anything not fitting into the other sections zshmodules Zsh loadable modules zshoptions Zsh options zshparam Zsh parameters zshroadmap Informal introduction to the zsh manual zshtcpsys Zsh tcp system zshzle Zsh command line editing zshzftpsys Zsh built-in FTP client zshall Meta-man page containing all of the above
Note: especially man zshcontrib covers very useful topics!
Book: From Bash to Z Shell by Oliver Kiddle, Jerry Peck and Peter
Stephenson. ISBN:<PHONE_NUMBER>. - bash2zsh.com
Also take a look at the section LINKS in this manpage.
BUGS
Probably. This manpage might be never complete. So please report bugs, feedback and suggestions to<EMAIL_ADDRESS>Thank you!
COPYRIGHT
Copyright (C) Michael Prokop, Christian Schneider and Matthias Kopfermann.


~PLATO~
Feel Better?
We Need a Mental Compass Regardless Of How Smart We Are; For When Will Our Actions Go Too Far?
We Need an Answer. Truely, No One Really Knows What's Going On
We Choose What We Care For; That's One of the Only Things We CAN Control


Home🏡
About👋
Instructions🔍
Login📍
❣ Sign Up ❣
👋 Full Name 👋
🎒 What are your interests? 🎒
🧁 Pick your Avatar! 🧁
📧 Email address 📧
We'll never share your email with anyone else.
🔐 Password 🔐
🌈 Submit 🌈


inceptions
The Inception v3 network is a tensorflow convolutional neural network trained to distinguish between 1000 different categories from ImageNet. It was trained for the ImageNet Large Visual Recognition Challenge using the data from 2012. Happily for us, it is possible to retrain this model to create our own image classifier for specific image tasks.
what is retraining?
We can retrain the inception model by keeping all the trained layers in tact bar the last one. The first layers are responsible for things like picking out edges and basic shapes. These are necessary and universal steps for CNNs used in image classification and take a long time and a lot of images to train. The final layer of the neural net is where you can train the neural net to distinguish between certain flowers or animals, etc. Even happilyer for us, retraining this last step is well-documented and doesn’t take much time or data so we can get right to it.
I used Google’s Tensorflow for Poets codelab as my guide for this because it’s super good.
tensorflow for poets steps
one: docker
You need to have Docker installed
two: the image set
We need to have a dataset to retrain on. The codelab provides a dataset of different flowers if you just want to try it out but don’t have a specific idea. If you do, then organise your image files like this:
With images belonging to specific categories in folders named after that category.  I used ImageNet to get my dataset. The image set for fire that I downloaded unsurprisingly contained a lot of fireplaces, and the smoke set contained a lot of tanks for some reason. I suppose combat is a smokey affair.. But I wanted to avoid the model deciding that because an image contained a tank, it would score high for ‘smoke’ and because an image contained an empty fireplace, it would score high for ‘fire’. To try and counteract this, I added a third miscellaneous category and included lots of images of empty fireplaces and non-smoking tanks to try and balance out the overall image set.
three: link image set to docker
In order for the docker image to use the image files for retraining, we need to give the docker image access to the relevant folder, in this case tf_files
:
docker run -it -v $HOME/tf_files:/tf_files gcr.io/tensorflow/tensorflow:latest-devel
four: get inception code
The we have to retrieve the code for the Inception v3 framework…
bash
cd /tensorflow
git pull
five: retrain the model
bash
# In Docker
python tensorflow/examples/image_retraining/retrain.py \
--bottleneck_dir=/tf_files/bottlenecks \
--model_dir=/tf_files/inception \
--output_graph=/tf_files/retrained_graph.pb \
--output_labels=/tf_files/retrained_labels.txt \
--image_dir /tf_files/<imageset folder>
This will set off the process. It’s that simple!. This process takes a little while, maybe half an hour. It generates ‘bottlenecks’. This is the term used for the layer just before the final output layer that we retrain to do the classification. The values are stored in /tmp/bottleneck
so if you ever need to retrain again those values don’t have to be calculated.
By default, the script runs 4000 training steps, but this can be adjusted. At each iteration, 10 images are picked at random from the training set and fed into the final prediction layer. The predictions are checked for accuracy by comparing them to the actual labels and then the final layer’s weights are updated accordingly through back-propogation. It’s quite fun to watch the accuracy score change as they are printed during training. There are two types of accuracy, the training accuracy and the validation accuracy. The validation accuracy is the important one. That’s the one that looks at test images, i.e. labeled images that the model hasn’t been trained on. The training accuracy is also important but a high score for that could mean the model is overfitting. Both the training and validation accuracies should be high before it is a reliable model.
The model ran for 4000 iterations, completing with a final test accuracy
of 94.4%
. I wanted to test it myself so downloaded a selection of images to run through the model and see what results it would give. Google codelabs provides you will a little python script that you can just curl neatly into a file called label_image.py
and store in the tf_files
folder.
```python import tensorflow as tf, sys
change this as you see fit
image_path = sys.argv[1]
Read in the image_data
image_data = tf.gfile.FastGFile(image_path, ‘rb’).read()
Loads label file, strips off carriage return
label_lines = [line.rstrip() for line in tf.gfile.GFile(“tf_files/retrained_labels.txt”)]
Unpersists graph from file
with tf.gfile.FastGFile(“tf_files/retrained_graph.pb”, ‘rb’) as f: graph_def = tf.GraphDef() graph_def.ParseFromString(f.read()) _ = tf.import_graph_def(graph_def, name=’’)
with tf.Session() as sess: # Feed the image_data as input to the graph and get first prediction softmax_tensor = sess.graph.get_tensor_by_name(‘final_result:0’)
predictions = sess.run(softmax_tensor, \
{'DecodeJpeg/contents:0': image_data})
# Sort to show labels of first prediction in order of confidence
top_k = predictions[0].argsort()[-len(predictions[0]):][::-1]
for node_id in top_k:
human_string = label_lines[node_id]
score = predictions[0][node_id]
print('%s (score = %.5f)' % (human_string, score)) ```
This is where you get the script:
# type 'exit' to exit Docker and then:
curl -L https://goo.gl/tx3dqg > $HOME/tf_files/label_image.py
I created a folder in tf_files
called test_images
, where I could store an image that I wanted to run through the model. Then I could restart docker linked to tf_files
,
$ docker run -it -v $HOME/tf_files:/tf_files gcr.io/tensorflow/tensorflow:latest-devel
and run the following command:
# In Docker
$ python /tf_files/label_image.py /tf_files/test_images/Campfire.jpg
Every time an image is passed through, the model returns a probability score for each category. So when I gave it this calming beach campfire image:
these were the returned scores:
```bash
fire (score = 0.86540) smoke (score = 0.12902) misc (score = 0.00558) ```
whereas a burning cigarette:
resulted in this:
``` smoke (score = 0.79379) fire (score = 0.15999) misc (score = 0.04622)
```
and a happy raccoon:
was not much of any of them (although that is some smokey fur…):
smoke (score = 0.48583)
misc (score = 0.28314)
fire (score = 0.23103)
I wanted to label a whole bunch of images to test the effectiveness of the model in multiple different areas, so I tweaked the code to run for all the images in the test_images
folder by adding this line inside the tf.Session():
python
for filename in os.listdir(sys.argv[1]):
if filename.endswith(".jpg") or filename.endswith(".jpeg"):
The code worked great, but also revealed some problems with the model. Images that contained a lot of white or light grey were labeled as having a high probability score for ‘smoke’, and despite the fire dataset containing the most images (almost 2000), fire was not likely to be labeled correctly.  In practice perhaps this isn’t a huge problem because if smoke or fire is detected that is enough of a safety measure.
I suppose this means some updating to the dataset may be in order! More to come…


--- layout: post title: 'Deploying GlusterFS using Ansible' date: '2016-07-01T09:39:24+01:00' tags: - redhat - ansible - configuration - management - cfgmgmt - glusterfs - gluster - gdeploy - deployment - filesystem - distributed - replicated - configuration - installation - multiple ---
During last weeks I've been playing with two new technologies and I though it might be useful to mix them up: Ansible & GlusterFS.
The most annoying part of a GlusterFS engagement is the nodes' setup & configuration, RHN registration, subscriptions management, packages installation, etc.
Just think to all these activities per multiple nodes: a really time wasting job!
So I decided to start playing with Ansible for automating the whole process and take the great advantage of this tool.
I'll describe two ways:
Please note: for the whole tests I'm using vagrant virtual machines and vagrant dynamic inventory script.
For more information you can refer to: Ansible and Vagrant: setup your testing lab in minutes!
Just for testing Ansible features I wrote two test playbooks for:
And then:
This is the first playbook, that we'll use for registering the vagrant instance to RHN and for updating the systems.
-> Please don't forget change your RHN_username with yours.
[alex@freddy test_gluster]$ cat init.yml
- hosts: vagrant
vars:
RHN_username<EMAIL_ADDRESS># Change it with your RHN username!
RHN_poolname: "RH SKU"
vars_prompt:
- name: "RHN_password"
prompt: Please input RHN password
tasks:
- name: Checking if it's already registered to RHN
become: yes
ignore_errors: True
shell: "subscription-manager status"
register: result
- name: Subscribe to RHN
become: yes
redhat_subscription: username={{ RHN_username }} password={{ RHN_password }} pool={{ RHN_poolname }}
when: result.rc|int > 0
- name: Enable chosen repositories
become: yes
command: "subscription-manager repos --disable '*' --enable rhel-7-server-rpms --enable rhel-7-server-optional-rpms --enable rhel-7-server-extras-rpms --enable rh-gluster-3-for-rhel-7-server-rpms"
- name: Update the system
become: yes
yum: state=latest name='*'
We are now ready to test the registration playbook.
Note: in this case I'll use default vagrant dynamic inventory script, set in /etc/ansible/ansible.cfg
[alex@freddy test_gluster]$ ansible-playbook init.yml
Please input RHN password:
PLAY [vagrant] *****************************************************************
TASK [setup] *******************************************************************
ok: [gluster3]
ok: [gluster4]
ok: [gluster2]
ok: [gluster1]
TASK [Checking if it's already registered to RHN] ******************************
fatal: [gluster3]: FAILED! => {"changed": true, "cmd": "subscription-manager status", "delta": "0:00:03.126296", "end": "2016-06-24 09:42:05.565593", "failed": true, "rc": 1, "start": "2016-06-24 09:42:02.439297", "stderr": "", "stdout": "+-------------------------------------------+\n System Status Details\n+-------------------------------------------+\nOverall Status: Unknown", "stdout_lines": ["+-------------------------------------------+", " System Status Details", "+-------------------------------------------+", "Overall Status: Unknown"], "warnings": []}
...ignoring
fatal: [gluster4]: FAILED! => {"changed": true, "cmd": "subscription-manager status", "delta": "0:00:03.431978", "end": "2016-06-24 09:42:05.685565", "failed": true, "rc": 1, "start": "2016-06-24 09:42:02.253587", "stderr": "", "stdout": "+-------------------------------------------+\n System Status Details\n+-------------------------------------------+\nOverall Status: Unknown", "stdout_lines": ["+-------------------------------------------+", " System Status Details", "+-------------------------------------------+", "Overall Status: Unknown"], "warnings": []}
...ignoring
fatal: [gluster1]: FAILED! => {"changed": true, "cmd": "subscription-manager status", "delta": "0:00:04.199137", "end": "2016-06-24 09:42:06.260388", "failed": true, "rc": 1, "start": "2016-06-24 09:42:02.061251", "stderr": "", "stdout": "+-------------------------------------------+\n System Status Details\n+-------------------------------------------+\nOverall Status: Unknown", "stdout_lines": ["+-------------------------------------------+", " System Status Details", "+-------------------------------------------+", "Overall Status: Unknown"], "warnings": []}
...ignoring
fatal: [gluster2]: FAILED! => {"changed": true, "cmd": "subscription-manager status", "delta": "0:00:05.895824", "end": "2016-06-24 09:42:08.195838", "failed": true, "rc": 1, "start": "2016-06-24 09:42:02.300014", "stderr": "", "stdout": "+-------------------------------------------+\n System Status Details\n+-------------------------------------------+\nOverall Status: Unknown", "stdout_lines": ["+-------------------------------------------+", " System Status Details", "+-------------------------------------------+", "Overall Status: Unknown"], "warnings": []}
...ignoring
TASK [Subscribe to RHN] ********************************************************
changed: [gluster1]
changed: [gluster3]
changed: [gluster2]
changed: [gluster4]
TASK [Enable chosen repositories] **********************************************
changed: [gluster2]
changed: [gluster4]
changed: [gluster3]
changed: [gluster1]
TASK [Update the system] *******************************************************
ok: [gluster2]
ok: [gluster3]
changed: [gluster1]
changed: [gluster4]
PLAY RECAP *********************************************************************
gluster1 : ok=5 changed=3 unreachable=0 failed=0
gluster2 : ok=5 changed=2 unreachable=0 failed=0
gluster3 : ok=5 changed=2 unreachable=0 failed=0
gluster4 : ok=5 changed=3 unreachable=0 failed=0
We are ready to setup our gluster environment using the following playbook.
I'll try to describe all the tasks I've created in the playbook:
[alex@freddy test_gluster]$ cat gluster.yml
---
- hosts: vagrant
become: yes
vars:
config_lvm: true
create: true
create_vgname: vg_gluster
create_lvname: lv_gluster
create_lvsize: 100%FREE
new_disk: /dev/vdb
filesystem: xfs
gluster_mount_dir: /mnt/gluster
gluster_mount_brick_dir: /srv/gluster
gluster_brick_dir: "{{gluster_mount_brick_dir}}/brick01"
gluster_brick_name: gluster
tasks:
- name: installing system-storage-manager
yum: name=system-storage-manager state=present
when: config_lvm and ansible_os_family == "RedHat"
- name: installing lvm2
yum: name=lvm2 state=present
when: config_lvm and ansible_os_family == "RedHat"
- name: installing sg3_utils
yum: name=sg3_utils state=present
when: config_lvm and ansible_os_family == "RedHat"
- name: creating new LVM volume group
lvg: vg={{ create_vgname }} pvs={{ new_disk }} state=present
when: create and config_lvm
- name: checking if we need to create logical volume
shell: lvs | grep -c {{ create_lvname }}
ignore_errors: yes
register: lv_result
when: create and config_lvm
- name: creating new LVM logical volume
lvol: vg={{ create_vgname }} lv={{ create_lvname }} size={{ create_lvsize }}
when: create and config_lvm and lv_result.stdout|int == 0
- name: creating new filesystem on new LVM logical volume
filesystem: fstype={{ filesystem }} dev=/dev/{{ create_vgname }}/{{ create_lvname }}
when: create and config_lvm
- name: Ensure GlusterFS is installed.
yum:
name: "{{ item }}"
state: installed
with_items:
- glusterfs-server
- glusterfs-client
- name: Ensure GlusterFS daemon is enabled and running.
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- glusterd
- name: Ensure Gluster mount client and brick directories exist.
file: "path={{ item }} state=directory mode=0775"
with_items:
- "{{ gluster_mount_dir }}"
- "{{ gluster_mount_brick_dir }}"
- name: mounting new filesystem
mount: name={{ gluster_mount_brick_dir }} src=/dev/{{ create_vgname }}/{{ create_lvname }} fstype={{ filesystem }} state=mounted
when: create and config_lvm
- name: Ensure Gluster brick directory exist.
file: "path={{ item }} state=directory mode=0775"
with_items:
- "{{ gluster_brick_dir }}"
- name: enabling firewall tcp communication for every gluster node
firewalld: port={{item}}/tcp permanent=True state=enabled immediate=True zone=public
with_items: [ 111, 139, 445, 965, 2049, 24007, 24009, 38465, 38466, 38468, 38469, 39543, 49152, 55863 ]
- name: enabling firewall udp communication for every gluster node
firewalld: port={{item}}/udp permanent=true state=enabled immediate=True zone=public
with_items: [ 111, 963 ]
- name: "Build hosts file"
lineinfile: dest=/etc/hosts regexp='.*{{ item }}$' line="{{ hostvars[item].ansible_default_ipv4.address }} {{item}}" state=present
when: hostvars[item].ansible_default_ipv4.address is defined
with_items: groups['all']
- name: Configure Gluster volume.
gluster_volume:
state: present
name: "{{ gluster_brick_name }}"
brick: "{{ gluster_brick_dir }}"
replicas: 4
cluster: "{{ groups.vagrant | join(',') }}"
host: "{{ inventory_hostname }}"
run_once: true
- name: Ensure Gluster volume is mounted.
mount:
name: "{{ gluster_mount_dir }}"
src: "{{ inventory_hostname }}:/{{ gluster_brick_name }}"
fstype: glusterfs
opts: "defaults,_netdev"
state: mounted
Let's try it:
[alex@freddy test_gluster]$ ansible-playbook gluster.yml
PLAY [vagrant] *****************************************************************
TASK [setup] *******************************************************************
ok: [gluster2]
ok: [gluster3]
ok: [gluster1]
ok: [gluster4]
...
That's all!
Looking at the previous paragraph, you can imagine the effort you may spend for creating this kind of playbook: write, test, fix, rewrite, test, fix, etc. etc.
Luckily we have a very powerful tool from GlusterFS repository: gdeploy.
Just for quoting the gdeploy official description:
What is gdeploy?
gdeploy is a tool to set-up and deploy GlusterFS using ansible over multiple hosts. gdeploy is written to be modular, it can be used to deploy any software depending on how the configuration file is written.
gdeploy can be used to set-up bricks for GlusterFS, create a GlusterFS volume and mount it on one or more clients from an ansible installed machine. The framework reads a configuration file and applies on the hosts listed in the configuration file.
Gdeploy could also be used directly from your notebook, it doesn't require to be installed on one of the gluster nodes. It only depends on Ansible but unluckily it cannot be integrated with Ansible Dynamic Intentories.
For that matter you have to use _only_ it's cluster configuration file defining the inventory and all the parameters inside.
Another annoying fact is that you cannot use Ansible's standard way for hosts defining, gdeploy hosts section it's only a list of addresses. This implies that you will able to use _only_ root to deploy GlusterFS using gdeploy through your default SSH key.
For more information on gdeploy you can take a look at: GitHub - gluster/gdeploy: Tool to deploy glusterfs
The latest RPM version of gdeploy can be downloaded at: Index of /pub/gluster/gdeploy/LATEST
You can use the community RPM version also to deploy RH GlusterFS packages on RHEL machines.
Let's take a look on a cluster.conf I've setup for configuring 4 gluster vm from zero:
[alex@freddy test_gluster]$ cat 2x2-volume-create.conf
#
# Usage:
# gdeploy -c 2x2-volume-create.conf
#
# This does backend setup first and then create the volume using the
# setup bricks.
#
#
[hosts]
<IP_ADDRESS>
<IP_ADDRESS>
<IP_ADDRESS>
<IP_ADDRESS>
[RH-subscription]
action=register
<EMAIL_ADDRESS># You should change this
password=MY_PASSWORD # You should change this
pool=8a8f981407da00b997cb2 # You should change this
repos=rhel-7-server-rpms,rhel-7-server-optional-rpms,rhel-7-server-extras-rpms,rh-gluster-3-for-rhel-7-server-rpms
[yum]
action=install
packages=lvm2,glusterfs-server,glusterfs-client
[firewalld]
action=add
ports=111/tcp,139/tcp,445/tcp,965/tcp,2049/tcp,24007/tcp,24009/tcp,38465/tcp,38466/tcp,38468/tcp,38469/tcp,39543/tcp,49152/tcp,55863/tcp,111/udp,963/udp
permanent=true
zone=public
# Common backend setup for the hosts.
[backend-setup]
devices=vdb
vgs=vg_gluster
pools=pool_gluster
lvs=lv_gluster
mountpoints=/mnt/data
brick_dirs=/mnt/data/brick1
[volume]
action=create
volname=sample_gluster_vol
replica=yes
replica_count=2
force=yes
[clients]
action=mount
volname=sample_gluster_vol
hosts=<IP_ADDRESS>
fstype=glusterfs
client_mount_points=/mnt/mountGluster
As you can see I just started defining the hosts involved in the installation/configuration process, after that I defined RHN subscription details and yum, firewalld configuration.
The backend-setup, volume and clients sections refer to the real GlusterFS configuration, in this example I'll configure a volume with replica 2 on the four hosts and then I use one of these hosts to mount the final GlusterFS volume.
The process is not so fast but at least is automated!
For testing the configuration file after defined all the needed values, you can just run (supposing you installed gdeploy by RPM):
[alex@freddy test_gluster]$ gdeploy -c 2x2-volume-create.conf
...
In my case using vagrant machines I have to run it twice because lvm2 is not installed in my VMs and the yum install process it's executed only after the lvm setup (that fails in my case because of lvm2 missing package).
Please note: for obtaining in a fast way the ip addresses from a vagrant multi-vms setup, you can just run:
[alex@freddy test_gluster]$ vagrant ssh-config | grep HostName | egrep -o [0-9.]+
<IP_ADDRESS>
<IP_ADDRESS>
<IP_ADDRESS>
<IP_ADDRESS>
One more thing: as I said before, gdeploy expects to use root user during ansible deployment, for that matter you should deploy your default SSH key under root's HOME for making gdeploy to work properly.
You can complete it by running a simple Ansible's command like:
[alex@freddy test_gluster]$ ansible all -b -m authorized_key -a "user=root key={{ lookup('file', '/home/alex/.ssh/id_rsa.pub') }}"
gluster3 | SUCCESS => {
"changed": true,
...
If everything worked fine it should end without any relevant errors and connecting to the chosen client you should find your GlusterFS volume mounted and ready to be used!
For more information take a look to the following links.
If you have any comments/questions please comment!


Subject
details
Following is the list of fields.
Object
extends from Object
and for information about extended data members refer here.
Following is the list of data-member and other processing functions.
Following is the list of activity functions.
Object
extends from Object
and for information about activity functions refer here.
Following section implements Object
and demonstrates its functionality.
Reference implementation code is mentioned below.
Javascript: /** * CRUDObserver reference program implementation. * * @returns {undefined} */ function programCode() { var instance = this; instance.ov = new ObjectView({ 'uri': "[[@{/store/color}]]", 'observer': new ObjectObserver({'content': new Color({}), 'messages': intialize(new MessageRepository())}) }); instance.getView = function () { return instance.ov; }; } $(function () { var program = new programCode(); ko.applyBindings(program.getView()); });


Indianajmh Games
Home Page
Discord Server
Archives
YouTube Videos
Source Code
Send Feedback
Report Bugs
Caption Text
Caption Two
Caption Three
Empty.
WE GOT OUR NEW SITE!
What a great time to have a cozy looking website...
Join the Indianajmh Games Discord server for contect if you need help, have suggestions, or have bugs to report.
Open Discord Server Invite Link
Latest from Indianajmh
WEIRD ORES AND A BANDIT ATTACK | Minecraft Funny Moments
We found weird ores such as graphite, sulfur and copper, along with being repeatedly annihilated by
indianajmh
Subscribe to Indianajmh :)He makes cool videos!.
Send Feedback or Report Bugs by joining the Indianajmh Games Discord server.
Go Back to Home Page
Website operated by Indianajmh Games.
Website template created by MORTADA KILLER0 and PinkRinku.
Great to see you again little friend!Not many things got changed.
Remove Message


Australias Commonwealth Marine Reserves - IUCN Zone
World Heritage Areas
Commonwealth Heritage List Australia
Collaborative Australian Protected Areas Database (CAPAD) 2014
Directory of Important Wetlands
Australias Key Ecological Features
Ramsar Wetlands of Australia
Species occurances


Posts for year 2013
- Kororareka Beach, Bay of Islands, New Zealand
- The Open Media Textbook Hack
- Review is the Key to Open Access
- The Need for Libre Open Access
- Open Access Megajournals
- Levelling Up to Open Research Data
- Kakahi Falls Near Tawhata
- A Big Year -- OA in Australia 2013
- Creative Commons & Copyright Reform
- LINZ Data Service
- Statistics NZ
- Ministry for the Environment
- Megapode
- Vicky Holloway
- Wikihouse NZ
- The Vertical Cinema Manifesto
- Headlands
- Dan Untitled
- Jem Yoshioka
- The Waikato Independent
- Man from the city
- Wiki New Zealand
- Jon Lemmon
- Riverbank painting, series 7
- Ministry for Culture & Heritage
- GNS and Geonet
- Bonnie Glen and McCurdy's Castle
- The Magic Pen
- Dylan Horrocks
- Towards an Open Archive: UC CEISMIC


Queens College, CUNY
NodeJS, ExpressJS, NestJS
GraphQL, Apollo
Mongoose, Sequelize
Java, Spring, Hibernate
Python, SQL Alchemy
AWS, Google Cloud, Netlify
----------------------------------------
HTML5, CSS3, SCSS
JavaScript, TypeScript
React, Redux, D3
GraphQL, Apollo
Formik, Axios, Storybook
Angular 4
----------------------------------------
Git, GitHub
NPM, Yarn
Babel, Webpack
Docker
CircleCI
GitHub Actions
----------------------------------------
Jest, Cypress
React Testing Library
JUnit
Postman
----------------------------------------
MongoDB
PostgreSQL
Redis
Spanner
----------------------------------------
Python
Jupyter, Google Colab
Matplotlib, NumPy, Pandas
Scikit-Learn, SciPy
----------------------------------------
Object-Oriented Design
Data Structures, Algorithms
System Design, RPC, REST
Distributed Systems, Microservices
Caching, Containerization, Logging
----------------------------------------
Scrum, Kanban
Jira, Project Management
Notion, Documentation
Miro, Figma
Slack
----------------------------------------
Unity Game Engine
C#
Oculus Rift
GoMap
Merge Cube
----------------------------------------
During the engineering internship at BotFactory, while working on 3D printers & their softwares, with the guide of my supervisors, I discovered my strong passion for Software Engineering.
My urge took me to Queens College to begin my pursuit in CS. My background in Electrical Engineering helped me understand CS in a whole new different level. Graduated in May, 2019.
Residency @ NYC Tech Talent Pipeline. Completed a highly selective program (Acceptance Rate is less than 15%) delivered by the New York Code + Design Academy for Full-Stack Web Development & Soft Skills in a 25-student-team.
Software Engineering Intern at Neuromatters. Assisted & developed VR games, integrating Oculus Rift with Brain Computer Interface Technologies (EEG). Designed & built a client-facing data-visualization web app to analyze brain data.
Software Engineer & Scrum Master
at MEDefine. Managed a team of 4 developers for 2 intensive sprints. Led series of user interviews & clarified user stories. Initiated & arranged proper system design. Built a secure user authentication system with SSL encrypted remote database connection using Java Servlets, MySQL, BCrypt, AWS, Apache Tomcat & J2EE.
Internet & Web Technologies class at QC. Learned & experimented with various internet protocols, architectures, designs, DOM manipulation, webscraping, data exchange, AJAX, JavaScript, NodeJS, SQL, NoSQL, mobile web development & APIs.
Explored, researched & learned more CS: Big Data Algorithms & Data Structures, Data Mining & Warehousing, Distributed Systems, Biometerics Security & Privacy, Image Processing, OS, Computer Graphics, JVM & Compilers. Expanded my knowledge scope.
Nothing is better than doing projects to learn new tools & frameworks. For that reason, I self-motivated & built Emaily, web app to create email surveys. Implemented MongoDB, ExpressJS, React, NodeJS, Redux, PassportJS, Google OAuth 2.0, Stripe, SendGrid, Git & Heroku.
Designed & built a Web App for Splitting Bills & Remembering What Friends Owe to Each Other, using HTML5, CSS3, React, Redux, NodeJS, ExpressJS, D3, PassportJS, Google OAuth 2.0, SendGrid, MongoDB & Heroku.
Team productivity & efficiency. Started working as a freelancer for BotFactory, building new custom features & upgraded existing features of ERP & CRM systems on Odoo for the company's engineering teams & sale teams, using Python, XML, Javascript, JavaVM, Qweb & Linux.
Full-Stack Engineer at Mphasis. Working on client projects using Java, Spring, NodeJS, ExpressJS, Hibernate, Sequelize, Oracle, MySQL, HTML5, CSS3, Angular 4, React, Redux, JUnit, Jest, Git & APIs.
Social Network Visualizer. A tool for visualizing & analyzing social networks. Designed & built using D3, React, Redux, ExpressJS, NodeJS, FakerJS, MongoDB, PassportJS, Google OAuth2.0, SendGrid, Jest, Heroku, Git, HTML5, CSS3 & APIs.
Software Engineer at Lunchbox Technologies Inc. Design & built both frontend UIs & backend APIs, using MERN stack, several packages, libraries, external APIs & integrations.
Software Engineer at Google. Building highly reliable/available backend services on large scale distributed systems for Google Classroom (over 150 million users).
Neither does growing...


by MARIOS BLOG
Posted on FEBRUARY 28, 2017 at 8:00 PM
Hunter Doherty Adams, better known as Patch Adams, is both a physician and a clown who incorporates humor and joy as a form of alternative medicine for patients. While at face value these methods may seem to work simply as a means of distracting patients from their disease condition, is there also a molecular basis to this method of “treatment”?
Complementary and Alternative Medicine 5 Laughter is the Best Medicine, Really by Norell Hadzimichalis, PhD | March 20, 2013 Hunter Doherty Adams, better known as Patch Adams, is both a physician and a clown who incorporates humor and joy as a form of alternative medicine for patients. While at face value these methods may seem to work simply as a means of distracting patients from their disease condition, is there also a molecular basis to this method of “treatment”? Data indicate that there is significant biophysical and biochemical truth supporting this method, so much so that scientists continue to examine the relevant biochemical pathways active during laughter in an attempt to identify drug targets and develop novel drugs. When we laugh multiple areas of our brain including the frontal and occipital lobes become activated.  Buchowski and colleagues at Vanderbilt University have determined that 10-15 minutes of laughter burns approximately 50 calories. This physical activity also results in an increase in movement of lymphatic fluids which facilitates the immune system in more effectively clearing cellular waste. Furthermore, it results in an increase in blood oxygen content and circulation which may help to inhibit the growth of parasites, bacteria, and cancer cells.
At the biochemical level, research has focused on examining the changes in hormone levels in response to laughter. Berk and colleagues at Loma Linda University School of Medicine report a reversal in serum levels of various hormones that play key roles in the stress hormone response cascade including cortisol, dopac, epinephrine, and growth hormone. Additional data from Stanford University indicate that humor activates the mesolimbic reward pathway in the brain, the same area of the brain that is implicated by cocaine and other addicting substances or rewarding activities.
While the data are broad and in some cases descriptive, the message is clear. The multifaceted and seemingly endless positive health effects of laughter make it, truly, the best medicine. With that being said, I encourage everyone to redirect their attention to one of my favorite free medications:
Buchowski MS, Majchrzak KM, Blomquist K, Chen KY, Byrne DW, & Bachorowski JA (2007). Energy expenditure of genuine laughter. International journal of obesity (2005), 31 (1), 131-7 PMID: 16652129
Berk LS, Tan SA, Fry WF, Napier BJ, Lee JW, Hubbard RW, Lewis JE, & Eby WC (1989). Neuroendocrine and stress hormone changes during mirthful laughter. The American journal of the medical sciences, 298 (6), 390-6 PMID: 2556917
Mobbs D, Greicius MD, Abdel-Azim E, Menon V, & Reiss AL (2003). Humor modulates the mesolimbic reward centers. Neuron, 40 (5), 1041-8 PMID: 14659102
Ang mga anime na tulad nila kung tumawa ay wagas.
Kulang nalang maghandusay na sila sa sahig sa sobrang tawa kung sila'y natutuwa.
May paiyak iyak pa tatawa na nga lang sila.
Ano un tears of joy xD wag ganun ahahaha


Home
About
What We Do
Frequently Asked Questions
Apache Project Independence
Apache Project Maturity Model
Contact Points Within the ASF
ComDev Original Board Resolution
ComDev Board Reports
Links to additional material
Community Development JIRA
For Contributors
Newcomers
Getting Started
Finding Your Way Around The Apache Software Foundation
Technical Developer FAQs
Google Summer of Code
Google Summer Of Code Information
Mentee Ranking Process
Past GSoC Experiences
Guide to being a Mentor
Using ComDev's JIRA for GSoC Ideas
Tasks of a GSoC Admin at the ASF
For Committers/PMCs
Recruiting New Committers
Useful Information for Committers
Consensus Building
Lazy Consensus
Decision Making
Voting
Funding Campaign Disclaimer
Mentoring
Mentoring Program
Mentoring in Formal Education
Applying for the Mentoring Program
Additional Resources
Guide to being a Mentor
Mentor Request Email Example
Events
ApacheCon - The official event of the ASF
Major Apache-related Events
Upcoming Apache-related meetups
Apache event branding policies
Speakers
Speaker Information
Finding Speakers / Listing Yourself as a Speaker
Apache-related Slides
Join the Conversation
Facebook
Twitter
Mailing List
The Apache Software Foundation
Community > Code
{{ partial "breadcrumbs.html" . }}
{{ block "main" . }}{{ end }}


THE DOUBLE LIFE OF VERONIQUE A film review by Myra Van Inwegen Copyright 1992 Myra Van Inwegen
I saw THE DOUBLE LIFE OF VERIONIQUE about a week and a half ago and figured that while I was writing reviews I might as well write about this one too.
The basic idea is this: there are two women, Veronika in Poland and Veronique in France, whose lives are somehow connected. In addition to looking a lot alike and having similar lives and talents, each feels that she has a counterpart somewhere in the world although they have never met (they did come close enough to see each other once). Also I found it amusing that Veronika's aunt looks a lot like Veronique's Dad. But anyway...
I felt that the idea of the movie was interesting, but there wasn't enough in the actual film to hold my attention. There was some interesting photography, but it was insufficient to save the movie by itself. It moved very slowly, and though things happened I was left with the strange impression that nothing very important occurred. Now I have no complaint about slow-moving films as long as I find something to hold my interest, but I couldn't find it in this movie. It was a bit confusing and seemed mysterious for no apparent reason.
Suffice to say that I didn't like it much. But, to present an opposing view, the friend that I went with liked it, enough that he would like to see it again to understand it better. Evidently it gave him plenty enough food for thought, though it left me still hungry.
-Myra<EMAIL_ADDRESS>.
The review above was posted to the
rec.arts.movies.reviews newsgroup (de.rec.film.kritiken for German reviews).
The Internet Movie Database accepts no responsibility for the contents of the
review and has no editorial control. Unless stated otherwise, the copyright
belongs to the author.
Please direct comments/criticisms of the review to relevant newsgroups.
Broken URLs inthe reviews are the responsibility of the author.
The formatting of the review is likely to differ from the original due
to ASCII to HTML conversion.
Related links: index of all rec.arts.movies.reviews reviews


API Doc
About
Contact
Contact data:
for further information please contact our support team at:
CargoHUB Support
.


Let me show you the right way
Don’t be stupid, join me
How to
make america great again
Choose your team to start
Lesson 1
To make America great again, you have to know how to dance
Pick the right one and show me what you've learnt
Lesson 2
To make America great again, you have to care about everyone (even mexicans)
YES !
Lesson 3
To make America great again, you have to be for LGBT
Lesson 4
To make America great again, you have to respect women
Lesson 5
To make America great again, you have to know how to have fun with your friends
Congratulations! Now you're ready to make America great again !
To make America great again, you have to be ambicious
YES ! 😎
To make America great again, you have to know who really is your country
To make America great again, you have to be a seductor
To make America great again, you have to be able to count in your partner


Fresh Fruits
It has long been known than a diet
that includes at least a few
servings of fresh fruit every day
will help keep you healthy, fit and
trim.


The goal is to avoid the bugs and collect as many points as possible.
50 points for blue, 100 for green and 150 for orange gem.
200 points when you reach the water.
Click start to begin. Have Fun!


Unifo
Contact
+380 99 999 9999
Change
Ship-to
Ukraine
Change
Method
Standard Free
Change
Payment Method
All transiction are secure and encrypted
Credit card
< Returning to shopping method
Complete order
Dagacci Medical Uniform Womens Medical Scrub
$325.00
Dagacci Medical Uniform Womens Medical Scrub
$325.00
Dagacci Medical Uniform Womens Medical Scrub
$325.00
Subtotal
Shipping
1,037.00
Free
Total
usd
$1,037.00


Register
Registration will open on the 31st March 2018.
Conference Fees
Early Bird Day Delegate (3Days) £210.
Late Day Delegate (3Days) £280.
Early Bird Student Day Delegate (3Days) £160.
Late Student Day Delegate (3Days) £190.
Single Day Delegate £95.
Conference Dinner : £45.
Accommodation is purchased separately £65 pppn.
As with previous years, efforts have been made to keep the cost low for delegates with a student rate available again this year!


Calculates empirical TL-moments (trimmed L-moments) of arbitrary order and trimming, and converts them to distribution parameters.
| Version: | 0.7.4 |
| Depends: | R (≥ 2.10), Rcpp (≥ 0.12.12) |
| Imports: | hypergeo, ggplot2, stats |
| LinkingTo: | Rcpp |
| Suggests: | evd, knitr, magrittr, lmom, lmomco, Lmoments, rmarkdown |
| Published: | 2018-08-22 |
| Author: | Jona Lilienthal |
| Maintainer: | Jona Lilienthal <lilienthal at statistik.tu-dortmund.de> |
| License: | GPL-2 | GPL-3 [expanded from: GPL (≥ 2)] |
| NeedsCompilation: | yes |
| Materials: | README |
| CRAN checks: | TLMoments results |
| Reference manual: | TLMoments.pdf |
| Vignettes: |
Vignette Title Vignette Title |
| Package source: | TLMoments_0.7.4.tar.gz |
| Windows binaries: | r-devel: TLMoments_0.7.4.zip, r-release: TLMoments_0.7.4.zip, r-oldrel: TLMoments_0.7.4.zip |
| OS X binaries: | r-release: TLMoments_0.7.4.tgz, r-oldrel: TLMoments_0.7.4.tgz |
| Old sources: | TLMoments archive |
| Reverse imports: | flood |
Please use the canonical form https://CRAN.R-project.org/package=TLMoments to link to this page.


Adds a fingerprint to resources loaded with RequireJS. This works for JSON, CSS and javascript files.


Click the disallow/allow buttons above to see how the page loads with the policy on and off. When the policy is on, you will see images that have intrinsic dimentions which are much larger than their container size render with inverted colors.
Intrinsic size: 200px x 150px
Container size: 200px x 150px
Intrinsic size: 200px x 150px
Container size: 80px x 150px
Intrinsic size: 200px x 150px
Container size: 200px x 70px
Intrinsic size: 200px x 150px
Container size: 80px x 70px


Online Car Reseller Platform
Log-In
Register
Sales
Create Sale
Active Sales
Completed Sales
Cancelled Sales


Procs are very similar to Blocs in that they also are bits of code which tell the computer to do something, however they are different in that they are defined and saved as a variable. So you can take the exact same code as in our example above and define it as a variable which then can get passed into the method, instead of writing it out:
proc = Proc.new {|argument| do something to the argument}
def method(arguments)
arguments.each(&proc)
end
The only difference here is that you use the "&" sign when you pull the Proc into your method. These can be useful when you want to assign your Proc more than one thing to do, or if you want to refer back to it multiple times in your code.


In Bitcoin and its altcoin copies, every transaction requires a fee.
Bitcoin miners propose their mining price based on supply and demand for processing Bitcoin transactions, measured in units of satoshi per byte (sat/b).
Thus Bitcoin transaction fee is calculated by the size of transaction (in byte) and the mining price which can be customized by advanced users.
Basic Bitcoin transactions with 1 input and 2 outputs are typically of 250 bytes of data.
So if the medium mining price is 27,500 sat/kb, your transaction fee can be set to 0.00007 BTC.
Source: https://support.blockchain.com
To create a Bitcoin transaction manually, you are about to set the transaction fee you are willing to pay.
To get proposed mining price, you should use some third-party service known as API or proxy.
We suggest the following API gateway:
BTC Endpoint: https://api.blockcypher.com/v1/btc/main
LTC Endpoint: https://api.blockcypher.com/v1/ltc/main
DASH Endpoint: https://api.blockcypher.com/v1/dash/main
DOGE Endpoint: https://api.blockcypher.com/v1/doge/main
The result looks like:
The above mining price of 40,035 sat/kb produces the transaction fee of 0.0001 BTC.


√
step show
follow me
folow me
say"let's sing the song
STEP SHOW
X
STEP1
(pause after each sentence)sing the song and guide the student to repeat
STEP2
sing the song with the student
STEP3
参见animal-hard 高效热身页面
step2


Is this the Future...?
written on March 18th, 2121
We finally moved!
As I wrote last week, we're leaving our apartment in the Copenhagen commune and starting our trip to the new biome in Essen. I've never been, but it just sounds like such a great place to be right now. People call it the centre of Europe, but I do have my doubts.
Anyway, I found an old list I made back in the 21st century. I guess I was really into the future back then.
2121
Existence will not be easy.
Computers will not save us.
AI will will not exist - they will take offense to you calling them "artificial."
Interfaces will not be "experiences."
Users will not be "people."
Power structures will not dissolve. Unless you make them.
We will not live on Mars.
Global warming will not have ended. It will have transformed.
You will not own a (self-driving) car
Capitalism might crumble.
Europe might still exist. USA will not.
Suburbs might be eradicated in favour of sustainable urban living.
You might live in Africa (if you can afford it).
You might not have money for a computer, but you know how to build one.
Money might still exist...
Science will be poetic again.
You will ride your bicycle.
Neoliberalism will fall.
Freedom of sexuality will be a given. Gender equality will not.
You will create art.
You will go to work.

We will decide together.
We will live together.
As you see, it was a while ago. I mean, I definitely got a lot of that wrong. Still, it's pretty interesting to see how hopeful I was back then.
/signing off...


srfnef package¶
Subpackages¶
Submodules¶
srfnef.data_types module¶
srfnef.func_types module¶
srfnef.templating module¶
srfnef.templating¶
This module provides basic data and function types of the whole package, including dataclass for data and funcclass for functions.
DataClass, as well as FuncClass, instances io to .hdf5 files are implemented in save and load natual modes.
-
class
srfnef.templating.
BinaryOps
[source]¶ Bases:
object
-
class
Add
(other: srfnef.templating.DataClass)¶ Bases:
srfnef.templating.Add
,srfnef.templating.FuncClass
-
class
Mul
(other: srfnef.templating.DataClass)¶ Bases:
srfnef.templating.Mul
,srfnef.templating.FuncClass
-
class
Sub
(other: srfnef.templating.DataClass)¶ Bases:
srfnef.templating.Sub
,srfnef.templating.FuncClass
-
class
Truediv
(other: srfnef.templating.DataClass)¶ Bases:
srfnef.templating.Truediv
,srfnef.templating.FuncClass
-
class
-
class
srfnef.templating.
DataClass
[source]¶ Bases:
object
DataClass is suited for storing data objects. It is the most basic class type in srfnef package. All data and functions would be seriously considered to be defined as a Dataclass instance. More specific, only the field .data in a DataClass would be regarded as the only computable part with in an instance. Any other class that defined to contained data would a subclass of DataClass.
-
map
(f)[source]¶ Map applis a function to the field .data of this DataClass instance, and return a new instance with the same type
-
replace
(**kwargs)[source]¶ Creates a new object of the same type of instance, replacing fields with values from changes.
-
shape
¶ return the shape of self.data.
-
-
class
srfnef.templating.
FuncClass
[source]¶ Bases:
srfnef.templating.DataClass
FuncClass is special subclass of DataClass which is callable. We prefer all functional class in this package would be defined as a subclass of FuncClass.
Be default, the first input argument would be regarded as the key input.
-
currying
(*args, **kwargs)[source]¶ currying translate this FuncClass instance to a single-argument function and return it as a anonymous(namely Curried) `FunClass. Only the key argument would be the only argument in the new instance. The other arguments would be stored in the new FuncClass instance.
-
is_curried
¶ check this FuncClass is curried, which means it only accepts one arguments.
-
-
srfnef.templating.
dataclass
(cls)[source]¶ This function is a decorator that is used to add generated special methods to classes, as described below.
The dataclass() decorator examines the class to find fields. A field is defined as class variable that has a type annotation. The order of the fields in all of the generated methods is the order in which they appear in the class definition. Be default the instance decorated by dataclass is attributed frozen, which means we prefer it to be immutable.
Some basic arithmetic operators are mounted and would apply on .data field.
-
srfnef.templating.
funcclass
(cls)[source]¶ This function is a decorator that is used to add generated special methods to classes, as described below.
The funcclass() decorator are used to define function typed class in this package.
-
srfnef.templating.
x_loader
(path, sel=None, unpack=False)[source]¶ Loads an HDF5 saved with save and end with ‘.hdf5’. It will return a DataClass object which is well-formed.
This function requires the `deepdish`_ module to be installed.
- path : string
- Filename from which to load the data. must end with ‘.hdf5’ path can be in form of path + x_path, for example ‘a.hdf5/b/c’ it will load the ‘/b/c’ group in a.hdf5
- sel : slice or tuple of slices
- If you specify group and the target is a numpy array, then you can use this to slice it. This is useful for opening subsets of large HDF5 files. To compose the selection, you can use deepdish.aslice.
- unpack : bool
- If True, a single-entry dictionaries will be unpacked
and the value
will be returned directly. That is, if you save
dict(a=100)
, only100
will be loaded.
- data : DataClass
- It will visit TYPE_BIND to find the bind bewteen a string and a specific DataClass class.
save TYPE_BIND
-
srfnef.templating.
x_saver
(path, instance: srfnef.templating.DataClass, compression=None)[source]¶ Save a DataClass object to an HDF5 file. for more details please visit ‘https://deepdish.readthedocs.io/en/latest/_modules/deepdish/io/hdf5io.html#save’
This function requires the `deepdish`_ module to be installed.
- path : string
- Filename to which the data is saved, must ends with ‘.hdf5
- data : DataClass or Funcclass
- Data to be saved. This can be any DataClass with fields a Numpy array, a string, another DataClass
- compression : string or tuple
- Set compression method, choosing from blosc,
zlib, lzo, bzip2
and more (see PyTables documentation). It can also be
specified as a
tuple (e.g.
('blosc', 5)
), with the latter value specifying the level of compression, choosing from 0 (no compression) to 9 (maximum compression). The default is None
load
srfnef.utils module¶
srfnef.utils¶
This module provides utility functions that are used within SRF-NEF that are alose useful for extenel comsumptions.
Module contents¶
@author: Minghao Guo @contact<EMAIL_ADDRESS>@software: srf_ct @file: __init__.py.py @date: 12/25/2018 @desc:


Even though the in-person CHI 2020 conference was cancelled due to the global pandemic, our community is coming together virtually to share their groundbreaking work in HCI and personal fabrication.
Each full paper will be presented in a live 15-minute talk and 3-minute Q&A.
Each late-breaking work (LBW) will be given 3 minutes.
Feel free to join the #chi20_virtual channel on the Fab Research workspace.
| 1 | Kirigami Haptic Swatches: Design Methods for Cut-and-Fold Haptic Feedback Mechanisms Zekun Chang, Tung D. Ta, Koya Narumi, Heeju Kim, Fuminori Okuya, Dongchi Li, Kunihiro Kato, Jie Qi, Yoshinobu Miyamoto, Kazuya Saito, Yoshihiro Kawahara |
|---|---|
| 2 | FoodFab: Creating Food Perception Illusions using Food 3D Printing Ying-Ju Lin, Parinya Punpongsanon, Xin Wen, Daisuke Iwai, Kosuke Sato, Marianna Obrist, Stefanie Mueller |
| 3 | MagneLayer: Force Field Fabrication by Layered Magnetic Sheets Kentaro Yasu |
| 4 | (5 min LBW) ShrinkyKit: 3D Printing Shrinkable Adaptations for Everyday Objects Lingyun Sun, Yue Yang, Yu Chen, Jiaji Li, Guanyun Wang, Ye Tao, Lining Yao (presenting from China) |
| 5 | Embroidered Resistive Pressure Sensors: A Novel Approach for Textile Interfaces Roland Aigner, Andreas Pointner, Thomas Preindl, Patrick Parzer, Michael Haller |
|---|---|
| 6 | PolySense: Augmenting Textiles with Electrical Functionality using In-Situ Polymerization Cedric Honnet, Hannah Perner-Wilson, Marc Teyssier, Bruno Fruchard, Jürgen Steimle, Ana C. Baptista, Paul Strohmeier |
| 7 | Rapid Iron-On User Interfaces: Hands-on Fabrication of Interactive Textile Prototypes Konstantin Klamka, Raimund Dachselt, Jürgen Steimle |
| 8 | (5 min LBW) 4DTexture: A Shape-Changing Fabrication Method for 3D Surfaces with Texture Lingyun Sun, Jiaji Li, Yu Chen, Yue Yang, Ye Tao, Guanyun Wang, Lining Yao. (presenting from China) |
| 9 | AirTouch: 3D-Printed Touch-Sensitive Objects Using Pneumatic Sensing Carlos E. Tejada, Raf Ramakers, Sebastian Boring, Daniel Ashbrook |
|---|---|
| 10 | PhysioSkin: Rapid Fabrication of Skin-Conformal Physiological Interfaces Aditya Shekhar Nittala, Arshad Khan, Klaus Kruttwig, Tobias Kraus, Jürgen Steimle |
| 11 | Mix&Match: Towards Omitting Modelling through In-Situ Alteration and Remixing of Model Repository Artifacts in Mixed Reality Evgeny Stemasov, Tobias Wagner, Jan Gugenheimer, Enrico Rukzio |
| 12 | (5 min LBW) Hydrogel-Textile Composites: Actuators for Shape-Changing Interfaces Michael L. Rivera, Jack Forman, Scott E. Hudson, Lining Yao |
| 13 | ProtoSpray: Combining 3D Printing and Spraying to Create Interactive Displays with Arbitrary Shapes Ollie Hanton, Michael Wessely, Stefanie Mueller, Mike Fraser, Anne Roudaut |
|---|---|
| 14 | Sprayable User Interfaces: Prototyping Large-Scale Interactive Surfaces with Sensors and Displays Michael Wessely, Ticha Sethapakdi, Carlos Castillo, Jackson C. Snowden, Ollie Hanton, Isabel P. S. Qamar, Mike Fraser, Anne Roudaut, Stefanie Mueller |
| 15 | CurveBoards: Integrating Breadboards into Physical Objects to Prototype Function in the Context of Form Junyi Zhu, Lotta-Gili Blumberg, Yunyi Zhu, Martin Nisser, Ethan Levi Carlson, Xin Wen, Kevin Shum, Jessica Ayeley Quaye, Stefanie Mueller. |
| 16 | G-ID: Identifying 3D Prints Using Slicing Parameters Mustafa Doga Dogan, Faraz Faruqi, Andrew Day Churchill, Kenneth Friedman, Leon Cheng, Sriram Subramanian, Stefanie Mueller. |
|---|---|
| 17 | TangibleCircuits: An Interactive 3D Printed Circuit Education Tool for People with Visual Impairments Josh Urban Davis, Te-Yen Wu, Bo Shi, Hanyi Lu, Athina Panotopoulou, Emily Whiting, Xing-Dong Yang. |
| 18 | Exploring and Understanding the Role of Workshop Environments in Personal Fabrication Processes Michelle Annett, Tovi Grossman, Daniel Wigdor, George Fitzmaurice |
| 19 | Jubilee: An Extensible Machine for Multi-tool Fabrication Joshua Vasquez, Hannah Twigg-Smith, Jasper Tran O'Leary, Nadya Peek. |
|---|---|
| 20 | Unfabricate: Designing Smart Textiles for Disassembly Shanel Wu, Laura Devendorf |
| 21 | StoryMakAR: Bringing Stories to Life with an Augmented Reality & Physical Prototyping Toolkit for Youth Terrell Glenn, Ananya Ipsita, Caleb Carithers, Kylie Peppler, Karthik Ramani |


|
QuantLib: a free/open-source library for quantitative finance
Fully annotated sources - version 1.30
|
Swing exercise. More...
#include <ql/instruments/vanillaswingoption.hpp>
Public Member Functions | |
| SwingExercise (const std::vector< Date > &dates, const std::vector< Size > &seconds=std::vector< Size >()) | |
| SwingExercise (const Date &from, const Date &to, Size stepSizeSecs) | |
| const std::vector< Size > & | seconds () const |
| std::vector< Time > | exerciseTimes (const DayCounter &dc, const Date &refDate) const |
| Public Member Functions inherited from BermudanExercise | |
| BermudanExercise (const std::vector< Date > &dates, bool payoffAtExpiry=false) | |
| Public Member Functions inherited from EarlyExercise | |
| EarlyExercise (Type type, bool payoffAtExpiry=false) | |
| bool | payoffAtExpiry () const |
| Public Member Functions inherited from Exercise | |
| Exercise (Type type) | |
| virtual | ~Exercise ()=default |
| Type | type () const |
| Date | date (Size index) const |
| Date | dateAt (Size index) const |
| const std::vector< Date > & | dates () const |
| Returns all exercise dates. More... | |
| Date | lastDate () const |
Private Attributes | |
| const std::vector< Size > | seconds_ |
Additional Inherited Members | |
| Public Types inherited from Exercise | |
| enum | Type { American , Bermudan , European } |
| Protected Attributes inherited from Exercise | |
| std::vector< Date > | dates_ |
| Type | type_ |
Swing exercise.
A Swing option can only be exercised at a set of fixed date times
Definition at line 37 of file vanillaswingoption.hpp.
|
explicit |
Definition at line 57 of file vanillaswingoption.cpp.
| SwingExercise | ( | const Date & | from, |
| const Date & | to, | ||
| Size | stepSizeSecs | ||
| ) |
Definition at line 75 of file vanillaswingoption.cpp.
| const std::vector< Size > & seconds | ( | ) | const |
| std::vector< Time > exerciseTimes | ( | const DayCounter & | dc, |
| const Date & | refDate | ||
| ) | const |
Definition at line 83 of file vanillaswingoption.cpp.
|
private |
Definition at line 49 of file vanillaswingoption.hpp.