reorganized files

This commit is contained in:
Phuntsok Drak-pa
2019-09-26 20:49:23 +02:00
parent 6187accec5
commit a918e51e87
20 changed files with 10 additions and 6 deletions

21
.config/fish/config.fish Normal file
View File

@@ -0,0 +1,21 @@
# emacs ansi-term support
if test -n "$EMACS"
set -x TERM eterm-color
end
# this function may be required
function fish_title
true
end
if test "$TERM" = "dumb"
function fish_prompt
echo "\$ "
end
function fish_right_prompt; end
function fish_greeting; end
function fish_title; end
end
set -gx PATH $HOME/go/bin $HOME/.cargo/bin $HOME/.local/bin $HOME/.gem/ruby/2.6.0/bin $PATH
set -gx PKG_CONFIG_PATH /usr/local/lib/pkgconfig/ $PKG_CONFIG_PATH

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

View File

@@ -0,0 +1,3 @@
function backup -d "backs up a file and appends to its name the date and time of backup"
cp $argv[1] $argv[1].bak.(date +"%Y%m%d%H%M%S")
end

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 ~/dev/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'

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 ~/dev/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'

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)'

View File

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