Warning: pg_connect() [function.pg-connect]: Unable to connect to PostgreSQL server: could not connect to server: No such file or directory Is the server running locally and accepting connections on Unix domain socket "/var/run/postgresql/.s.PGSQL.5432"? in /var/www/localhost/htdocs/index.php on line 7
proton

Полезности

Тут будут выкладываться всякие разные полезности моего авторства

Конфиги

Конфиг ZSH

Сам конфиг:
alias \$=''
alias ERR='2>>( sed -ue "s/.*/$fg_bold[red]&$reset_color/" 1>&2 )'
alias dud="du -hs * | grep '^[0-9,]*[MG]' | sort -rn"
alias lix='layman -S && eix-sync'
alias 'emerge -uNDav world'='emerge -uNDav --with-bdeps y world'
alias mv='nocorrect mv -i'
alias cp='nocorrect cp -i'
alias ls='ls --color=auto'
alias grep='grep --colour=auto'
alias g='grep --colour=auto'
alias c='cat'
alias ss='sudo -s'
alias ssh='ssh -C'
alias ыг='su'
alias ыы='sudo -s'
alias q='exit'
alias й='exit'
alias ушч='eix'
alias svndiff='svn diff | colordiff'
alias diff=colordiff
alias ~~='ACCEPT_KEYWORDS="**"'
alias d0='DISPLAY=:0'
alias d1='DISPLAY=:1'
alias d2='DISPLAY=:2'

autoload -U compinit promptinit
compinit
promptinit; prompt gentoo

PROMPT2='%i%U> '
RPROMPT=$'%{\e[1;32m%}(%{\e[1;30m%}%T%{\e[1;32m%})%{\e[0m%}'

HISTFILE=~/.zhistory
HISTSIZE=5000
SAVEHIST=5000
DIRSTACKSIZE=20

setopt  APPEND_HISTORY
setopt  HIST_IGNORE_ALL_DUPS
setopt  HIST_IGNORE_SPACE
setopt  HIST_REDUCE_BLANKS

setopt correctall

setopt autocd # cd можно больше не набирать)

setopt  IGNORE_EOF

if [[ -f /etc/DIR_COLORS ]] ; then
        eval $(dircolors -b /etc/DIR_COLORS)
fi

zstyle ':completion:*:default' list-colors '${LS_COLORS}'

zstyle ':completion:*:descriptions' format '%U%B%d%b%u'
zstyle ':completion:*:warnings' format '%BСорь, нет совпадений: %d%b =('

zstyle ':completion:*:processes' command 'ps -xuf'

zstyle ':completion:*' matcher-list 'm:{a-z}={A-Z}'

precmd()
{
        [[ -t 1 ]] || return
        case $TERM in
                *xterm*|*rxvt*|rxvt-unicode|urxvt|(dt|k|E)term*) print -Pn "\e]2;%n@%m\a";;
        esac
}
preexec() {
        [[ -t 1 ]] || return
        case $TERM in
                *xterm*|*rxvt*|rxvt-unicode|urxvt|(dt|k|E)term*) print -Pn "\e]2;$1\a";;
        esac
}

case $TERM in
        linux)
bindkey "^[[2~" yank
bindkey "^[[3~" delete-char
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
bindkey "^[[1~" beginning-of-line
bindkey "^[[4~" end-of-line
bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command
bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
bindkey " " magic-space ## do history expansion on space
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
;;
*xterm*|rxvt|rxvt-unicode|urxvt|(dt|k|E)term)
bindkey "^[[2~" yank
bindkey "^[[3~" delete-char
bindkey "^[[5~" up-line-or-history
bindkey "^[[6~" down-line-or-history
bindkey "^[[7~" beginning-of-line
bindkey "^[[8~" end-of-line
bindkey "^[e" expand-cmd-path ## C-e for expanding path of typed command
bindkey "^[[A" up-line-or-search ## up arrow for back-history-search
bindkey "^[[B" down-line-or-search ## down arrow for fwd-history-search
bindkey " " magic-space ## do history expansion on space
bindkey "\eOH" beginning-of-line
bindkey "\eOF" end-of-line
;;
esac

#export WORDCHARS=''
#tcsh-backward-word() {
#  local WORDCHARS="${WORDCHARS:s@/@}"
#  zle backward-word
#}
#zle -N tcsh-backward-word

export WORDCHARS='*?_[]~=&;!#$%^(){}'

bindkey '^[[5D' emacs-backward-word
bindkey '^[[5C' emacs-forward-word

bindkey ';5D' emacs-backward-word
bindkey ';5C' emacs-forward-word

unarch()
{
  local file decomp
  for file in $@
  do
    unset decomp
    [[ ( $file:e == gz && $file:r:e == tar ) || $file:e == tgz ]] \
      && decomp=gunzip
    [[ $file:e == bz2 && $file:r:e == tar ]] \
      && decomp=bunzip2
    [[ $file:e == lzma && $file:r:e == tar ]] \
      && decomp=unlzma
    if [[ -z $decomp ]] then
      echo "Usage: $0 [ \033[4mtgz-file\033[m | \033[4mbz2-file\033[m ] | \033[4mlzma-file\033[m ] ..." >&2
      return 1
    fi
    if [[ -r $file ]] then
      echo "$0 $file ..."
      $decomp $file -c | tar xf -
    else
      echo "$0: $file is not readable" >&2
    fi
  done
}

Конфиг screen

Сам конфиг:
#caption always "%{wr}screen a:%H%25=[%-w%{rw}%n %t%{wr}%+w]%=%l"
#hardstatus alwayslastline "%{=b}%{bw} %{.c}%Y-%m-%d %{.y}%0c %{ck} %-Lw% {gy}%n%f* %t [%h]%? (%u)%? %{-}%+Lw %{bw} %=%{ g}%H%{bw} "
#hardstatus alwayslastline "%{= dR} %-Lw%50>%{= dG}%n%f* %{= dW}%t%{= dR}%+Lw%<"

#hardstatus string "%t %h"
hardstatus string "%h"
caption always '%{gk}[ %{G}%H %{g}][%{= kw}%-w%{= BW}%n %t%{-}%+w %=][%{Y}%l%{g}]%{=b C}[ %d.%m.%Y ]'
#screen 1
#screen 2
#screen 3

termcapinfo xterm 'hs:ts=\E]2;:fs=\007:ds=\E]2;screen\007'

Мой make.conf

Сам конфиг:
CHOST="i686-pc-linux-gnu"
CFLAGS="-march=k8 -msse3 -O2 -pipe -fomit-frame-pointer"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j2"
FEATURES="parallel-fetch metadata-transfer"

LINGUAS="ru"
ALSA_CARDS="hda-intel"
INPUT_DEVICES="evdev keyboard mouse synaptics"
VIDEO_CARDS="radeon fglrx fbdev vesa"

USE="	3dnow 3dnowext custom-optimization dri mmx mmxext sse sse2 sse3 threads
	acpi -bluetooth dbus dell fam -gpm hal -ipv6 laptop -networkmanager xinerama wifi
	-avahi curl gtkspell -kerberos -ldap nfs nls samba spell unicode vnc -zeroconf -doc
	cups foomaticdb ppds
	thumbnail shellma
	astyle c++ cvs gcj git mercury perl php -python subversion
	7zip ace bzip2 gzip p7zip rar unrar zip
	ext ext2 ext3 fat ntfs ntfs-3g reiserfs sysfs
	X -eds libnotify minimal -nautilus nsplugin trayicon winpopup xcomposite xcb zsh-completion
	mysql sqlite sqlite3
	glib -gnome gtk -kde openal opengl -plasma -qt3 qt3support qt4 -qt-static xfce xulrunner
	cdrw dvd dvdr dvdread libburn
	alsa -esd -gstreamer -oss -pulseaudio -xine
	aac audiofile flac id3 id3tag mad mikmod mp3 taglib vorbis
	v4l v4l2 encode ffmpeg matroska ogg wmp srt
	a52 quicktime theora win32codecs x264 xvid
	djvu exif gif jpeg jpeg2k pdf png svg tiff
	crypt dhclient dhcp dhcpcd nss resolvconf"

ACCEPT_KEYWORDS="~x86"

#PORTAGE_TMPDIR="/home/tmp"

PORTDIR_OVERLAY="/usr/local/portage"
PKGDIR="/usr/portage/distfiles/bin"
#PORTAGE_BINHOST="ftp://ftp.sofagang.dk/portage-packages/i686-athlon64-desktop/All"
PORTAGE_BINHOST="http://mirrors.haslfree.com/portage-packages/i686-athlon64-desktop/All"

#PORT_LOGDIR=/var/lib/portage/logs
PORTAGE_ELOG_CLASSES="warn info log"
PORTAGE_ELOG_SYSTEM="save"

source /usr/local/portage/layman/make.conf

#ftp://ftp.corbina.ru/pub/Linux/gentoo
GENTOO_MIRRORS="
http://mirror.yandex.ru/gentoo-distfiles
http://ftp.belnet.be/mirror/rsync.gentoo.org/gentoo
http://distfiles.gentoo.org
http://www.ibiblio.org/pub/Linux/distributions/gentoo"

#SYNC="rsync://mirror.corbina.net/gentoo-portage"
SYNC="rsync://mirror.yandex.ru/gentoo-portage"

Скриптики

Заливка текста/кода на nopaste.org

Использование:
cat some.txt | paster.sh
либо
paster.sh some.txt
Код:
#!/bin/sh
if [[ $1 = "" ]]
then curl -F file=@- nopaste.com/a
else curl -F file=@"$1" nopaste.com/a
fi

Заливка картинок на imageshack.us и вывод окошка со ссылкой (требуется gxmessage)

Использование:
uploadpic.sh some.jpg
Код:
#!/bin/sh
TMPFILE=`mktemp /tmp/image.XXXXXX`

curl -H Expect: -F fileupload=@"$1" -F xml=yes http://www.imageshack.us/index.php >$TMPFILE
URL=$(cat $TMPFILE | grep -E "(.*)" | sed 's|\(.*\)|\1|'|cut -c5-)

if [[ $URL = "" ]]
then gxmessage -name "Не загружено!" "Видимо не судьба =("
else gxmessage -name "Загружено!" "$URL"
fi

rm $TMPFILE

Перекодировка файла из CP1251 в Utf-8

Использование:
recWin2Utf.sh some.txt
Код:
#!/bin/sh
iconv -f cp1251 -t utf8 "$1" > /tmp/reccpurf;
mv /tmp/reccpurf "$1";

Ебилды

Плагин скайпа для пиджина (x11-plugins/skype4pidgin)

Для работы все равно потребуется скайп, но управляться он будет через pidgin =)

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

inherit subversion

DESCRIPTION="It lets you view and chat with all your Skype buddies from within Pidgin"
HOMEPAGE="http://code.google.com/p/skype4pidgin/"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="~x86"

LANGS="de es fr hu it ja nb pl pt ru"
for X in ${LANGS}; do IUSE_LINGUAS="${IUSE_LINGUAS} linguas_${X}"; done
IUSE="${IUSE_LINGUAS}"

ESVN_REPO_URI="http://skype4pidgin.googlecode.com/svn/trunk"

RDEPEND="net-im/pidgin
	net-im/skype"

DEPEND="${RDEPEND}"

src_compile() {
	emake all || die "all"
}

src_install() {
	emake DESTDIR="${D}" install || die
	for lng in ${LANGS}; do
		if use linguas_${lng}; then
			einfo "Installing localisation for ${lng}"
			insinto /usr/share/locale/${lng}/LC_MESSAGES/
			newins po/${lng}.mo skype4pidgin.mo || die "newins failed"
		fi
	done
}

pkg_postinst() {
	einfo "To use Skype'smiles, choose [Tools] -> [Preferences], open the"
	einfo "[Smiley Themes] tab and choose [Default-with-Skype] in theme's list"
}

Твиттер клиент Mitter (net-misc/mitter)

# Copyright 1999-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="1"

inherit distutils eutils

DESCRIPTION="A maemo/GTK+ client for twitter"
HOMEPAGE="http://code.google.com/p/mitter/"
SRC_URI="http://mitter.googlecode.com/files/${P}.tar.gz"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~x86"
IUSE="+gtk tty cmd"

RDEPEND="gtk? ( dev-python/pygtk )
	dev-python/simplejson"

DEPEND="${RDEPEND}
	dev-python/setuptools"

preinst() {
	use gtk || rm "${WORKDIR}/${P}/mitterlib/ui/ui_pygtk.py"
	use tty || rm "${WORKDIR}/${P}/mitterlib/ui/ui_tty.py"
	use cmd || rm "${WORKDIR}/${P}/mitterlib/ui/ui_cmd.py"
	(! use gtk) && (! use tty) && (! use cmd) && die "You should select something interface"
}

src_install() {
	distutils_src_install
	use gtk && (make_desktop_entry "mitter" "Mitter" "mitter.png" "Application;Network" || die "make_desktop_entry failed")
}

Разное

Тема иконок Tango! для audacity