Unverified Commit 8c95c523 authored by Kozlov Alexander's avatar Kozlov Alexander Committed by GitHub
Browse files

Merge branch 'master' into master

parents dd30cf10 3d8f2bda
......@@ -21,7 +21,7 @@ alias pd='perldoc'
alias ple='perl -wlne'
# show the latest stable release of Perl
alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\'
alias latest-perl='curl -s https://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\'
......
......@@ -4,6 +4,6 @@ Plugin to handle some unix filesystem permissions quickly
### Usage
* `set755` recursively sets all directories located within the current working directory and sub directories to octal 755.
* `set644` recursively sets all files located within the current working directory and sub directories to octal 644.
* `set755` recursively sets all given directories (default to .) to octal 755.
* `set644` recursively sets all given files (default to .) to octal 644.
* `fixperms` is a wrapper around `set755` and `set644` applied to a specified directory or the current directory otherwise. It also prompts prior to execution unlike the other two aliases.
......@@ -6,10 +6,14 @@
### Aliases
# Set all files' permissions to 644 recursively in a directory
alias set644='find . -type f ! -perm 644 -print0 | xargs -0 chmod 644'
set644() {
find "${@:-.}" -type f ! -perm 644 -print0 | xargs -0 chmod 644
}
# Set all directories' permissions to 755 recursively in a directory
alias set755='find . -type d ! -perm 755 -print0 | xargs -0 chmod 755'
set755() {
find "${@:-.}" -type d ! -perm 755 -print0 | xargs -0 chmod 755
}
### Functions
......
......@@ -7,7 +7,7 @@
# -----------------------------------------------------------------------------
# FILE: _pod
# DESCRIPTION: Cocoapods (0.33.1) autocomplete plugin for Oh-My-Zsh
# http://cocoapods.org
# https://cocoapods.org
# Generated with `pod --completion-script
# AUTHOR: Alexandre Joly (alexandre.joly@mekanics.ch)
# GITHUB: https://github.com/mekanics
......
# Postgres plugin
This plugin adds some aliases for useful Postgres commands.
:warning: this plugin works exclusively with Postgres installed via Homebrew on OSX
because Postgres paths are hardcoded to `/usr/local/var/postgres`.
To use it, add `postgres` to the plugins array in your zshrc file:
```zsh
plugins=(... postgres)
```
## Aliases
| Alias | Command | Description |
|-------------|---------------------------------------------------------------------------------|-------------------------------------------------------------|
| startpost | `pg_ctl -D /usr/local/var/postgres -l /usr/local/var/postgres/server.log start` | Start postgres server |
| stoppost | `pg_ctl -D /usr/local/var/postgres stop -s -m fast` | Stop postgres server |
| restartpost | `stoppost && sleep 1 && startpost` | Restart (calls stop, then start) |
| reloadpost | `pg_ctl reload -D /usr/local/var/postgres -s` | Reload postgres configuration (some setting require restart)|
| statuspost | `pg_ctl status -D /usr/local/var/postgres -s` | Check startus of postgres server (running, stopped) |
......@@ -73,7 +73,7 @@ powed(){
}
# Restart pow process
# taken from http://www.matthewratzloff.com/blog/2011/12/23/restarting-pow-when-dns-stops-responding
# taken from https://www.matthewratzloff.com
repow(){
lsof | grep 20560 | awk '{print $2}' | xargs kill -9
launchctl unload ~/Library/LaunchAgents/cx.pow.powd.plist
......
_homebrew-installed() {
type brew &> /dev/null
}
# This plugin loads pyenv into the current shell and provides prompt info via
# the 'pyenv_prompt_info' function. Also loads pyenv-virtualenv if available.
_pyenv-from-homebrew-installed() {
brew --prefix pyenv &> /dev/null
}
FOUND_PYENV=$+commands[pyenv]
FOUND_PYENV=0
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
for pyenvdir in "${pyenvdirs[@]}" ; do
if [ -d $pyenvdir/bin -a $FOUND_PYENV -eq 0 ] ; then
if [[ $FOUND_PYENV -ne 1 ]]; then
pyenvdirs=("$HOME/.pyenv" "/usr/local/pyenv" "/opt/pyenv")
for dir in $pyenvdirs; do
if [[ -d $dir/bin ]]; then
export PATH="$PATH:$dir/bin"
FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
eval "$(pyenv virtualenv-init - zsh)"
break
fi
done
fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
if [[ $FOUND_PYENV -ne 1 ]]; then
if (( $+commands[brew] )) && dir=$(brew --prefix pyenv 2>/dev/null); then
if [[ -d $dir/bin ]]; then
export PATH="$PATH:$dir/bin"
FOUND_PYENV=1
fi
done
unset pyenvdir
fi
fi
if [ $FOUND_PYENV -eq 0 ] ; then
pyenvdir=$(brew --prefix pyenv 2> /dev/null)
if [ $? -eq 0 -a -d $pyenvdir/bin ] ; then
FOUND_PYENV=1
export PYENV_ROOT=$pyenvdir
export PATH=${pyenvdir}/bin:$PATH
if [[ $FOUND_PYENV -eq 1 ]]; then
eval "$(pyenv init - zsh)"
if pyenv commands | command grep -q virtualenv-init; then
if (( $+commands[pyenv-virtualenv-init] )); then
eval "$(pyenv virtualenv-init - zsh)"
fi
function pyenv_prompt_info() {
echo "$(pyenv version-name)"
}
fi
else
# fallback to system python
function pyenv_prompt_info() {
echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')"
}
fi
if [ $FOUND_PYENV -eq 0 ] ; then
function pyenv_prompt_info() { echo "system: $(python -V 2>&1 | cut -f 2 -d ' ')" }
fi
unset FOUND_PYENV dir
# pylint
This plugin adds code analysis for python through [Pylint](https://www.pylint.org/).
To use it, add `pylint` to the plugins array in your zshrc file:
```zsh
plugins=(... pylint)
```
## Aliases
| Alias | Command | Description |
| -------------| -------------------- | -------------------------------------------------------------------------------------------------------------------------|
| pylint-quick | `pylint --reports=n` | Displays a set of reports each one focusing on a particular aspect of the project, default set `no` for multiple reports | |
# python plugin
The plugin adds several aliases for useful [python](https://www.python.org/) commands.
To use it, add `python` to the plugins array of your zshrc file:
```
plugins=(... python)
```
## Aliases
| Command | Description |
|------------------|---------------------------------------------------------------------------------|
| `pyfind` | Finds .py files recursively in the current directory |
| `pyclean [dirs]` | Deletes byte-code and cache files from a list of directories or the current one |
| `pygrep <text>` | Looks for `text` in .py files |
#compdef python
# Python 2.6
# Python 3.0
local curcontext="$curcontext" state line expl
typeset -A opt_args
local -a args
if _pick_variant python3=Python\ 3 python2 --version; then
args=(
'(-bb)-b[issue warnings about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
'(-b)-bb[issue errors about str(bytes_instance), str(bytearray_instance) and comparing bytes/bytearray with str]'
)
else
args=(
'-Q+[division options]:division option:(old warn warnall new)'
'(-tt)-t[issue warnings about inconsistent tab usage]'
'(-t)-tt[issue errors about inconsistent tab usage]'
'-3[warn about Python 3.x incompatibilities]'
)
fi
_arguments -C -s -S "$args[@]" \
"-B[don't write .py\[co\] files on import]" \
'(1 -)-c+[program passed in as string (terminates option list)]:python command:' \
'-d[debug output from parser]' \
'-E[ignore PYTHON* environment variables (such as PYTHONPATH)]' \
'(1 * -)-h[display help information]' \
'-i[inspect interactively after running script]' \
'(1 * -)-m[run library module as a script (terminates option list)]:module:->modules' \
'-O[optimize generated bytecode slightly]' \
'-OO[remove doc-strings in addition to the -O optimizations]' \
"-s[don't add user site directory to sys.path]" \
"-S[don't imply 'import site' on initialization]" \
'-u[unbuffered binary stdout and stderr]' \
'-v[verbose (trace import statements)]' \
'(1 * -)'{-V,--version}'[display version information]' \
'-W+[warning control]:warning filter (action\:message\:category\:module\:lineno):(default always ignore module once error)' \
'-x[skip first line of source, allowing use of non-Unix forms of #!cmd]' \
'(-)1:script file:_files -g "*.py(|c|o)(-.)"' \
'*::script argument: _normal' && return
if [[ "$state" = modules ]]; then
local -a modules
modules=(
${${=${(f)"$(_call_program modules $words[1] -c \
'from\ pydoc\ import\ help\;\ help\(\"modules\"\)')"}[2,-3]}:#\(package\)}
)
_wanted modules expl module compadd -a modules && return
fi
return 1
# Find python file
alias pyfind='find . -name "*.py"'
# Remove python compiled byte-code in either current directory or in a
# Remove python compiled byte-code and mypy cache in either current directory or in a
# list of specified directories
function pyclean() {
ZSH_PYCLEAN_PLACES=${*:-'.'}
find ${ZSH_PYCLEAN_PLACES} -type f -name "*.py[co]" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name "__pycache__" -delete
find ${ZSH_PYCLEAN_PLACES} -type d -name ".mypy_cache" -delete
}
# Grep among .py files
......
......@@ -51,6 +51,9 @@ _arguments \
if (( CURRENT == 1 )); then
_describe -t commands "rails subcommand" _1st_arguments
return
else
_files
return
fi
case "$words[1]" in
......
......@@ -8,7 +8,7 @@ checks the file modification time to see if it needs to regenerate the cache
file.
This is entirely based on [this pull request by Ullrich Schäfer](https://github.com/robb/.dotfiles/pull/10/),
which is inspired by [this Ruby on Rails trick from 2006](http://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
which is inspired by [this Ruby on Rails trick from 2006](https://weblog.rubyonrails.org/2006/3/9/fast-rake-task-completion-for-zsh/).
Think about that. 2006.
......
# rand-quote plugin
Displays a random quote taken from [quotationspage.com](http://www.quotationspage.com/random.php)
Created by [Eduardo San Martin Morote, aka Posva](https://posva.github.io)
## Usage
Add the plugin to the plugins array in your zshrc file and restart zsh:
```zsh
plugins=(... rand-quote)
```
Then, run `quote` to get a new random quote.
# Get a random quote fron the site http://www.quotationspage.com/random.php3
# Created by Eduardo San Martin Morote aka Posva
# http://posva.github.io
# Sun Jun 09 10:59:36 CEST 2013
# Don't remove this header, thank you
# Usage: quote
if ! (( $+commands[curl] )); then
echo "rand-quote plugin needs curl to work" >&2
return
fi
WHO_COLOR="\e[0;33m"
TEXT_COLOR="\e[0;35m"
COLON_COLOR="\e[0;35m"
END_COLOR="\e[m"
function quote {
emulate -L zsh
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
if [[ -x `which curl` ]]; then
function quote()
{
Q=$(curl -s --connect-timeout 2 "http://www.quotationspage.com/random.php3" | iconv -c -f ISO-8859-1 -t UTF-8 | grep -m 1 "dt ")
TXT=$(echo "$Q" | sed -e 's/<\/dt>.*//g' -e 's/.*html//g' -e 's/^[^a-zA-Z]*//' -e 's/<\/a..*$//g')
W=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
if [ "$W" -a "$TXT" ]; then
echo "${WHO_COLOR}${W}${COLON_COLOR}: ${TEXT_COLOR}${TXT}${END_COLOR}"
fi
}
#quote
else
echo "rand-quote plugin needs curl to work" >&2
fi
WHO=$(echo "$Q" | sed -e 's/.*\/quotes\///g' -e 's/<.*//g' -e 's/.*">//g')
[[ -n "$WHO" && -n "$TXT" ]] && print -P "%F{3}${WHO}%f: “%F{5}${TXT}%f”"
}
......@@ -12,7 +12,7 @@ plugins=(... react-native)
## Aliases
| Alias | React Native command |
|:------------|:-----------------------------------------------|
| :------------ | :------------------------------------------------- |
| **rn** | `react-native` |
| **rns** | `react-native start` |
| **rnlink** | `react-native link` |
......@@ -24,6 +24,15 @@ plugins=(... react-native)
| **rnios5s** | `react-native run-ios --simulator "iPhone 5s"` |
| **rnios6** | `react-native run-ios --simulator "iPhone 6"` |
| **rnios6s** | `react-native run-ios --simulator "iPhone 6s"` |
| **rnios7** | `react-native run-ios --simulator "iPhone7"` |
| **rnios7p** | `react-native run-ios --simulator "iPhone 7 Plus"` |
| **rnios8** | `react-native run-ios --simulator "iPhone 8"` |
| **rnios8p** | `react-native run-ios --simulator "iPhone 8 Plus"` |
| **rniosse** | `react-native run-ios --simulator "iPhone SE"` |
| **rniosx** | `react-native run-ios --simulator "iPhone X"` |
| **rniosxs** | `react-native run-ios --simulator "iPhone XS"` |
| **rniosxsm** | `react-native run-ios --simulator "iPhone XS Max"` |
| **rniosxr** | `react-native run-ios --simulator "iPhone XR"` |
| _Logging_ |
| **rnland** | `react-native log-android` |
| **rnlios** | `react-native log-ios` |
......@@ -9,6 +9,15 @@ alias rnios5='react-native run-ios --simulator "iPhone 5"'
alias rnios5s='react-native run-ios --simulator "iPhone 5s"'
alias rnios6='react-native run-ios --simulator "iPhone 6"'
alias rnios6s='react-native run-ios --simulator "iPhone 6s"'
alias rnios7='react-native run-ios --simulator "iPhone 7"'
alias rnios7p='react-native run-ios --simulator "iPhone 7 Plus"'
alias rnios8='react-native run-ios --simulator "iPhone 8"'
alias rnios8p='react-native run-ios --simulator "iPhone 8 Plus"'
alias rniosse='react-native run-ios --simulator "iPhone SE"'
alias rniosx='react-native run-ios --simulator "iPhone X"'
alias rniosxs='react-native run-ios --simulator "iPhone XS"'
alias rniosxsm='react-native run-ios --simulator "iPhone XS Max"'
alias rniosxr='react-native run-ios --simulator "iPhone XR"'
alias rnland='react-native log-android'
alias rnlios='react-native log-ios'
......@@ -2,6 +2,6 @@
**Maintainer:** [Stibbons](https://github.com/Stibbons)
This plugin mainly add support automatic completion for the repo command line tool:
http://code.google.com/p/git-repo/
https://code.google.com/p/git-repo/
* `r` aliases `repo`
# rsync
This plugin adds aliases for frequent [rsync](https://rsync.samba.org/) commands.
To use it add `rsync` to the plugins array in you zshrc file.
```zsh
plugins=(... rsync)
```
| Alias | Command |
| ------------------- | ------------------------------------------------ |
| *rsync-copy* | `rsync -avz --progress -h` |
| *rsync-move* | `rsync -avz --progress -h --remove-source-files` |
| *rsync-update* | `rsync -avzu --progress -h` |
| *rsync-synchronize* | `rsync -avzu --delete --progress -h` |
# Ruby plugin
This plugin adds aliases for common commands used in dealing with [Ruby](https://www.ruby-lang.org/en/) and [gem packages](https://rubygems.org/).
To use it, add `ruby` to the plugins array in your zshrc file:
```zsh
plugins=(... ruby)
```
## Aliases
| Alias | Command | Description |
|-------|----------------------------------------|------------------------------------------------------|
| rb | `ruby` | The Ruby command |
| sgem | `sudo gem` | Run sudo gem on the system ruby, not the active ruby |
| rfind | `find . -name "*.rb" \| xargs grep -n` | Find ruby file |
| gin | `gem install` | Install a gem into the local repository |
| gun | `gem uninstall` | Uninstall gems from the local repository |
| gli | `gem list` | Display gems installed locally |
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment