initial commit for new repo

This commit is contained in:
Phuntsok Drak-pa
2019-07-21 03:27:31 +02:00
commit de542b3e97
80 changed files with 17176 additions and 0 deletions

22
fishfunctions/4chandl.fish Executable file
View File

@@ -0,0 +1,22 @@
#!/usr/bin/env fish
function 4chandl -d "Download media from 4chan thread"
if ! count $argv > /dev/null
echo 'No URL specified! Give the URL to thread as the only argument.'
end
set url $argv[1]
set regex_4cdn '\/\/is2\.4chan\.org\/[a-z]+\/[A-Za-z0-9]+\.[A-Za-z]{3,4}'
set total (curl -ks $url | grep -oE $regex_4cdn | uniq | wc -l)
echo total: $total
set counter 1
for image_url in (curl -k -s $url | grep -Eo $regex_4cdn | uniq | sed 's/^/https:/')
echo -n Downloading image $counter of $total...
wget --no-check-certificate -q -nc $image_url
echo ' Done'
set counter (math $counter + 1)
end
end

31
fishfunctions/cnew.fish Normal file
View File

@@ -0,0 +1,31 @@
function cnew -d "Create new C11 project"
if count $argv > /dev/null
set projname ""
for item in $argv
switch "$item"
case -h --help
man ~/dotfiles/fishfunctions/cnew.man
return 0
case '*'
set projname $item
end
end
if [ "$projname" = "" ]
echo "Missing argument: PROJECT"
return -1
end
cp -r ~/dotfiles/dev/templateC $argv[1]
cd $argv[1]
sed -i "s/PROJECTNAME/$argv[1]/g" CMakeLists.txt
sed -i "s/PROJECTNAME/$argv[1]/g" README.org
sed -i "s/CPROJECTNAME/$argv[1]/g" doc/Doxyfile
git init
git add .
git commit -m "initial commit"
cd ..
else
echo "Missing argument: PROJECT"
return -1
end
end
complete -c cppnew -s h -l help -d 'Print Help'

26
fishfunctions/cnew.man Normal file
View File

@@ -0,0 +1,26 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "cnew" "" "" "" ""
.hy
.SH NAME
.PP
\f[B]cnew\f[R] \- New C11 Project
.SH SYNOPSIS
.PP
cnew PROJECT
.SH DESCRIPTION
.PP
Creates a new C11 CMake\-based project named PROJECT.
.SH REPORTING BUGS
.PP
Git repository available at
<https://labs.phundrak.fr/phundrak/dotfiles>.
.SH Copyright
.PP
Copyright Lucien \[dq]Phundrak\[dq] Cartier Tilet 2019\-2020.
Licence GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH AUTHORS
Lucien \[dq]Phundrak\[dq] Cartier Tilet.

16
fishfunctions/cnew.org Normal file
View File

@@ -0,0 +1,16 @@
#+TITLE: cnew
#+AUTHOR: Lucien "Phundrak" Cartier Tilet
* NAME
*{{{title}}}* - New C11 Project
* SYNOPSIS
{{{title}}} PROJECT
* DESCRIPTION
Creates a new C11 CMake-based project named PROJECT.
* REPORTING BUGS
Git repository available at [[https://labs.phundrak.fr/phundrak/dotfiles]].
* Copyright
Copyright {{{author}}} 2019-2020. Licence GPLv3+: GNU GPL version 3 or later [[https://gnu.org/licenses/gpl.html]]. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

49
fishfunctions/cppnew.fish Normal file
View File

@@ -0,0 +1,49 @@
function cppnew -d "Create new C++17 project" --argument-names 'projectname'
if count $argv > /dev/null
set conanproj "false"
set projname ""
set conanprojname ""
for item in $argv
switch "$item"
case -c --conan
set conanproj "true"
set conanprojname $value
case -h --help
man ~/dotfiles/fishfunctions/cppnew.man
return 0
case '*'
set projname $item
end
end
if [ "$projname" = "" ]
if [ "$conanprojname" = "" ]
echo "Missing argument: PROJECT"
return -1
end
end
if [ "$projname" = "" ]
set projname $conanprojname
end
if [ "$conanproj" = "true" ]
cp -r ~/dotfiles/dev/conan-project $projname
else
cp -r ~/dotfiles/dev/templateC++ $projname
end
cd $projname
sed -i "s/PROJECTNAME/$projname/g" README.org
sed -i "s/PROJECTNAME/$projname/g" CMakeLists.txt
if [ "$conanproj" = "true" ]
sed -i "s/PROJECTNAME/$projname/g" conanfile.py
end
sed -i "s/CPPPROJECTNAME/$projname/g" doc/Doxyfile
git init
git add .
git commit -m "initial commit"
cd ..
else
echo "Missing argument: PROJECT"
return -1
end
end
complete -c cppnew -s c -l conan -d 'Conan Project'
complete -c cppnew -s h -l help -d 'Print Help'

30
fishfunctions/cppnew.man Normal file
View File

@@ -0,0 +1,30 @@
.\" Automatically generated by Pandoc 2.5
.\"
.TH "cppnew" "" "" "" ""
.hy
.SH NAME
.PP
\f[B]cppnew\f[R] \- New C++17 Project
.SH SYNOPSIS
.PP
cppnew [\-c, \[en]connan] PROJECT
.SH DESCRIPTION
.PP
Creates a new C++17 project named PROJECT, either CMake\-based only or
CMake and Conan\-based.
.TP
.B \f[C]\-c\f[R], \f[C]\-\-connan\f[R]
Creates a Conan\-based project
.SH REPORTING BUGS
.PP
Git repository available at
<https://labs.phundrak.fr/phundrak/dotfiles>.
.SH Copyright
.PP
Copyright Lucien \[dq]Phundrak\[dq] Cartier Tilet 2019\-2020.
Licence GPLv3+: GNU GPL version 3 or later
<https://gnu.org/licenses/gpl.html>.
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
.SH AUTHORS
Lucien \[dq]Phundrak\[dq] Cartier Tilet.

18
fishfunctions/cppnew.org Normal file
View File

@@ -0,0 +1,18 @@
#+TITLE: cppnew
#+AUTHOR: Lucien "Phundrak" Cartier Tilet
* NAME
*{{{title}}}* - New C++17 Project
* SYNOPSIS
{{{title}}} [-c, --connan] PROJECT
* DESCRIPTION
Creates a new C++17 project named PROJECT, either CMake-based only or CMake and Conan-based.
- ~-c~, ~--connan~ :: Creates a Conan-based project
* REPORTING BUGS
Git repository available at [[https://labs.phundrak.fr/phundrak/dotfiles]].
* Copyright
Copyright {{{author}}} 2019-2020. Licence GPLv3+: GNU GPL version 3 or later [[https://gnu.org/licenses/gpl.html]]. This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

4
fishfunctions/mcd.fish Normal file
View File

@@ -0,0 +1,4 @@
function mcd -d "Create directory and cd to it"
mkdir $argv[1]
cd $argv[1]
end

View File

@@ -0,0 +1,22 @@
function rainymood
set volume 50
getopts $argv | while read -l key option
switch $key
case v
set volume $option
case volume
set volume $option
end
end
if [ "$volume" != "" ]
set FILE (math (random) % 4)
set URL "https://rainymood.com/audio1110/$FILE.ogg"
mpv $URL --force-window=no --volume=$volume; and rainymood
else
echo "Missing value after -v/--volume option."
echo "Usage example:"
printf "\trainymood -v50\n\trainymood --volume 50\n"
return 1
end
end
complete -c rainymood -s v -l volume -d 'Volume of the rain (0-100)'

7
fishfunctions/we.fish Normal file
View File

@@ -0,0 +1,7 @@
function we -d "Get weather at location"
if count $argv > /dev/null
curl http://wttr.in/~$argv[1]
else
curl http://wttr.in/Aubervilliers
end
end