Mises à jour diverses et nouvelles confs

This commit is contained in:
Breizh 2021-04-15 21:16:57 +02:00
parent feca6ab12f
commit d2f0ec45de
43 changed files with 1633 additions and 1 deletions

View File

@ -12,7 +12,6 @@ export PATH=~/.local/bin:$PATH
export HASTE_SERVER="https://haste.breizh.pm"
export MPD_HOST="$HOME/.mpd/socket"
export KRESUS_PYTHON_EXEC=python
export MAGICK_TMPDIR="$HOME/.cache/ImageMagick/"
export HIGHLIGHT_STYLE="base16/eighties"

1
.config/fish/conf.d/br.fish Symbolic link
View File

@ -0,0 +1 @@
/home/breizh/.local/share/broot/launcher/fish/1.fish

View File

@ -0,0 +1,4 @@
# Defined in - @ line 1
function mv --description 'alias mv advmv -g'
advmv -g $argv;
end

View File

@ -0,0 +1,4 @@
# Defined in - @ line 1
function màj --wraps='pikaur -Syu' --description 'alias màj pikaur -Syu'
pikaur -Syu $argv;
end

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Jorge Bucaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,50 @@
[slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://fisherman-wharf.herokuapp.com/badge.svg
[fisherman]: https://github.com/fisherman/fisherman
[![Slack Room][slack-badge]][slack-link]
# Await
Wait for background jobs.
## Install
With [fisherman]
```
fisher await
```
## Usage
Wait until all existing jobs have finished.
```fish
await
```
Wait until the given jobs are finished.
```fish
set -l id_list
for cmd in $commands
fish -c "$cmd" &
set id_list $id_list (last_job_id -l)
end
await $id_list
```
Customize spinners.
```fish
set await_spinners ◢ ◣ ◤ ◥
```
Customize interval between spinners.
```fish
set await_interval 0.1
```

View File

@ -0,0 +1 @@
fisherman/last_job_id

View File

@ -0,0 +1,42 @@
function await -d "Wait for background jobs"
if test -z "$argv"
set argv (last_job_id)
end
set -l spinners "$await_spinners"
set -l interval "$await_interval"
if test -z "$spinners"
set spinners ⠋ ⠙ ⠹ ⠸ ⠼ ⠴ ⠦ ⠧ ⠇ ⠏
end
if test -z "$interval"
set interval 0.05
end
while true
for spinner in $spinners
printf " $spinner \r" > /dev/stderr
sleep "$interval"
end
set -l currently_active_jobs (last_job_id)
if test -z "$currently_active_jobs"
break
end
set -l has_jobs
for i in $argv
if builtin contains -- $i $currently_active_jobs
set has_jobs "*"
break
end
end
if test -z "$has_jobs"
break
end
end
end

View File

@ -0,0 +1,8 @@
sudo: required
before_install:
- sudo add-apt-repository -y ppa:fish-shell/release-2
- sudo apt-get update
- sudo apt-get -y install fish
script:
- curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisherman
- fish -c "fisher fishtape .; fishtape test/*.fish"

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2015 Jorge Bucaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,78 @@
[![Build Status][travis-badge]][travis-link]
[![Slack Room][slack-badge]][slack-link]
# Getopts
**Getopts** is a command line options parser for [fish].
```fish
getopts -ab1 --foo=bar baz | while read -l key value
switch $key
case _
echo "$value" # baz
case a
echo "$value" # ""
case b
echo "$value" # 1
case foo
echo "$value" # bar
end
end
```
## Install
With [fisherman]
```
fisher getopts
```
With curl.
```sh
curl -Lo ~/.config/fish/functions/getopts.fish --create-dirs git.io/getopts
```
## Usage
Study the output in the following example
```fish
getopts -ab1 --foo=bar baz
```
```
a
b 1
foo bar
_ baz
```
The items on the left are the option flags. The items on the right are the option values. The underscore `_` character is the default *key* for bare arguments.
Use read(1) to process the generated stream and switch(1) to match patterns
```fish
getopts -ab1 --foo=bar baz | while read -l key option
switch $key
case _
case a
case b
case foo
end
end
```
## Notes
* A double dash, `--`, marks the end of options. Arguments after this sequence are placed in the default underscore key, `_`.
[travis-link]: https://travis-ci.org/fisherman/getopts
[travis-badge]: https://img.shields.io/travis/fisherman/getopts.svg
[slack-link]: https://fisherman-wharf.herokuapp.com
[slack-badge]: https://fisherman-wharf.herokuapp.com/badge.svg
[fish]: https://fishshell.com
[fisherman]: https://github.com/fisherman/fisherman

View File

@ -0,0 +1,82 @@
function getopts -d "cli parser"
if not set -q argv[1]
return
end
printf "%s\n" $argv | awk '
function out(k,v) {
print(k "" (v == "" ? "" : " "v))
}
function pop() {
return len <= 0 ? "_" : opt[len--]
}
{
if (done) {
out("_" , $0)
next
}
if (match($0, "^-[A-Za-z]+")) {
$0 = "- " substr($0, 2, RLENGTH - 1) " " substr($0, RLENGTH + 1)
} else if (match($0, "^--[A-Za-z0-9_-]+")) {
$0 = "-- " substr($0, 3, RLENGTH - 2) " " substr($0, RLENGTH + 2)
}
if ($1 == "--" && $2 == "") {
done = 1
} else if ($2 == "" || $1 !~ /^-|^--/ ) {
out(pop(), $0)
} else {
while (len) {
out(pop())
}
if ($3 != "") {
if (match($0, $2)) {
$3 = substr($0, RSTART + RLENGTH + 1)
}
}
if ($1 == "--") {
if ($3 == "") {
opt[++len] = $2
} else {
out($2, $3)
}
}
if ($1 == "-") {
if ($2 == "") {
print($1)
next
} else {
n = split($2, keys, "")
}
if ($3 == "") {
opt[++len] = keys[n]
} else {
out(keys[n], $3)
}
for (i = 1; i < n; i++) {
out(keys[i])
}
}
}
}
END {
while (len) {
out(pop())
}
}
'
end

View File

@ -0,0 +1,69 @@
.
.TH "GETOPTS" "1" "February 2016" "" "fisherman"
.
.SH "NAME"
\fBgetopts\fR \- Command line options parser
.
.SH "SYNOPSIS"
getopts \fIoptions\fR \.\.\.
.
.br
.
.SH "DESCRIPTION"
\fBGetopts\fR is a command line options parser for fish\.
.
.SH "USAGE"
Study the output in the following example
.
.IP "" 4
.
.nf
getopts \-ab1 \-\-foo=bar baz
.
.fi
.
.IP "" 0
.
.IP "" 4
.
.nf
a
b 1
foo bar
_ baz
.
.fi
.
.IP "" 0
.
.P
The items on the left are the option flags\. The items on the right are the option values\. The underscore \fB_\fR character is the default \fIkey\fR for bare arguments\.
.
.P
Use read(1) to process the generated stream and switch(1) to match patterns
.
.IP "" 4
.
.nf
getopts \-ab1 \-\-foo=bar baz | while read \-l key option
switch $key
case _
case a
case b
case foo
end
end
.
.fi
.
.IP "" 0
.
.SH "NOTES"
.
.IP "\(bu" 4
A double dash, \fB\-\-\fR, marks the end of options\. Arguments after this sequence are placed in the default underscore key, \fB_\fR\.
.
.IP "" 0

View File

@ -0,0 +1,104 @@
test "only bare"
"_ beer" = (getopts beer)
end
test "bare and bare"
"_ bar" "_ beer" = (getopts bar beer)
end
test "bare first"
"foo" "_ beer" = (getopts beer --foo)
end
test "bare sequence"
"_ foo" "_ bar" "_ baz" "_ quux" = (getopts foo bar baz quux)
end
test "bare does not end opts"
"a" "b 42" "_ beer" "foo" "bar" = (getopts -ab42 beer --foo --bar)
end
test "only single"
"f" "o" "o 42" = (getopts -foo42)
end
test "single and single"
"a" "b" "c" "x" "y" "z" = (getopts -abc -xyz)
end
test "single and bare"
"a" "b" "c bar" = (getopts -abc bar)
end
test "single and value"
"a bar" = (getopts -a bar)
end
test "single w/ value and bare"
"a" "b" "c ./" "_ bar" = (getopts -abc./ bar)
end
test "single and double"
"a" "b" "c" "foo" = (getopts -abc --foo)
end
test "double"
"foo" = (getopts --foo)
end
test "double w/ value"
"foo bar" = (getopts --foo=bar)
end
test "double w/ value group"
"foo bar" "bar foo" = (getopts --foo=bar --bar=foo)
end
test "double w/ value and bare"
"foo bar" "_ beer" = (getopts --foo=bar beer)
end
test "double double"
"foo" "bar" = (getopts --foo --bar)
end
test "double w/ inner dashes"
"foo-bar-baz" = (getopts --foo-bar-baz)
end
test "double and single"
"foo" "a" "b" "c" = (getopts --foo -abc)
end
test "multiple double sequence"
"foo" "bar" "secret 42" "_ baz" = (getopts --foo --bar --secret=42 baz)
end
test "single double single w/ remaining bares"
"f" "o" "o" "bar" "b" "a" "r norf" "_ baz" "_ quux" = (
getopts -foo --bar -bar norf baz quux)
end
test "double dash"
"_ --foo" "_ bar" = (getopts -- --foo bar)
end
test "single double dash"
"a" "_ --foo" "_ bar" = (getopts -a -- --foo bar)
end
test "bare and double dash"
"foo bar" "_ baz" "_ foo" "_ --foo" = (getopts --foo=bar baz -- foo --foo)
end
test "long string as a value"
"f Fee fi fo fum" = (getopts -f "Fee fi fo fum")
end
test "single and empty string"
"f" = (getopts -f "")
end
test "double and empty string"
"foo" = (getopts --foo "")
end

View File

@ -0,0 +1,8 @@
sudo: required
before_install:
- sudo add-apt-repository -y ppa:fish-shell/release-2
- sudo apt-get update
- sudo apt-get -y install fish
script:
- curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisherman
- fish -c "fisher fishtape .; fishtape test/*.fish"

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 bucaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,28 @@
[![Build Status][travis-badge]][travis-link]
[![Slack Room][slack-badge]][slack-link]
# Humanize_duration
Humanize a time interval for display.
## Install
With [fisherman]
```
fisher humanize_duration
```
## Usage
```fish
sleep 1
echo $CMD_DURATION | humanize_duration
1s 5ms
```
[travis-link]: https://travis-ci.org/fisherman/humanize_duration
[travis-badge]: https://img.shields.io/travis/fisherman/humanize_duration.svg
[slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://fisherman-wharf.herokuapp.com/badge.svg
[fisherman]: https://github.com/fisherman/fisherman

View File

@ -0,0 +1,20 @@
function humanize_duration -d "Humanize a time interval for display"
command awk '
function hmTime(time, stamp) {
split("h:m:s:ms", units, ":")
for (i = 2; i >= -1; i--) {
if (t = int( i < 0 ? time % 1000 : time / (60 ^ i * 1000) % 60 )) {
stamp = stamp t units[sqrt((i - 2) ^ 2) + 1] " "
}
}
if (stamp ~ /^ *$/) {
return "0ms"
}
return substr(stamp, 1, length(stamp) - 1)
}
{
print hmTime($0)
}
'
end

View File

@ -0,0 +1,31 @@
.\" generated with Ronn/v0.7.3
.\" http://github.com/rtomayko/ronn/tree/0.7.3
.
.TH "HUMANIZE_TIME" "1" "March 2016" "" "humanize_duration"
.
.SH "NAME"
\fBhumanize_duration\fR \- Humanize a time interval for display
.
.SH "SYNOPSIS"
echo \fImilliseconds elapsed\fR | humanize_duration
.
.br
humanize_duration [\-\-help]
.
.br
.
.SH "OPTIONS"
.
.TP
\-h, \-\-help
Show usage help\.
.
.SH "EXAMPLES"
.
.nf
sleep 1
echo $CMD_DURATION | humanize_duration
1s 5ms
.
.fi

View File

@ -0,0 +1,14 @@
humanize_duration(1) -- Humanize a time interval for display
============================================================
## SYNOPSIS
humanize_duration<br>
## EXAMPLE
```fish
sleep 1
echo $CMD_DURATION | humanize_duration
1s 5ms
```

View File

@ -0,0 +1,23 @@
test "$TESTNAME"
1ms = (echo 1 | humanize_duration)
end
test "$TESTNAME"
10ms = (echo 10 | humanize_duration)
end
test "$TESTNAME"
"1m 40s" = (echo 100000 | humanize_duration)
end
test "$TESTNAME"
"16m 40s" = (echo 1000000 | humanize_duration)
end
test "$TESTNAME"
"2h 46m 40s" = (echo 10000000 | humanize_duration)
end
test "$TESTNAME"
"27h 46m 40s" = (echo 100000000 | humanize_duration)
end

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2014 Bruno Ferreira Pinto
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@ -0,0 +1,33 @@
### Lambda
[![MIT License](https://img.shields.io/badge/license-MIT-007EC7.svg?style=flat-square)](/LICENSE)
[![Fish Shell Version](https://img.shields.io/badge/fish-v2.2.0-007EC7.svg?style=flat-square)](http://fishshell.com)
<br/>
#### Screenshot
<p align="center">
<img src="https://raw.githubusercontent.com/hasanozgan/theme-lambda/master/screenshot.png">
</p>
###### Added VirtualEnv Support
![preview](http://i.imgur.com/fWurs47.png)
#### Install
#### [Fisherman]
```fish
fisher i lambda
```
##### [Oh-My-Fish]
```fish
omf install lambda
```
[Fisherman]: https://github.com/fisherman/fisherman
[Oh-My-Fish]: https://github.com/oh-my-fish/oh-my-fish

View File

@ -0,0 +1,67 @@
function fish_prompt
# Cache exit status
set -l last_status $status
# Just calculate these once, to save a few cycles when displaying the prompt
if not set -q __fish_prompt_hostname
set -g __fish_prompt_hostname (hostname|cut -d . -f 1)
end
if not set -q __fish_prompt_char
switch (id -u)
case 0
set -g __fish_prompt_char '#'
case '*'
set -g __fish_prompt_char 'λ'
end
end
# Setup colors
#use extended color pallete if available
#if [[ $terminfo[colors] -ge 256 ]]; then
# turquoise="%F{81}"
# orange="%F{166}"
# purple="%F{135}"
# hotpink="%F{161}"
# limegreen="%F{118}"
#else
# turquoise="%F{cyan}"
# orange="%F{yellow}"
# purple="%F{magenta}"
# hotpink="%F{red}"
# limegreen="%F{green}"
#fi
set -l normal (set_color normal)
set -l white (set_color --bold normal)
set -l turquoise (set_color cyan)
set -l orange (set_color yellow)
set -l hotpink (set_color red)
set -l blue (set_color blue)
set -l limegreen (set_color brgreen)
set -l purple (set_color magenta)
# Configure __fish_git_prompt
set -g __fish_git_prompt_char_stateseparator ' '
set -g __fish_git_prompt_color F2F0EC
set -g __fish_git_prompt_color_flags FFCC66
set -g __fish_git_prompt_color_prefix white
set -g __fish_git_prompt_color_suffix white
set -g __fish_git_prompt_showdirtystate true
set -g __fish_git_prompt_showuntrackedfiles true
set -g __fish_git_prompt_showstashstate true
set -g __fish_git_prompt_show_informative_status true
# Line 1
echo -n $white'╭─'$hotpink$USER$white' at '$orange$__fish_prompt_hostname$white' in '$limegreen(pwd)$turquoise
__fish_git_prompt " (%s)"
echo
# Line 2
echo -n $white'╰'
# support for virtual env name
if set -q VIRTUAL_ENV
echo -n "($turquoise"(basename "$VIRTUAL_ENV")"$white)"
end
echo -n $white'─'$__fish_prompt_char $normal
end

View File

@ -0,0 +1,56 @@
function fish_right_prompt
set -l exit_code $status
__tmux_prompt
if test $exit_code -ne 0
set_color red
else
set_color 666666
end
printf '%d' $exit_code
set_color 666666
printf ' < %s' (date +%H:%M:%S)
set_color normal
end
function __tmux_prompt
set multiplexer (_is_multiplexed)
switch $multiplexer
case screen
set pane (_get_screen_window)
case tmux
set pane (_get_tmux_window)
end
set_color 666666
if test -z $pane
echo -n ""
else
echo -n $pane' | '
end
end
function _get_tmux_window
tmux lsw | grep active | sed 's/\*.*$//g;s/: / /1' | awk '{ print $2 "-" $1 }' -
end
function _get_screen_window
set initial (screen -Q windows; screen -Q echo "")
set middle (echo $initial | sed 's/ /\n/g' | grep '\*' | sed 's/\*\$ / /g')
echo $middle | awk '{ print $2 "-" $1 }' -
end
function _is_multiplexed
set multiplexer ""
if test -z $TMUX
else
set multiplexer "tmux"
end
if test -z $WINDOW
else
set multiplexer "screen"
end
echo $multiplexer
end

Binary file not shown.

After

Width:  |  Height:  |  Size: 617 KiB

View File

@ -0,0 +1,8 @@
sudo: required
before_install:
- sudo add-apt-repository -y ppa:fish-shell/release-2
- sudo apt-get update
- sudo apt-get -y install fish
script:
- curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs git.io/fisherman
- fish -c "fisher fishtape .; fishtape test/*.fish"

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Jorge Bucaran
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,28 @@
[![Build Status][travis-badge]][travis-link]
[![Slack Room][slack-badge]][slack-link]
# Last_job_id
Get the id of one or more existing jobs
## Install
With [fisherman]
```
fisher last_job_id
```
## Usage
```fish
if set -l i (last_job_id --last)
printf "Most recent job: %%%i\n" $i
end
```
[travis-link]: https://travis-ci.org/fisherman/last_job_id
[travis-badge]: https://img.shields.io/travis/fisherman/last_job_id.svg
[slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://fisherman-wharf.herokuapp.com/badge.svg
[fisherman]: https://github.com/fisherman/fisherman

View File

@ -0,0 +1,14 @@
function last_job_id -d "Get the id of one or more existing jobs"
builtin jobs $argv | command awk -v FS=\t '
/[0-9]+\t/{
aJobs[++nJobs] = $1
}
END {
for (i = 1; i <= nJobs; i++) {
print(aJobs[i])
}
exit nJobs == 0
}
'
end

View File

@ -0,0 +1,14 @@
last_job_id(1) -- Get the id of the last job to be started
==========================================================
## SYNOPSIS
last_job_id<br>
## USAGE
```fish
if set -l job_id (last_job_id)
printf "The last job to be started: %%%i\n" $job_id
end
```

View File

@ -0,0 +1,24 @@
test "$TESTNAME - Get the id of the last job to be started"
(
sleep 0.2&
set -l jobs_id (jobs -l | cut -d\t -f1)
echo "$jobs_id"
) = (last_job_id)
end
test "$TESTNAME - Set status to 1 if there are no jobs"
1 = (
while true
set -l has_jobs (jobs)
if test -z "$has_jobs"
break
end
end
last_job_id
echo $status
)
end

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2006 Marcel Bischoff
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,27 @@
[![Slack Room][slack-badge]][slack-link]
# termcolours
Simple function for fish to list available terminal colour names.
## Install
With [fisherman]
```
fisher termcolours
```
## Usage
```fish
termcolours
```
## Screenshot
![screenshot](https://cloud.githubusercontent.com/assets/8317250/15145024/309e173c-16ee-11e6-91fa-f0e493d77682.png)
[slack-link]: https://fisherman-wharf.herokuapp.com/
[slack-badge]: https://fisherman-wharf.herokuapp.com/badge.svg
[fisherman]: https://github.com/fisherman/fisherman

View File

@ -0,0 +1,11 @@
function __termcolours
set herrbischoff_tcolors (echo $TERM | grep -oE '2|4|8|16|32|64|128|256')
for i in (seq 0 (math $herrbischoff_tcolors-1))
printf "\x1b[38;5;%smcolour%s\n" $i $i
end
set -e herrbischoff_tcolors
end
function termcolours
__termcolours | pr --columns=4 -t -w100
end

View File

@ -0,0 +1,9 @@
sudo: required
before_install:
- sudo add-apt-repository -y ppa:fish-shell/release-2
- sudo apt-get update
- sudo apt-get -y install fish
script:
- curl -Lo ~/.config/fish/functions/fisher.fish --create-dirs https://git.io/fisher
- fish -c "fisher transfer"
- fish -c "transfer --help"

View File

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) 2016 Sajjad Hashemian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

View File

@ -0,0 +1,31 @@
[fisher]: https://github.com/jorgebucaran/fisher
# Transfer
Upload to <https://transfer.sh>
## Install
With [fisher]
```
fisher sijad/transfer
```
## Usage
```fish
transfer my-file.txt
```
```fish
transfer my-file.txt my-file-new-name.txt
```
```fish
echo my message text | transfer my-message.txt
```
```fish
cat my-file.txt | transfer my-file-new-name.txt
```

View File

@ -0,0 +1 @@
getopts

View File

@ -0,0 +1,58 @@
function transfer -d "Upload to transfer.sh" -a file name
getopts $argv | while read -l 1 2
switch "$1"
case _
continue
case h help
echo "Usage: transfer [FILE] [NAME]"
echo
echo "Examples:"
echo " transfer my-file.txt"
echo " transfer my-file.txt my-file-new-name.txt"
echo " echo my message text | transfer my-message.txt"
echo " cat my-file.txt | transfer my-file-new-name.txt"
return
case \*
printf "transfer: '%s' is not a valid option\n" $1 >& 2
transfer --help >& 2
return 1
end
end
set -l tmp (mktemp -t transferXXX)
if test -z $name
if not isatty
set name $file
else if test -n "$file"
set name (basename $file)
end
end
if test -z $name
set name (random)
end
if not isatty
set file ""
end
set name (echo $name | sed -e 's/[^a-zA-Z0-9._-]/-/g')
set name (echo $name | sed -e 's/-\{1,\}/-/g')
if test -n "$file"
if not test -r "$file"
echo "transfer: can not read the file." > /dev/stderr
return 1
end
curl --progress-bar --upload-file $file https://transfer.sh/$name >> $tmp
else
curl --progress-bar --upload-file - https://transfer.sh/$name >> $tmp
end
cat $tmp
rm -f $tmp
end

35
.config/zathura/zathurarc Normal file
View File

@ -0,0 +1,35 @@
# Base16 Eighties
# Author: Chris Kempson (http://chriskempson.com)
set default-bg "#2d2d2d"
set default-fg "#393939"
set statusbar-fg "#a09f93"
set statusbar-bg "#515151"
set inputbar-bg "#2d2d2d"
set inputbar-fg "#f2f0ec"
set notification-bg "#2d2d2d"
set notification-fg "#f2f0ec"
set notification-error-bg "#2d2d2d"
set notification-error-fg "#f2777a"
set notification-warning-bg "#2d2d2d"
set notification-warning-fg "#f2777a"
set highlight-color "#ffcc66"
set highlight-active-color "#6699cc"
set completion-bg "#393939"
set completion-fg "#6699cc"
set completion-highlight-fg "#f2f0ec"
set completion-highlight-bg "#6699cc"
set recolor-lightcolor "#2d2d2d"
set recolor-darkcolor "#e8e6df"
set recolor "false"
set recolor-keephue "false"

500
.local/bin/360plugin.lua Normal file
View File

@ -0,0 +1,500 @@
local yaw = 0.0
local last_yaw = 0.0
local init_yaw = 0.0
local pitch = 0.0
local last_pitch = 0.0
local init_pitch = 0.0
local roll = 0.0
local last_roll = 0.0
local init_roll = 0.0
local inputProjections = {
"hequirect",
"equirect",
"fisheye",
"pannini",
"cylindrical",
"sg"
}
local inputProjectionInd = 0
local inputProjection = "hequirect"
local outputProjections = {
"flat",
"sg"
}
local outputProjectionInd = 0
local outputProjection = "flat"
local idfov=180.0
local dfov=110.0
local last_dfov = 110.0
local init_dfov = 0.0
local doit = 0.0
local res = 1.0
local dragging = false
local smoothMouse = true
local scaling = 'linear'
local in_stereo = 'sbs'
local h_flip = '0'
local in_flip = ''
local interp = 'cubic'
local startTime = nil
local filterIsOn = false
local mousePos = {}
local lasttimePos = nil
local filename = nil
local fileobjectNumber = 0
local fileobjectFilename = ''
local videofilename = ''
local file_object = nil
local ffmpegComamndList = {}
local openNewLogFile = function()
if lasttimePos ~= nil then
fileobjectNumber = fileobjectNumber+1
end
videofilename = mp.get_property('filename')
fileobjectFilename = string.format('%s_3dViewHistory_%s.txt',videofilename,fileobjectNumber)
file_object = io.open(fileobjectFilename, 'w')
lasttimePos=nil
end
function SecondsToClock(seconds)
local seconds = tonumber(seconds)
if seconds <= 0 then
return "00:00:00";
else
hours = string.format("%02.f", math.floor(seconds/3600));
mins = string.format("%02.f", math.floor(seconds/60 - (hours*60)));
secs = string.format("%02.2f", seconds - hours*3600 - mins *60);
return hours..":"..mins..":"..secs
end
end
local writeHeadPositionChange = function()
if filename == nil then
filename = mp.get_property("path")
end
if file_object == nil then
return
else
local initPass=false
if lasttimePos == nil then
lasttimePos = mp.get_property("time-pos")
startTime = lasttimePos
initPass=true
if lasttimePos == nil then
return
end
end
local newTimePos = mp.get_property("time-pos")
if newTimePos == nil then
return
end
local outputTs = string.format("%.3f-%.3f ",lasttimePos,newTimePos)
local changedValues = {}
local movementDuration = (newTimePos-lasttimePos)
local maximumTimeoutReached = movementDuration > 5.0
if initPass or pitch ~= last_pitch or maximumTimeoutReached then
changedValues[#changedValues+1]= string.format(", [expr] v360 pitch 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_pitch,pitch,lasttimePos,movementDuration)
end
last_pitch=pitch
if initPass or yaw ~= last_yaw or maximumTimeoutReached then
changedValues[#changedValues+1]= string.format(", [expr] v360 yaw 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_yaw,yaw,lasttimePos,movementDuration)
end
last_yaw=yaw
if initPass or roll ~= last_roll or maximumTimeoutReached then
changedValues[#changedValues+1]= string.format(", [expr] v360 roll 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_roll,roll,lasttimePos,movementDuration)
end
last_roll=roll
if initPass or dfov ~= last_dfov or maximumTimeoutReached then
changedValues[#changedValues+1]= string.format(", [expr] v360 d_fov 'lerp(%.3f,%.3f,(T-%.3f)/%.3f)'",last_dfov,dfov,lasttimePos,movementDuration)
end
last_dfov=dfov
if initPass then
init_pitch = pitch
init_yaw = yaw
init_roll = roll
init_dfov = dfov
end
if #changedValues > 0 then
local commandString = ''
for k,changedValue in pairs(changedValues) do
commandString = commandString .. changedValue
end
commandString = commandString:sub(2)
commandString = outputTs .. commandString .. ';'
file_object:write(commandString .. '\n')
lasttimePos = newTimePos
end
end
end
local updateAwaiting = false
local updateComplete = function()
updateAwaiting = false
end
local printRecordingStatus = function()
local startts = startTime
local endts = lasttimePos
local currenttS = mp.get_property("time-pos")
if file_object ~= nil and endts ~= nil and startts ~= nil then
endts = math.max(endts,currenttS)
mp.osd_message(string.format("Recording:%s",SecondsToClock(endts-startts)),10)
end
end
local updateFilters = function ()
if not filterIsOn then
mp.command_native_async({"no-osd", "vf", "add", string.format("@vrrev:%sv360=%s:%s:in_stereo=%s:out_stereo=2d:id_fov=%s:d_fov=%.3f:yaw=%.3f:pitch=%s:roll=%.3f:w=%s*192.0:h=%.3f*108.0:h_flip=%s:interp=%s",in_flip,inputProjection,outputProjection,in_stereo,idfov,dfov,yaw,pitch,roll,res,res,h_flip,scaling)}, updateComplete)
filterIsOn=true
else
if not updateAwaiting then
updateAwaiting=true
mp.command_native_async({"no-osd", "vf", "set", string.format("@vrrev:%sv360=%s:%s:in_stereo=%s:out_stereo=2d:id_fov=%s:d_fov=%.3f:yaw=%.3f:pitch=%s:roll=%.3f:w=%s*192.0:h=%.3f*108.0:h_flip=%s:interp=%s",in_flip,inputProjection,outputProjection,in_stereo,idfov,dfov,yaw,pitch,roll,res,res,h_flip,scaling)}, updateComplete)
end
filterIsOn=true
end
printRecordingStatus()
writeHeadPositionChange()
end
local mouse_btn0_cb = function ()
dragging = not dragging
if dragging then
mp.set_property("cursor-autohide", "always")
else
mp.set_property("cursor-autohide", "no")
end
end
local mouse_pan = function ()
if dragging then
local MousePosx, MousePosy = mp.get_mouse_pos()
local osd_w, osd_h = mp.get_property("osd-width"), mp.get_property("osd-height")
local yawpc = ((MousePosx/osd_w)-0.5)*180
local pitchpc = -((MousePosy/osd_h)-0.5)*180
local updateCrop = false
if smoothMouse then
if yaw ~= yawpc and math.abs(yaw-yawpc)<0.1 then
yaw = yawpc
updateCrop=true
yaw = math.max(-180,math.min(180,yaw))
elseif yaw ~= yawpc then
yaw = (yawpc+(yaw*5))/6
yaw = math.max(-180,math.min(180,yaw))
updateCrop=true
end
if pitch ~= pitchpc and math.abs(pitch-pitchpc)<0.1 then
pitch = pitchpc
pitch = math.max(-180,math.min(180,pitch))
updateCrop=true
elseif pitch ~= pitchpc then
pitch = (pitchpc+(pitch*5))/6
pitch = math.max(-180,math.min(180,pitch))
updateCrop=true
end
else
if yaw ~= yawpc then
yaw = yawpc
yaw = math.max(-180,math.min(180,yaw))
updateCrop=true
end
if pitch ~= pitchpc then
pitch = pitchpc
pitch = math.max(-180,math.min(180,pitch))
updateCrop=true
end
end
if updateCrop then
updateFilters()
end
end
end
local increment_res = function(inc)
res = res+inc
res = math.max(math.min(res,20),1)
mp.osd_message(string.format("Out-Width: %spx",res*108.0),0.5)
updateFilters()
end
local increment_roll = function (inc)
roll = roll+inc
updateFilters()
mp.osd_message(string.format("Roll: %s°",roll),0.5)
end
local increment_pitch = function (inc)
pitch = pitch+inc
updateFilters()
end
local increment_yaw = function (inc)
yaw = yaw+inc
updateFilters()
end
local increment_zoom = function (inc)
dfov = dfov+inc
dfov = math.max(math.min(150,dfov),30)
mp.osd_message(string.format("D-Fov: %s°",dfov),0.5)
updateFilters()
end
local toggleSmoothMouse = function()
smoothMouse = not smoothMouse
if smoothMouse then
mp.osd_message("Mouse smothing On",0.5)
else
mp.osd_message("Mouse smothing Off",0.5)
end
end
local switchScaler = function()
if scaling == 'nearest' then
scaling = 'cubic'
elseif scaling == 'cubic' then
scaling = 'lagrange9'
elseif scaling == 'lagrange9' then
scaling = 'lanczos'
elseif scaling == 'lanczos' then
scaling = 'linear'
elseif scaling == 'linear' then
scaling = 'nearest'
end
mp.osd_message("Scaling algorithm: " .. scaling,5.5)
updateFilters()
end
local switchEye = function()
if h_flip == '0' then
h_flip = '1'
in_flip = 'hflip,'
mp.osd_message("Right eye",0.5)
else
h_flip = '0'
in_flip = ''
mp.osd_message("Left eye",0.5)
end
print(ih_flip,h_flip)
updateFilters()
end
local cycleInputProjection = function()
inputProjectionInd = ((inputProjectionInd+1) % (#inputProjections +1))
inputProjection = inputProjections[inputProjectionInd]
mp.osd_message(string.format("Input projection: %s ",inputProjection),0.5)
updateFilters()
end
local cycleOutputProjection = function()
outputProjectionInd = ((outputProjectionInd+1) % (#outputProjections + 1))
outputProjection = outputProjections[outputProjectionInd]
mp.osd_message(string.format("Output projection: %s",outputProjection),0.5)
updateFilters()
end
local switchInputFovBounds = function()
if idfov == 180.0 then
idfov = 360.0
elseif idfov == 360.0 then
idfov = 90.0
else
idfov = 180.0
end
mp.osd_message(string.format("Input fov bounds: %s°",idfov),0.5)
updateFilters()
end
local switchStereoMode = function()
if in_stereo == 'sbs' then
in_stereo = 'tb'
else
in_stereo = 'sbs'
end
mp.osd_message("Input format: " .. in_stereo,0.5)
updateFilters()
end
local showHelp = function()
mp.osd_message("Keyboard and Mouse Controls:\n? = show help\ny,h = adjust quality\ni,j,k,l,mouseClick = Look around\nu,i = roll head\n-,=,mouseWheel = zoom\nr = switch SetereoMode\nt = switch Eye\ne = switch Scaler\ng = toggle mouse smothing\nn = start and stop motion recording\n1,2 - cycle in and out projections",10)
end
local closeCurrentLog = function()
commandForFinalLog=''
if lasttimePos ~= nil and file_object ~= nil then
finalTimeStamp = mp.get_property("time-pos")
file_object:write('#\n')
local stats = string.format( '# Duration: %s-%s (total %s) %s seconds',
SecondsToClock(startTime),SecondsToClock(finalTimeStamp),SecondsToClock(finalTimeStamp-startTime),finalTimeStamp-startTime )
print('#')
file_object:write( stats .. '\n')
print(stats)
file_object:write( '# Suggested ffmpeg conversion command:\n')
local closingCommandComment = string.format('ffmpeg -y -ss %s -i "%s" -to %s -copyts -filter_complex "%sv360=%s:%s:in_stereo=%s:out_stereo=2d:id_fov=%s:d_fov=%.3f:yaw=%.3f:pitch=%.3f:roll=%.3f:w=1920.0:h=1080.0:interp=cubic:h_flip=%s,sendcmd=filename=%s_3dViewHistory_%s.txt" -avoid_negative_ts make_zero -preset slower -crf 17 "%s_2d_%03d.mp4"',
startTime,filename,finalTimeStamp,in_flip,inputProjection,outputProjection,in_stereo,idfov,init_dfov,init_yaw,init_pitch,init_roll,h_flip,videofilename,fileobjectNumber,videofilename,fileobjectNumber
)
file_object:write('# ' .. closingCommandComment .. '\n')
file_object:write('#\n')
print(closingCommandComment)
print('#')
commandForFinalLog = closingCommandComment
end
if file_object ~= nil then
file_object:close()
file_object = nil
end
return commandForFinalLog
end
local startNewLogSession = function()
if file_object == nil then
openNewLogFile()
writeHeadPositionChange()
mp.osd_message(string.format("Start Motion Record %s_3dViewHistory_%s.txt",videofilename,fileobjectNumber),0.5)
else
mp.osd_message(string.format("Stop Motion Record %s_3dViewHistory_%s.txt",videofilename,fileobjectNumber),0.5)
writeHeadPositionChange()
local command = closeCurrentLog()
if command then
ffmpegComamndList[#ffmpegComamndList+1] = command
end
end
end
local onExit = function()
closeCurrentLog()
mergedCommand = ''
for k,v in pairs(ffmpegComamndList) do
if v ~= '' then
mergedCommand = mergedCommand .. ' & ' .. v
end
end
if mergedCommand ~= '' then
mergedCommand = mergedCommand:sub(3)
print(mergedCommand)
batchfile = io.open('convert_3dViewHistory.bat', 'w')
batchfile:write(mergedCommand)
batchfile:close()
print('Batch processing file created convert_3dViewHistory.bat')
else
print('No head motions logged')
end
end
local recordingStatusTimer = nil
local initFunction = function()
mp.add_forced_key_binding("1", cycleInputProjection )
mp.add_forced_key_binding("2", cycleOutputProjection )
mp.add_forced_key_binding("u", function() increment_roll(-1) end, 'repeatable')
mp.add_forced_key_binding("o", function() increment_roll(1) end, 'repeatable')
mp.add_forced_key_binding("v", writeHeadPositionChange)
mp.add_forced_key_binding("i", function() increment_pitch(1) end, 'repeatable')
mp.add_forced_key_binding("k", function() increment_pitch(-1) end, 'repeatable')
mp.add_key_binding("l", function() increment_yaw(1) end, 'repeatable')
mp.add_key_binding("j", function() increment_yaw(-1) end, 'repeatable')
mp.add_key_binding("c", "easy_crop", updateFilters)
mp.add_forced_key_binding("y", function() increment_res(1) end, 'repeatable')
mp.add_forced_key_binding("h", function() increment_res(-1) end, 'repeatable')
mp.add_forced_key_binding("=", function() increment_zoom(-1) end, 'repeatable')
mp.add_forced_key_binding("-", function() increment_zoom(1) end, 'repeatable')
mp.add_forced_key_binding("WHEEL_DOWN", function() increment_zoom(1) end)
mp.add_forced_key_binding("WHEEL_UP", function() increment_zoom(-1) end)
mp.add_forced_key_binding("r", switchStereoMode)
mp.add_forced_key_binding("t", switchEye)
mp.add_forced_key_binding("e", switchScaler)
mp.add_forced_key_binding("g", toggleSmoothMouse)
mp.add_forced_key_binding("b", switchInputFovBounds)
mp.add_forced_key_binding("n", startNewLogSession)
mp.set_property("osc", "no")
mp.set_property("fullscreen", "yes")
mp.set_property("osd-font-size", "30")
mp.add_forced_key_binding("mouse_btn0",mouse_btn0_cb)
mp.add_forced_key_binding("mouse_move", mouse_pan)
mp.add_forced_key_binding("?", showHelp)
mp.add_forced_key_binding("/", showHelp)
mp.register_event("end-file", onExit)
mp.register_event("shutdown", onExit)
recordingStatusTimer = mp.add_periodic_timer(0.1,printRecordingStatus)
updateFilters()
end
mp.register_event("file-loaded", initFunction)

3
.local/bin/mpv3d Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
exec /usr/bin/mpv --script=/home/breizh/.local/bin/360plugin.lua "$@"