mirror of
https://github.com/ivuorinen/dotfiles.git
synced 2026-01-26 11:14:08 +00:00
94 lines
2.1 KiB
Bash
Executable File
94 lines
2.1 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# shell functions
|
|
#
|
|
|
|
# Weather in Tampere, or other city
|
|
function weather
|
|
{
|
|
# https://github.com/chubin/wttr.in#usage
|
|
local city="${1:-Tampere}"
|
|
curl "http://wttr.in/${city// /+}?2nFQM&lang=fi"
|
|
}
|
|
|
|
# Docker
|
|
function ssh-docker
|
|
{
|
|
docker exec -it "$@" bash
|
|
}
|
|
|
|
# Create a new directory and enter it
|
|
function mkd
|
|
{
|
|
mkdir -p "$@" && cd "$@" || exit
|
|
}
|
|
|
|
# All the dig info
|
|
function digga
|
|
{
|
|
dig +nocmd "$1" any +multiline +noall +answer
|
|
}
|
|
|
|
# Rector project to php version 8.0 by default.
|
|
function rector
|
|
{
|
|
local php="${1:-80}"
|
|
docker run -v "$(pwd)":/project rector/rector:latest process \
|
|
"/project/$1" \
|
|
--set "php${php}" \
|
|
--autoload-file /project/vendor/autoload.php
|
|
}
|
|
|
|
# Commit everything
|
|
function commit
|
|
{
|
|
commitMessage="$*"
|
|
|
|
if [ "$commitMessage" = "" ]; then
|
|
commitMessage="Automated commit"
|
|
fi
|
|
|
|
git add .
|
|
eval "git commit -a -m '${commitMessage}'"
|
|
}
|
|
|
|
function scheduler
|
|
{
|
|
while :; do
|
|
php artisan schedule:run
|
|
echo "Sleeping 60 seconds..."
|
|
sleep 60
|
|
done
|
|
}
|
|
|
|
function silent
|
|
{
|
|
"$@" >&/dev/null
|
|
}
|
|
|
|
# Defines default antigen bundles
|
|
function x-default-antigen-bundles
|
|
{
|
|
# these should be always available
|
|
antigen bundle colored-man-pages
|
|
antigen bundle command-not-found
|
|
antigen bundle ssh-agent
|
|
antigen bundle MichaelAquilina/zsh-you-should-use
|
|
antigen bundle Sparragus/zsh-auto-nvm-use
|
|
antigen bundle jreese/zsh-titles
|
|
antigen bundle unixorn/autoupdate-antigen.zshplugin
|
|
antigen bundle zsh-users/zsh-completions
|
|
antigen bundle zsh-users/zsh-syntax-highlighting
|
|
|
|
# these should be available if there's need
|
|
hash git 2> /dev/null && antigen bundle git
|
|
hash brew 2> /dev/null && antigen bundle brew
|
|
hash docker 2> /dev/null && antigen bundle docker
|
|
hash docker-compose 2> /dev/null && antigen bundle sroze/docker-compose-zsh-plugin
|
|
hash jq 2> /dev/null && antigen bundle reegnz/jq-zsh-plugin
|
|
hash nvm 2> /dev/null && antigen bundle nvm
|
|
hash php 2> /dev/null && antigen bundle php
|
|
hash python 2> /dev/null && antigen bundle MichaelAquilina/zsh-autoswitch-virtualenv
|
|
hash rvm 2> /dev/null && antigen bundle unixorn/rvm-plugin
|
|
}
|