bafa8cd980336ea830ba6c9f84d1f94893de4def

Author
Robby Russell <robby@planetargon.com>
Committer
Robby Russell <robby@planetargon.com>
Date

Message

Merge branch 'master' of https://github.com/dbbolton/oh-my-zsh into dbbolton-master

Diff

  1diff --git a/plugins/debian/debian.plugin.zsh b/plugins/debian/debian.plugin.zsh
  2new file mode 100644
  3index 0000000000000000000000000000000000000000..f8865a41210d3318525e867734cffd7cbe5bb7b2
  4--- /dev/null
  5+++ b/plugins/debian/debian.plugin.zsh
  6@@ -0,0 +1,60 @@
  7+# https://github.com/dbbolton/
  8+#
  9+# Debian-related zsh aliases and functions for zsh
 10+
 11+
 12+# Aliases ###################################################################
 13+
 14+# Some self-explanatory aliases
 15+alias afs='apt-file search --regexp'
 16+alias aps='aptitude search'
 17+alias apsrc='apt-get source'
 18+alias apv='apt-cache policy'
 19+
 20+alias apdg='su -c "aptitude update && aptitude safe-upgrade"'
 21+alias apud='su -c "aptitude update"'
 22+alias apug='su -c "aptitude safe-upgrade"'
 23+
 24+# print all installed packages
 25+alias allpkgs='aptitude search -F "%p" --disable-columns ~i'
 26+
 27+# Install all .deb files in the current directory.
 28+# Warning: you will need to put the glob in single quotes if you use:
 29+# glob_subst
 30+alias di='su -c "dpkg -i ./*.deb"'
 31+
 32+# Create a basic .deb package
 33+alias mydeb='time dpkg-buildpackage -rfakeroot -us -uc'
 34+
 35+# Remove ALL kernel images and headers EXCEPT the one in use
 36+alias kclean='su -c '\''aptitude remove -P ?and(~i~nlinux-(ima|hea) ?not(~n`uname -r`))'\'' root'
 37+
 38+
 39+
 40+# Functions #################################################################
 41+
 42+# create a simple script that can be used to 'duplicate' a system
 43+apt-copy() {
 44+	print '#!/bin/sh'"\n" > apt-copy.sh
 45+
 46+	list=$(perl -m'AptPkg::Cache' -e '$c=AptPkg::Cache->new; for (keys %$c){ push @a, $_ if $c->{$_}->{'CurrentState'} eq 'Installed';} print "$_ " for sort @a;')
 47+
 48+	print 'aptitude install '"$list\n" >> apt-copy.sh
 49+
 50+	chmod +x apt-copy.sh
 51+}
 52+
 53+
 54+# Kernel-package building shortcut
 55+dbb-build () {
 56+	MAKEFLAGS=''		# temporarily unset MAKEFLAGS ( '-j3' will fail )
 57+	appendage='-custom' # this shows up in $ (uname -r )
 58+    revision=$(date +"%Y%m%d") # this shows up in the .deb file name
 59+
 60+    make-kpkg clean
 61+
 62+    time fakeroot make-kpkg --append-to-version "$appendage" --revision \
 63+        "$revision" kernel_image kernel_headers
 64+}
 65+
 66+
 67diff --git a/plugins/perl/perl.plugin.zsh b/plugins/perl/perl.plugin.zsh
 68new file mode 100644
 69index 0000000000000000000000000000000000000000..f94c4195dcecb2d0c15e5baa6a651731212405ad
 70--- /dev/null
 71+++ b/plugins/perl/perl.plugin.zsh
 72@@ -0,0 +1,62 @@
 73+# https://github.com/dbbolton
 74+#
 75+# Below are some useful Perl-related aliases/functions that I use with zsh.
 76+
 77+
 78+# Aliases ###################################################################
 79+
 80+# perlbrew ########
 81+alias pbi='perlbrew install'
 82+alias pbl='perlbrew list'
 83+alias pbo='perlbrew off'
 84+alias pbs='perlbrew switch'
 85+alias pbu='perlbrew use'
 86+
 87+# Perl ############
 88+
 89+# perldoc`
 90+alias pd='perldoc'
 91+
 92+# use perl like awk/sed
 93+alias ple='perl -wlne'
 94+
 95+# show the latest stable release of Perl
 96+alias latest-perl='curl -s http://www.perl.org/get.html | perl -wlne '\''if (/perl\-([\d\.]+)\.tar\.gz/) { print $1; exit;}'\'
 97+
 98+
 99+
100+# Functions #################################################################
101+
102+# newpl - creates a basic Perl script file and opens it with $EDITOR 
103+newpl () {
104+	# set $EDITOR to 'vim' if it is undefined
105+	[[ -z $EDITOR ]] && EDITOR=vim
106+
107+	# if the file exists, just open it
108+	[[ -e $1 ]] && print "$1 exists; not modifying.\n" && $EDITOR $1
109+
110+	# if it doesn't, make it, and open it
111+	[[ ! -e $1 ]] && print '#!/usr/bin/perl'"\n"'use strict;'"\n"'use warnings;'\
112+		"\n\n" > $1 && $EDITOR $1
113+}
114+
115+
116+# pgs - Perl Global Substitution
117+# find pattern		= 1st arg
118+# replace pattern	= 2nd arg
119+# filename			= 3rd arg
120+pgs() { # [find] [replace] [filename]
121+    perl -i.orig -pe 's/'"$1"'/'"$2"'/g' "$3"
122+}
123+
124+
125+# Perl grep, because 'grep -P' is terrible. Lets you work with pipes or files.
126+prep() { # [pattern] [filename unless STDOUT]
127+    perl -nle 'print if /'"$1"'/;' $2
128+}
129+
130+# say - append a newline to 'print'
131+say() {
132+    print "$1\n"
133+}
134+