changeset 400:657f787fbae8

Merge remote-tracking branch 'origin/master'
author Edho Arief <edho@myconan.net>
date Tue, 04 Sep 2012 10:23:37 +0700
parents c01d272af466 (current diff) 0051e1fccb40 (diff)
children 06e1821eacf5
files rc/bashrc
diffstat 9 files changed, 579 insertions(+), 277 deletions(-) [+]
line wrap: on
line diff
--- a/bin/moefetch	Tue Sep 04 10:22:46 2012 +0700
+++ b/bin/moefetch	Tue Sep 04 10:23:37 2012 +0700
@@ -42,7 +42,7 @@
 
 # useless welcome message. Also version
 msg_welcome() {
-	echo "moefetch ${_version}
+  echo "moefetch ${_version}
 Copyright (c) 2009-2012 edogawaconan <edho@myconan.net>
 "
 }
@@ -50,14 +50,14 @@
 # Sanitize path. Totally safe. Usage: cmd "$(safe_path "${filename}")"
 safe_path()
 {
-	# It all depends on the first character.
-	start=$(printf "%s" "$*" | cut -c 1)
-	path=
-	case "${start}" in
-		.|/) path="$*";; # . and / is safe. No change.
-		*) path="./$*";; # Anything else must be prefixed with ./
-	esac
-	printf "%s" "${path}" # Return.
+  # It all depends on the first character.
+  start=$(printf "%s" "$*" | cut -c 1)
+  path=
+  case "${start}" in
+    .|/) path="$*";; # . and / is safe. No change.
+    *) path="./$*";; # Anything else must be prefixed with ./
+  esac
+  printf "%s" "${path}" # Return.
 }
 
 # Checks md5. OpenSSL should be available on anything usable.
@@ -78,56 +78,57 @@
 
 # fatal error handler
 Err_Fatal() {
-	echo "
+  echo "
 Fatal error: ${1}"
-	exit 1
+  exit 1
 }
 
 Err_Impossible() {
-	echo "
+  echo "
 Impossible error. Or you modified content of the working directories when the script is running.
 Please report to moefetch.googlecode.com if you see this message (complete with entire run log)"
-	exit 1
+  exit 1
 }
 
 # help message
 Err_Help() {
-	echo "moefetch.sh COMMAND [-n] [-p PASSWORD] [-s SITE_URL] [-u USERNAME] TAGS
+  echo "moefetch.sh COMMAND [-n] [-p PASSWORD] [-s SITE_URL] [-u USERNAME] TAGS
 
 COMMAND: 
-	(quick)fetch:
-		Do a complete update. Add prefix quick to skip file checking
-	check:
-		Get list of new files, clean up local folder and print total new files
+  (quick)fetch:
+    Do a complete update. Add prefix quick to skip file checking
+  check:
+    Get list of new files, clean up local folder and print total new files
 
 OPTIONS:
-	-n:
-		Skip checking repository directory.
-	-p PASSWORD:
-		Specifies password for login.
-	-s SITE_URL: 
-		Specify URL of the Danbooru powered site you want to leech from. Default is ${DEFAULT_SITE}.
-	-u USERNAME:
-		Specifies username for login.
-	TAGS: 
-		Tags you want to download. Separated by spaces. Tag name follows standard Danbooru tagging scheme."
-	exit 2
+  -n:
+    Skip checking repository directory.
+  -p PASSWORD:
+    Specifies password for login.
+  -s SITE_URL: 
+    Specify URL of the Danbooru powered site you want to leech from. Default is ${DEFAULT_SITE}.
+  -u USERNAME:
+    Specifies username for login.
+  TAGS: 
+    Tags you want to download. Separated by spaces. Tag name follows standard Danbooru tagging scheme."
+  exit 2
 }
 
 # generate link by transforming xml
 Generate_Link() {
-	echo "
+  echo "
 Fetching XML file"
-	tempnum=1000
-	iternum=1
-	> "${TEMP_PREFIX}-list"
-	while [ "${tempnum}" -ge 1000 ]; do
-		url="${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=1000&page=${iternum}"
-		[ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}"
-		wget --no-check-certificate --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file"
-		printf "Processing XML file... "
-		# xslt evilry
-		xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(https*.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist"
+  pagelimit=100
+  tempnum="${pagelimit}"
+  iternum=1
+  > "${TEMP_PREFIX}-list"
+  while [ "${tempnum}" -ge "${pagelimit}" ]; do
+    url="${SITE}/post/index.xml?tags=$(get_cleantags "${TAGS}")&offset=0&limit=${pagelimit}&page=${iternum}"
+    [ ${_use_login} -eq 1 ] && url="${url}&login=${LOGIN_USER}&password_hash=${LOGIN_PASS}"
+    wget --no-check-certificate --quiet "${url}" -O "${TEMP_PREFIX}-xml" --referer="${SITE}/post" --user-agent="${useragent}" -e continue=off || Err_Fatal "Failed download catalog file"
+    printf "Processing XML file... "
+    # xslt evilry
+    xsltproc - "${TEMP_PREFIX}-xml" <<EOF | sed 's/.*\(https*.*\)\(\/[a-f0-9]\{32\}\).*\.\([^\.]*\)/\1\2.\3/g' | grep ^http > "${TEMP_PREFIX}-templist"
 <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
 <xsl:output method="xml" indent="yes"/>
 <xsl:template match="post">
@@ -135,292 +136,292 @@
 </xsl:template>
 </xsl:stylesheet>
 EOF
-		tempnum=$(grep -c . "${TEMP_PREFIX}-templist")
-		iternum=$((iternum + 1))
-		cat "${TEMP_PREFIX}-templist" >> "${TEMP_PREFIX}-list"
-		echo "${tempnum} file(s) available"
-	done
-	numfiles=$(grep -c . "${TEMP_PREFIX}-list")
-	echo "${numfiles} file(s) available on server"
-	[ "${numfiles}" -gt 0 ] || Err_Fatal "Error in processing list or no files can be found with specified tag(s) or site."
+    tempnum=$(grep -c . "${TEMP_PREFIX}-templist")
+    iternum=$((iternum + 1))
+    cat "${TEMP_PREFIX}-templist" >> "${TEMP_PREFIX}-list"
+    echo "${tempnum} file(s) available"
+  done
+  numfiles=$(grep -c . "${TEMP_PREFIX}-list")
+  echo "${numfiles} file(s) available on server"
+  [ "${numfiles}" -gt 0 ] || Err_Fatal "Error in processing list or no files can be found with specified tag(s) or site."
 }
 
 
 progress_init() {
-	_last="-"
-	printf "${_last}"
+  _last="-"
+  printf "${_last}"
 }
 
 progress_anim() {
-	case "${_last}" in
-		/) _last="-";;
-		-) _last=\\;;
-		\\) _last=\|;;
-		\|) _last="/";;
-	esac
-	printf "\b${_last}"
+  case "${_last}" in
+    /) _last="-";;
+    -) _last=\\;;
+    \\) _last=\|;;
+    \|) _last="/";;
+  esac
+  printf "\b${_last}"
 }
 
 progress_done() { printf "\bdone\n"; }
 
 # getting rid of ls (as per suggestion)
 Count_Files() {
-	numfiles=0
-	for dircontent in "${*}/"* "${*}/".*; do 
-		if [ -e "${dircontent}" ] && [ x"${dircontent}" != x"${*}/." ] && [ x"${dircontent}" != x"${*}/.." ]; then 
-			numfiles=$((numfiles + 1))
-		fi
-	done
-	echo $((numfiles))
+  numfiles=0
+  for dircontent in "${*}/"* "${*}/".*; do 
+    if [ -e "${dircontent}" ] && [ x"${dircontent}" != x"${*}/." ] && [ x"${dircontent}" != x"${*}/.." ]; then 
+      numfiles=$((numfiles + 1))
+    fi
+  done
+  echo $((numfiles))
 }
 
 # check tools availability
 Check_Tools() {
-	# verify all programs required do indeed exist
-	commands="cut sed wc wget xsltproc xargs rm mkdir chown comm grep date openssl"
-	for cmd in ${commands}
-	do
-		 [ "$(command -v "${cmd}")" ] || Err_Fatal "${cmd} doesn't exist in ${PATH}"
-	done
+  # verify all programs required do indeed exist
+  commands="cut sed wc wget xsltproc xargs rm mkdir chown comm grep date openssl"
+  for cmd in ${commands}
+  do
+     [ "$(command -v "${cmd}")" ] || Err_Fatal "${cmd} doesn't exist in ${PATH}"
+  done
 }
 
 # verify required folders exist and writeable
 Check_Folders(){
-	[ -O "${BASE_DIR}" ] || Err_Fatal "You don't own ${BASE_DIR}. Please fix ${BASE_DIR} or run this script in your own directory."
-	for directory in temp trash deleted "${SITE_DIR}/${TARGET_DIR}"; do
-		if [ ! -d "${BASE_DIR}/${directory}" ]; then
-			mkdir -p "${BASE_DIR}/${directory}" || Err_Impossible
-		fi
-		if [ ! -O "${BASE_DIR}/${directory}" ]; then
-			echo "You don't own the ${BASE_DIR}/${directory}, applying globally writeable permission on it"
-			chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${directory}" || Err_Impossible
-		fi
-	done
-	[ "$(Count_Files "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}")" -eq 0 ] && ISNEW=1
-	for i in error ok list newlist templist; do
-		touch "${TEMP_PREFIX}-${i}" || Fatal_Err "Error creating ${TEMP_PREFIX}-${i}. This shouldn't happen"
-	done
-	#
+  [ -O "${BASE_DIR}" ] || Err_Fatal "You don't own ${BASE_DIR}. Please fix ${BASE_DIR} or run this script in your own directory."
+  for directory in temp trash deleted "${SITE_DIR}/${TARGET_DIR}"; do
+    if [ ! -d "${BASE_DIR}/${directory}" ]; then
+      mkdir -p "${BASE_DIR}/${directory}" || Err_Impossible
+    fi
+    if [ ! -O "${BASE_DIR}/${directory}" ]; then
+      echo "You don't own the ${BASE_DIR}/${directory}, applying globally writeable permission on it"
+      chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${directory}" || Err_Impossible
+    fi
+  done
+  [ "$(Count_Files "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}")" -eq 0 ] && ISNEW=1
+  for i in error ok list newlist templist; do
+    touch "${TEMP_PREFIX}-${i}" || Fatal_Err "Error creating ${TEMP_PREFIX}-${i}. This shouldn't happen"
+  done
+  #
 }
 
 # Do some cleanup
 Cleanup_Repository() {
-	# current dir: ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}
-	printf "Cleaning up repository folder... "
-	progress_init
-	trash_dir="${BASE_DIR}/trash/${trash_dir}/$(date -u "+${SITE_DIR}-${TARGET_DIR}-%Y%m%d-%H.%M")"
-	trashes="These files have been moved to ${trash_dir}:"
-	has_trash=
-	if [ ! -d "${trash_dir}" ]; then
-		mkdir -p "${trash_dir}" || Err_Impossible
-	else
-		if [ ! -O "${trash_dir}" ]; then
-			chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${directory}" || Err_Impossible
-		fi
-	fi
-	for trash in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
-	do
-		if [ -e "${trash}" ]; then
-			is_trash=
-			if [ -d "${trash}" ] || [ -n "$(is_not_md5 "${trash}")" ] || [ -z "$(grep "$(get_basename "${trash}")" "${TEMP_PREFIX}-list")" ]; then
-				is_trash=1
-				has_trash=1
-				mv -f -- "${trash}" "${trash_dir}" || Err_Impossible
-				trashes="${trashes}
+  # current dir: ${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}
+  printf "Cleaning up repository folder... "
+  progress_init
+  trash_dir="${BASE_DIR}/trash/${trash_dir}/$(date -u "+${SITE_DIR}-${TARGET_DIR}-%Y%m%d-%H.%M")"
+  trashes="These files have been moved to ${trash_dir}:"
+  has_trash=
+  if [ ! -d "${trash_dir}" ]; then
+    mkdir -p "${trash_dir}" || Err_Impossible
+  else
+    if [ ! -O "${trash_dir}" ]; then
+      chmod -R u=rwX,g=rwX,o=rwX "${BASE_DIR}/${directory}" || Err_Impossible
+    fi
+  fi
+  for trash in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
+  do
+    if [ -e "${trash}" ]; then
+      is_trash=
+      if [ -d "${trash}" ] || [ -n "$(is_not_md5 "${trash}")" ] || [ -z "$(grep "$(get_basename "${trash}")" "${TEMP_PREFIX}-list")" ]; then
+        is_trash=1
+        has_trash=1
+        mv -f -- "${trash}" "${trash_dir}" || Err_Impossible
+        trashes="${trashes}
   $(get_basename "${trash}")"
-			fi
-		fi
-		progress_anim
-	done
-	rmdir "${trash_dir}" 2>/dev/null
-	progress_done
-	[ -n "${has_trash}" ] && echo "${trashes}"
+      fi
+    fi
+    progress_anim
+  done
+  rmdir "${trash_dir}" 2>/dev/null
+  progress_done
+  [ -n "${has_trash}" ] && echo "${trashes}"
 }
 
 # check files correctness
 Check_Files() {
-	if [ ! -n "${ISNEW}" ]; then
-		[ -z "${NOCLEAN}" ] && Cleanup_Repository
-		printf "Checking for errors... "
-		progress_init
-		files_error="These files do not match its md5:"
-		files_notdanbooru="These files are not checked:"
-		has_err_filename=
-		has_err_md5=
-		> "${TEMP_PREFIX}-error"
-		> "${TEMP_PREFIX}-ok"
-		for file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
-		do
-			if [ -e "${file}" ]; then
-				if [ -n "$(is_not_md5 "${file}")" ] || [ -d "${file}" ]; then
-					files_notdanbooru="${files_notdanbooru}
+  if [ ! -n "${ISNEW}" ]; then
+    [ -z "${NOCLEAN}" ] && Cleanup_Repository
+    printf "Checking for errors... "
+    progress_init
+    files_error="These files do not match its md5:"
+    files_notdanbooru="These files are not checked:"
+    has_err_filename=
+    has_err_md5=
+    > "${TEMP_PREFIX}-error"
+    > "${TEMP_PREFIX}-ok"
+    for file in "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}/"*
+    do
+      if [ -e "${file}" ]; then
+        if [ -n "$(is_not_md5 "${file}")" ] || [ -d "${file}" ]; then
+          files_notdanbooru="${files_notdanbooru}
   $(get_basename "${file}")"
-					has_err_filename=1
-				else
-					if [ "$(get_md5 "${file}")" = "$(get_filename "${file}")" ]; then
-						echo "$(get_basename "${file}")" >> "${TEMP_PREFIX}-ok"
-					else
-						rm "${file}" || Err_Fatal "Error removing ${file}"
-						echo "$(get_basename "${file}")" >> "${TEMP_PREFIX}-error"
-						files_error="${files_error}
+          has_err_filename=1
+        else
+          if [ "$(get_md5 "${file}")" = "$(get_filename "${file}")" ]; then
+            echo "$(get_basename "${file}")" >> "${TEMP_PREFIX}-ok"
+          else
+            rm "${file}" || Err_Fatal "Error removing ${file}"
+            echo "$(get_basename "${file}")" >> "${TEMP_PREFIX}-error"
+            files_error="${files_error}
   $(get_basename "${file}")"
-						has_err_md5=1
-					fi
-				fi
-			fi
-			progress_anim
-		done
-		progress_done
-		if [ ! -n "${has_err_md5}" ] && [ ! -n "${has_err_filename}" ]; then
-			echo "All files OK"
-		else
-			if [ -n "${has_err_md5}" ]; then
-				echo "${files_error}"
-				echo "$(grep -c . "${TEMP_PREFIX}-error") file(s) removed"
-			fi
-			[ -n "${has_err_filename}" ] && echo "${files_notdanbooru}" 
-		fi
-		echo "$(grep -c . "${TEMP_PREFIX}-ok") file(s) available locally"
+            has_err_md5=1
+          fi
+        fi
+      fi
+      progress_anim
+    done
+    progress_done
+    if [ ! -n "${has_err_md5}" ] && [ ! -n "${has_err_filename}" ]; then
+      echo "All files OK"
+    else
+      if [ -n "${has_err_md5}" ]; then
+        echo "${files_error}"
+        echo "$(grep -c . "${TEMP_PREFIX}-error") file(s) removed"
+      fi
+      [ -n "${has_err_filename}" ] && echo "${files_notdanbooru}" 
+    fi
+    echo "$(grep -c . "${TEMP_PREFIX}-ok") file(s) available locally"
 
-		printf "Generating list of new files... "
-		progress_init
-		cp -f "${TEMP_PREFIX}-list" "${TEMP_PREFIX}-templist"
-		while read -r is_ok; do
-			grep -v "${is_ok}" "${TEMP_PREFIX}-templist" > "${TEMP_PREFIX}-newlist"
-			cp -f "${TEMP_PREFIX}-newlist" "${TEMP_PREFIX}-templist" || Err_Impossible
-			progress_anim
-		done < "${TEMP_PREFIX}-ok"
-		progress_done
-		echo "$(grep -c . "${TEMP_PREFIX}-newlist") file(s) to be downloaded"		
-	else
-		if [ -n "${ISQUICK}" ]; then
-			echo "Quick mode selected. Skipping check"
-		else
-			echo "Empty local repository"
-		fi
-		cat "${TEMP_PREFIX}-list" > "${TEMP_PREFIX}-newlist"
-	fi
+    printf "Generating list of new files... "
+    progress_init
+    cp -f "${TEMP_PREFIX}-list" "${TEMP_PREFIX}-templist"
+    while read -r is_ok; do
+      grep -v "${is_ok}" "${TEMP_PREFIX}-templist" > "${TEMP_PREFIX}-newlist"
+      cp -f "${TEMP_PREFIX}-newlist" "${TEMP_PREFIX}-templist" || Err_Impossible
+      progress_anim
+    done < "${TEMP_PREFIX}-ok"
+    progress_done
+    echo "$(grep -c . "${TEMP_PREFIX}-newlist") file(s) to be downloaded"    
+  else
+    if [ -n "${ISQUICK}" ]; then
+      echo "Quick mode selected. Skipping check"
+    else
+      echo "Empty local repository"
+    fi
+    cat "${TEMP_PREFIX}-list" > "${TEMP_PREFIX}-newlist"
+  fi
 }
 
 # start downloading the images
 Fetch_Images() {
-	if [ "$(grep -c . "${TEMP_PREFIX}-newlist")" -eq 0 ]; then
-		echo "No new file"
-	else
-		printf "Downloading files... "
-		cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}"
-		wget --no-check-certificate -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="${SITE}/post" --user-agent="${useragent}"
-	fi
+  if [ "$(grep -c . "${TEMP_PREFIX}-newlist")" -eq 0 ]; then
+    echo "No new file"
+  else
+    printf "Downloading files... "
+    cd "${BASE_DIR}/${SITE_DIR}/${TARGET_DIR}"
+    wget --no-check-certificate -e continue=on -i "${TEMP_PREFIX}-newlist" -o "${TEMP_PREFIX}.log" --referer="${SITE}/post" --user-agent="${useragent}"
+  fi
 }
 
 # initialize base variables and initial command check
 init()
 {
-	# path initialization
-	# check if additional path is specified
-	if [ -n "${ADDITIONAL_PATH}" ]
-	then
-		# insert the additional path
-		PATH="${ADDITIONAL_PATH}:${PATH}"
-		export PATH
-	fi
-	
-	# misc variables
-	ISQUICK=
-	ISNEW=
-	
-	# minimum number of arguments: 2 (command and tag). If less than two, exit and print help message
-	[ $# -lt 2 ] && Err_Help
-	case "$1" in
-		check|fetch|quickfetch)
-			echo "Starting..."
-			JOB="$1"
-		;;
-		*)
-			Err_Help
-		;;
-	esac
-	shift
-	SITE=
-	TAGS=
-	has_pass=0
-	has_user=0
+  # path initialization
+  # check if additional path is specified
+  if [ -n "${ADDITIONAL_PATH}" ]
+  then
+    # insert the additional path
+    PATH="${ADDITIONAL_PATH}:${PATH}"
+    export PATH
+  fi
+  
+  # misc variables
+  ISQUICK=
+  ISNEW=
+  
+  # minimum number of arguments: 2 (command and tag). If less than two, exit and print help message
+  [ $# -lt 2 ] && Err_Help
+  case "$1" in
+    check|fetch|quickfetch)
+      echo "Starting..."
+      JOB="$1"
+    ;;
+    *)
+      Err_Help
+    ;;
+  esac
+  shift
+  SITE=
+  TAGS=
+  has_pass=0
+  has_user=0
   x=1
-	while getopts "s:nu:p:" opt
-	do
-		case "$opt" in
-			s) SITE="$OPTARG";;
-			n) NOCLEAN=1;;
-			p)
-				LOGIN_PASS=$(printf "%s" "$OPTARG" | openssl dgst -sha1 | sed -e 's/.*\([[:xdigit:]]\{40\}\).*/\1/')
-				has_pass=1
-			;;
-			u)
-				LOGIN_USER="$OPTARG"
-				has_user=1
-			;;
-		esac
+  while getopts "s:nu:p:" opt
+  do
+    case "$opt" in
+      s) SITE="$OPTARG";;
+      n) NOCLEAN=1;;
+      p)
+        LOGIN_PASS=$(printf "%s" "$OPTARG" | openssl dgst -sha1 | sed -e 's/.*\([[:xdigit:]]\{40\}\).*/\1/')
+        has_pass=1
+      ;;
+      u)
+        LOGIN_USER="$OPTARG"
+        has_user=1
+      ;;
+    esac
     x=$OPTIND
-	done
+  done
   shift $(($x-1))
   if [ "$1" = -- ]; then shift; fi
-	TAGS="$@"
-	[ -n "${SITE}" ] || SITE=${DEFAULT_SITE}
-	[ -n "${TAGS}" ] || Err_Fatal "No tag specified"
-	# Get base folder - default, current folder or fallback to ${HOME}
-	[ -n "${BASE_DIR}" ] || BASE_DIR=${PWD}
-	[ -n "${BASE_DIR}" ] || BASE_DIR=${HOME}
-	[ -n "$(echo "${BASE_DIR}" | cut -c1 | grep \/)" ] || BASE_DIR="/${BASE_DIR}"
-	# see if both pass and use are set. If they're set, switch _use_login variable content to 1.
-	[ ${has_pass} -eq 1 -a ${has_user} -eq 1 ] && _use_login=1
+  TAGS="$@"
+  [ -n "${SITE}" ] || SITE=${DEFAULT_SITE}
+  [ -n "${TAGS}" ] || Err_Fatal "No tag specified"
+  # Get base folder - default, current folder or fallback to ${HOME}
+  [ -n "${BASE_DIR}" ] || BASE_DIR=${PWD}
+  [ -n "${BASE_DIR}" ] || BASE_DIR=${HOME}
+  [ -n "$(echo "${BASE_DIR}" | cut -c1 | grep \/)" ] || BASE_DIR="/${BASE_DIR}"
+  # see if both pass and use are set. If they're set, switch _use_login variable content to 1.
+  [ ${has_pass} -eq 1 -a ${has_user} -eq 1 ] && _use_login=1
 
-	echo "Tags: ${TAGS}"
-	# slash is not wanted for folder name
-	TARGET_DIR=$(echo "${TAGS}" | sed -e 's/\//_/g')
-	SITE_DIR=$(echo "${SITE}" | sed -e 's/\/$//g;s/\//_/g')
-	TEMP_PREFIX="${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}"
+  echo "Tags: ${TAGS}"
+  # slash is not wanted for folder name
+  TARGET_DIR=$(echo "${TAGS}" | sed -e 's/\//_/g')
+  SITE_DIR=$(echo "${SITE}" | sed -e 's/\/$//g;s/\//_/g')
+  TEMP_PREFIX="${BASE_DIR}/temp/${SITE_DIR}-${TARGET_DIR}"
 }
 
 # global variables goes here
 init_globals()
 {
-	_version="1.0-rc3"	# version of this script
-	_use_login=0	# variable to check whether a login is used or not
+  _version="1.0-rc3"  # version of this script
+  _use_login=0  # variable to check whether a login is used or not
 }
 
 main()
 {
-	# removing GNU-ism as much as possible
-	POSIXLY_CORRECT=1
-	#initialize global variables
-	init_globals
-	#print welcome message
-	msg_welcome
-	# initialization
-	init "$@"
-	Check_Tools
-	Check_Folders
+  # removing GNU-ism as much as possible
+  POSIXLY_CORRECT=1
+  #initialize global variables
+  init_globals
+  #print welcome message
+  msg_welcome
+  # initialization
+  init "$@"
+  Check_Tools
+  Check_Folders
 
 
-	# let's do the job!
-	case "${JOB}" in
-		check)
-			Generate_Link
-			Check_Files
-		;;
-		fetch)
-			Generate_Link
-			Check_Files
-			Fetch_Images
-		;;
-		quickfetch)
-			ISNEW=1
-			ISQUICK=1
-			Generate_Link
-			Check_Files
-			Fetch_Images
-		;;
-	esac
+  # let's do the job!
+  case "${JOB}" in
+    check)
+      Generate_Link
+      Check_Files
+    ;;
+    fetch)
+      Generate_Link
+      Check_Files
+      Fetch_Images
+    ;;
+    quickfetch)
+      ISNEW=1
+      ISQUICK=1
+      Generate_Link
+      Check_Files
+      Fetch_Images
+    ;;
+  esac
 }
 
 # call the main routine!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/prename	Tue Sep 04 10:23:37 2012 +0700
@@ -0,0 +1,144 @@
+#!/usr/bin/perl -w
+#
+#  This script was developed by Robin Barker (Robin.Barker@npl.co.uk),
+#  from Larry Wall's original script eg/rename from the perl source.
+#
+#  This script is free software; you can redistribute it and/or modify it
+#  under the same terms as Perl itself.
+#
+# Larry(?)'s RCS header:
+#  RCSfile: rename,v   Revision: 4.1   Date: 92/08/07 17:20:30 
+#
+# $RCSfile: rename,v $$Revision: 1.5 $$Date: 1998/12/18 16:16:31 $
+#
+# $Log: rename,v $
+# Revision 1.5  1998/12/18 16:16:31  rmb1
+# moved to perl/source
+# changed man documentation to POD
+#
+# Revision 1.4  1997/02/27  17:19:26  rmb1
+# corrected usage string
+#
+# Revision 1.3  1997/02/27  16:39:07  rmb1
+# added -v
+#
+# Revision 1.2  1997/02/27  16:15:40  rmb1
+# *** empty log message ***
+#
+# Revision 1.1  1997/02/27  15:48:51  rmb1
+# Initial revision
+#
+
+use strict;
+
+use Getopt::Long;
+Getopt::Long::Configure('bundling');
+
+my ($verbose, $no_act, $force, $op);
+
+die "Usage: rename [-v] [-n] [-f] perlexpr [filenames]\n"
+    unless GetOptions(
+	'v|verbose' => \$verbose,
+	'n|no-act'  => \$no_act,
+	'f|force'   => \$force,
+    ) and $op = shift;
+
+$verbose++ if $no_act;
+
+if (!@ARGV) {
+    print "reading filenames from STDIN\n" if $verbose;
+    @ARGV = <STDIN>;
+    chop(@ARGV);
+}
+
+for (@ARGV) {
+    my $was = $_;
+    eval $op;
+    die $@ if $@;
+    next if $was eq $_; # ignore quietly
+    if (-e $_ and !$force)
+    {
+	warn  "$was not renamed: $_ already exists\n";
+    }
+    elsif ($no_act or rename $was, $_)
+    {
+	print "$was renamed as $_\n" if $verbose;
+    }
+    else
+    {
+	warn  "Can't rename $was $_: $!\n";
+    }
+}
+
+__END__
+
+=head1 NAME
+
+rename - renames multiple files
+
+=head1 SYNOPSIS
+
+B<rename> S<[ B<-v> ]> S<[ B<-n> ]> S<[ B<-f> ]> I<perlexpr> S<[ I<files> ]>
+
+=head1 DESCRIPTION
+
+C<rename>
+renames the filenames supplied according to the rule specified as the
+first argument.
+The I<perlexpr> 
+argument is a Perl expression which is expected to modify the C<$_>
+string in Perl for at least some of the filenames specified.
+If a given filename is not modified by the expression, it will not be
+renamed.
+If no filenames are given on the command line, filenames will be read
+via standard input.
+
+For example, to rename all files matching C<*.bak> to strip the extension,
+you might say
+
+	rename 's/\.bak$//' *.bak
+
+To translate uppercase names to lower, you'd use
+
+	rename 'y/A-Z/a-z/' *
+
+=head1 OPTIONS
+
+=over 8
+
+=item B<-v>, B<--verbose>
+
+Verbose: print names of files successfully renamed.
+
+=item B<-n>, B<--no-act>
+
+No Action: show what files would have been renamed.
+
+=item B<-f>, B<--force>
+
+Force: overwrite existing files.
+
+=back
+
+=head1 ENVIRONMENT
+
+No environment variables are used.
+
+=head1 AUTHOR
+
+Larry Wall
+
+=head1 SEE ALSO
+
+mv(1), perl(1)
+
+=head1 DIAGNOSTICS
+
+If you give an invalid Perl expression you'll get a syntax error.
+
+=head1 BUGS
+
+The original C<rename> did not check for the existence of target filenames,
+so had to be used with care.  I hope I've fixed that (Robin Barker).
+
+=cut
--- a/bin/ren	Tue Sep 04 10:22:46 2012 +0700
+++ b/bin/ren	Tue Sep 04 10:23:37 2012 +0700
@@ -28,6 +28,9 @@
   $newname =~ s/(Ending) (\(Clean\)) - 0(\d+)/$1 $3 $2/;
   $newname =~ s/(Opening) (\(Clean\))0(\d+)/$1 $3 $2/;
   $newname =~ s/ A\+Channel / A Channel - Special /;
+  $newname =~ s/ Arcana✴Famiglia / Arcana Famiglia /i;
+  $newname =~ s/ Yuru Yuri♪♪ / Yuru Yuri S2 /i;
+  $newname =~ s/ Dog Days' / Dog Days S2 /i;
   $newname =~ s/\[commie\]/[Commie]/i;
   $newname =~ s/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! - (\d+) \[Uncut\]/Onii-chan no Koto Nanka Zenzen Suki Janain Dakara ne!! - $1 /;
   $newname =~ s/^(Ayashi no Ceres|Chikyuu Shoujo Arjuna|Futari wa Precure  Splash Star) - (\d+)\[\d+\] - .*(\[DVD\])(\[[^]]+\])(\[[a-f0-9]{8}\]\.[^.]+)$/$4 $1 - $2 $3$5/i;
@@ -66,6 +69,7 @@
   $newname =~ s/\] Saint Seiya The Lost Canvas - /] Saint Seiya - The Lost Canvas - /;
   $newname =~ s/\] Love GetChu - /] Love Get Chu - /i;
   $newname =~ s/\] Kamen Rider Blade /] Kamen Rider Blade /i;
+  $newname =~ s/\] Lovedol ~ Lovely Idol - /] Lovedol ~Lovely Idol~ - /i;
   $newname =~ s/\] Mobile Suit Gundam AGE - /] Gundam AGE - /i;
   $newname =~ s/\] Kore wa Zombie Desu ka? of the Dead - /] Kore wa Zombie desu ka - of the Dead - /i;
   $newname =~ s/\] Kore wa Zombie Desu ka- of the Dead - /] Kore wa Zombie desu ka - of the Dead - /i;
@@ -214,6 +218,7 @@
   $newname =~ s/^\[HorribleSubs\] Lilpri /[HorribleSubs] Hime Chen! Otogi Chikku Idol Lilpri - /i;
   $newname =~ s/^\[Jumonji-Giri\] \[AnY\]/[Jumonji-Giri]/;
   $newname =~ s/\[(BWS|PM)\]Pocket Monsters Best Wishes (\d+) .+\[H264 /[$1] Pokemon Best Wishes - $2 [/;
+  $newname =~ s/\[(BWS|PM)\] *Pocket Monsters Best Wishes Season (- )?2 (\d+) .+\ \[/[$1] Pokemon Best Wishes 2 - $3 [/;
   $newname =~ s/ Ookiku Furikabutte - The Summer Tournament Chapter / Ookiku Furikabutte S2 /;
   $newname =~ s/Les Miserables Shoujo Cosette /Les Miserables /;
   $newname =~ s/\[Elysium\]Baka\.to\.Test\.to\.Shoukanjuu\.(EP)?/[Elysium] Baka to Test to Shokanju/;
@@ -314,15 +319,15 @@
   #nothing
   $newname =~ s/(\(|\[) *(divx5\.2|H264 704x400|640x480 DivX511 120fps mp3|640x480 DivX511 mp3|h\.264-Hi10P|720x480|10-?bit|10bit 480p H264|640x360|640x360 H264 AAC|h264\.aac|hi10p|10bit|\d+th Release|x264\.aac|xvid|divx5\.2\.1|divx5\.1|divx5\.05|divx5\.1\.1|h\.?264 AC3|848x480|H264 848x480|h264-480p AAC|h\.264-480p) *(\)|\])//i;
   #dvd
-  $newname =~ s/(\(|\[) *(DVD\]\[1024x576 -|DVD H264 Hi10P 640x480|DVD Hi10P 640x480|DVD-480p-AAC|DVD x264 10-bit AC3|DVD 10bit) *(\)|\])/[DVD]/i;
+  $newname =~ s/(\(|\[) *(DVDRip 640x480|DVDRip h264 640x480 AAC|DVD, 480p|DVD\]\[1024x576 -|DVD H264 Hi10P 640x480|DVD Hi10P 640x480|DVD-480p-AAC|DVD x264 10-bit AC3|DVD 10bit) *(\)|\])/[DVD]/i;
   #dvd again
   $newname =~ s/(\(|\[) *(R2 DVD\.H264\.AC3|DVD H264 720x480|DVD 720x480 x264 FLAC|R1DVD 720x480 x264 AC-3|DVD 712x480 AC-3|DVD 720x480 AC-3|R\d DVD\.H264\.AC3|DVD 1024x576 x264 FLAC|DVD H264 640x480|DVD H264 720x480 AAC|DVD 704x480 H264 AC3|DVD 704x480|DVDRip\.Xvid\.864x480\.Vorbis|DVD H264 848x480|DVD 720x480|DVD H264 720x480|DVD, wmv, mp3) *(\)|\])/[DVD]/i;
   #1080p BD
   $newname =~ s/(\(|\[) *(BD\]\[10bit-1080p-AAC|BDRip 1080p x264 FLAC|BD Hi10P 1920x1080|BD Hi10P 1920x1080 H264 FLAC|BD 1920x1080 x264 Hi10P FLAC|BD 1920x1080 Hi10P|1920x1080 BD AAC|BD\]\[h264-1080p FLAC|BD-h264-10bit-1080p|BD\]\[1080p-FLAC|BD 1080|1920x1080 Hi10p h264 AAC|BD 1920x1080 x264 AAC|BD 1080p Hi10P|BDRip 1080p x264 FLAC|BD-1080p-|BD-1080p-FLAC|1920x1038 Blu-Ray FLAC|1920x1080 Blu-Ray FLAC|1920x1080 h264 BD FLAC|1920x1080 BD|BD\.1080p\.FLAC|BD 1080p H\.264 AAC 5\.1|BD 1080p) *(\)|\])/[1080p BD]/i;
   #720p
-  $newname =~ s/(\(|\[) *(1280x720 x264-Hi10P AAC|AT-X Hi10P 1280x720 H264|AT-X Hi10P 1280x720|1280x720 Hi10p|AT-X Hi10P 1280x720|1280x720 Hi10p AAC|AT-X 1280x720 H264|Hi10P 1280x720 H264|Hi10P 1280x720|1280x720 Hi10P|1280x720 5\.1|1280x720 x264 AAC|1280x720 H264 AAC|720p H264 AAC|1280x720|1280x720 H\.?264 AAC) *(\)|\])/[720p]/i;
+  $newname =~ s/(\(|\[) *(BD 1280x720|1280x720 8bit|1280x720 x264-Hi10P AAC|AT-X Hi10P 1280x720 H264|AT-X Hi10P 1280x720|1280x720 Hi10p|AT-X Hi10P 1280x720|1280x720 Hi10p AAC|AT-X 1280x720 H264|Hi10P 1280x720 H264|Hi10P 1280x720|1280x720 Hi10P|1280x720 5\.1|1280x720 x264 AAC|1280x720 H264 AAC|720p H264 AAC|1280x720|1280x720 H\.?264 AAC) *(\)|\])/[720p]/i;
   #720p BD
-  $newname =~ s/(\(|\[) *(BD\]\[720p-|BD, 720p, 10bit, AAC|BDRip 720p x264 FLAC|BDRip 720p|BD 720p DA|Blu-Ray 960x720 Dual Audio FLAC|BD, 720p|BD\]\[h264-720p\]\[FLAC|BD Hi10P 1280x720|BD, 720p, 10bit,|BD, 720, 10bit, AAC|BDrip 720p Vorbis|BD 720p Hi10P AAC|BD, 720p,|BD 720p H264-AAC|BDRip 720p|BD, 720p, ,|1280x720 BD|BD 1280x720 H264 AAC|BD 720p|BD 720p FLAC|BD 1280x720 H264 AAC) *(\)|\])/[720p BD]/i;
+  $newname =~ s/(\(|\[) *(BD 10-bit 1280x720 x264 AAC|BD\]\[720p-|BD, 720p, 10bit, AAC|BDRip 720p x264 FLAC|BDRip 720p|BD 720p DA|Blu-Ray 960x720 Dual Audio FLAC|BD, 720p|BD\]\[h264-720p\]\[FLAC|BD Hi10P 1280x720|BD, 720p, 10bit,|BD, 720, 10bit, AAC|BDrip 720p Vorbis|BD 720p Hi10P AAC|BD, 720p,|BD 720p H264-AAC|BDRip 720p|BD, 720p, ,|1280x720 BD|BD 1280x720 H264 AAC|BD 720p|BD 720p FLAC|BD 1280x720 H264 AAC) *(\)|\])/[720p BD]/i;
   #BD
   $newname =~ s/(\(|\[) *(Blu-Ray|BD 540p) *(\)|\])/[BD]/i;
   #576p
@@ -476,7 +481,7 @@
   $newname =~ s/ Persona - 3 Picture Drama - She Goes For A Walk / Persona 3 Picture Drama - She Goes For A Walk - /;
   $newname =~ s/ SP0/ - Special /;
   $newname =~ s/ SP(\d+) / - Special $1 /;
-  $newname =~ s/ Special - / - Special /;
+  $newname =~ s/ (Menu|Special) - / - $1 /;
   $newname =~ s/ Animated Commentary - / - Animated Commentary /;
   $newname =~ s/ Fullmetal Alchemist Brotherhood (- |)Skit - / Fullmetal Alchemist Brotherhood - Skit /i;
   $newname =~ s/ - Picture Drama - / - Picture Drama /;
--- a/rc/bashrc	Tue Sep 04 10:22:46 2012 +0700
+++ b/rc/bashrc	Tue Sep 04 10:23:37 2012 +0700
@@ -14,8 +14,33 @@
 [ -f "${HOME}/.ecos_bash.before" ] && . "${HOME}/.ecos_bash.before"
 
 _org_path="${PATH}"
+
+# Basic PATH
 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
+# pkgsrc
+if test -d /usr/pkg; then
+  PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
+  if test -d /usr/pkg/java/openjdk7; then
+    # OpenJDK 7 in pkgsrc
+    PATH="${PATH}:/usr/pkg/java/openjdk7/bin"
+  fi
+fi
+# OpenBSD X11
+test -d /usr/X11R6/bin && PATH="${PATH}:/usr/X11R6/bin"
+# PostgreSQL Yum
+test -d /usr/pgsql-8.4 && PATH="/usr/pgsql-8.4/bin:${PATH}"
+test -d /usr/pgsql-9.1 && PATH="/usr/pgsql-9.1/bin:${PATH}"
+
+# Nuke currently defined functions
+unset -f $(set | grep ' \(\)$' | cut -d ' ' -f 1)
+
+# Nuke bash-completion
+complete -r
+
+# Nuke aliases
+unalias -a
+
 shopt -s histappend
 PROMPT_COMMAND="history -a; history -n"
 export HISTFILESIZE=10000
@@ -34,7 +59,6 @@
 export BLOCK_SIZE=si
 
 alias ls="ls -F"
-alias rm="rm -i"
 alias rd="rdesktop -g 1280x600 -K -a 15 -x m -z -P -r sound:off -r clipboard:CLIPBOARD -5"
 alias man="LANG=C man"
 
@@ -95,7 +119,6 @@
     alias top="top -P"
   ;;
   OpenBSD)
-    PATH="${PATH}:/usr/X11R6/bin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
@@ -104,13 +127,13 @@
     fi
   ;;
   NetBSD|DragonFly)
-    PATH="${PATH}:/usr/pkg/bin:/usr/pkg/sbin"
     if command -v gls > /dev/null 2>&1; then
       _has_gnu_ls=y
       _ls="gls"
     elif command -v colorls > /dev/null 2>&1; then
       alias ls="colorls -F"
     fi
+    alias grep='grep --color=auto'
   ;;
   CYGWIN*)
     export PATH="${PATH}:${_org_path}"
@@ -195,6 +218,19 @@
   export LESS='-MRXgij15$nsz-2'
 fi
 
-rm -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null && alias rm="rm -I"
+# Test if we have GNU rm prefixed by g (esp if on non-GNU system).
+# Usually on old Solaris and {Net,Open,DragonFly}BSD.
+if command -v grm > /dev/null 2>&1; then
+  _rm="grm"
+else
+  _rm="rm"
+fi
+# Test if the specified rm has "-I" parameter since it's much better.
+if "${_rm}" -If "/tmp/.nonexistent.$(date '+%Y%m%d%H%M%S')" 2> /dev/null; then
+  alias rm="${_rm} -I"
+else
+  alias rm="${_rm} -i"
+fi
+unset _rm
 
 [ -f "${HOME}/.ecos_bash.after" ] && . "${HOME}/.ecos_bash.after"
--- a/rc/hgrc	Tue Sep 04 10:22:46 2012 +0700
+++ b/rc/hgrc	Tue Sep 04 10:23:37 2012 +0700
@@ -10,13 +10,21 @@
 
 [extensions]
 #hgext.convert = 
-#progress =
+progress =
 hgext.bookmarks =
 mq =
 rebase =
+graphlog =
+color =
 
 [hostfingerprints]
 bitbucket.org = 24:9c:45:8b:9c:aa:ba:55:4e:01:6d:58:ff:e4:28:7d:2a:14:ae:3b
 
 [defaults]
 addremove = --similarity 100
+
+[alias]
+ll = log --style default
+
+[bookmarks]
+track.current = true
--- a/rc/inputrc	Tue Sep 04 10:22:46 2012 +0700
+++ b/rc/inputrc	Tue Sep 04 10:23:37 2012 +0700
@@ -2,6 +2,9 @@
 set bell-style none
 set keymap emacs
 
+# automatically append / to symlinked directories
+set mark-symlinked-directories on
+
 #Home/End
 #GNOME Terminal
 "\eOH": beginning-of-line
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/rc/vim-syntax-scss	Tue Sep 04 10:23:37 2012 +0700
@@ -0,0 +1,101 @@
+" Vim syntax file
+" Language: SCSS (Sassy CSS)
+" Author: Daniel Hofstetter (daniel.hofstetter@42dh.com)
+" Inspired by the syntax files for sass and css. Thanks to the authors of
+" those files!
+
+if exists("b:current_syntax")
+  finish
+endif
+
+runtime! syntax/css.vim
+
+syn case ignore
+
+syn region scssDefinition transparent matchgroup=cssBraces start='{' end='}' contains=css.*Attr,css.*Prop,cssComment,cssValue.*,cssColor,cssUrl,cssImportant,cssError,cssStringQ,cssStringQQ,cssFunction,cssUnicodeEscape,scssDefinition,scssComment,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssInclude,scssExtend,scssDebug,scssWarn,@scssControl,scssInterpolation,scssNestedSelector,scssReturn
+
+syn region scssInterpolation start="#{" end="}" contains=scssVariable
+
+syn match scssVariable "$[[:alnum:]_-]\+" nextgroup=scssVariableAssignment
+syn match scssVariableAssignment ":" contained nextgroup=scssVariableValue
+syn match scssVariableValue ".*;"me=e-1 contained contains=scssVariable,scssOperator,scssDefault "me=e-1 means that the last char of the pattern is not highlighted
+syn match scssMixin "^@mixin" nextgroup=scssMixinName
+syn match scssMixinName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
+syn match scssFunction "^@function" nextgroup=scssFunctionName
+syn match scssFunctionName " [[:alnum:]_-]\+" contained nextgroup=scssDefinition
+syn match scssReturn "@return" contained
+syn match scssInclude "@include" nextgroup=scssMixinName
+syn match scssExtend "@extend .*[;}]"me=e-1 contains=cssTagName,scssIdChar,scssClassChar
+
+syn match scssColor "#[0-9A-Fa-f]\{3\}\>" contained
+syn match scssColor "#[0-9A-Fa-f]\{6\}\>" contained
+
+syn match scssIdChar "#[[:alnum:]_-]\@=" nextgroup=scssId contains=scssColor
+syn match scssId "[[:alnum:]_-]\+" contained
+syn match scssClassChar "\.[[:alnum:]_-]\@=" nextgroup=scssClass
+syn match scssClass "[[:alnum:]_-]\+" contained
+syn match scssAmpersand "&" nextgroup=cssPseudoClass
+
+syn match scssOperator "+" contained
+syn match scssOperator "-" contained
+syn match scssOperator "/" contained
+syn match scssOperator "*" contained
+
+syn match scssNestedSelector "[^/]* {"me=e-1 contained contains=cssTagName,cssAttributeSelector,scssIdChar,scssClassChar,scssAmpersand,scssVariable,scssMixin,scssFunction,@scssControl,scssInterpolation,scssNestedProperty
+syn match scssNestedProperty "[[:alnum:]]\+:"me=e-1 contained
+
+syn match scssDebug "@debug"
+syn match scssWarn "@warn"
+syn match scssDefault "!default" contained
+
+syn match scssIf "@if"
+syn match scssElse "@else"
+syn match scssElseIf "@else if"
+syn match scssWhile "@while"
+syn match scssFor "@for" nextgroup=scssVariable
+syn match scssFrom " from "
+syn match scssTo " to "
+syn match scssThrough " through "
+syn match scssEach "@each" nextgroup=scssVariable
+syn match scssIn " in "
+syn cluster scssControl contains=scssIf,scssElse,scssElseIf,scssWhile,scssFor,scssFrom,scssTo,scssThrough,scssEach,scssIn
+
+syn match scssComment "//.*$" contains=@Spell
+syn region scssImportStr start="\"" end="\""
+syn region scssImport start="@import" end=";" contains=scssImportStr,scssComment,cssComment,cssUnicodeEscape,cssMediaType
+
+hi def link scssVariable  Identifier
+hi def link scssVariableValue Constant
+hi def link scssMixin     PreProc
+hi def link scssMixinName Function
+hi def link scssFunction  PreProc
+hi def link scssFunctionName Function
+hi def link scssReturn    Statement
+hi def link scssInclude   PreProc
+hi def link scssExtend    PreProc
+hi def link scssComment   Comment
+hi def link scssColor     Constant
+hi def link scssIdChar    Special
+hi def link scssClassChar Special
+hi def link scssId        Identifier
+hi def link scssClass     Identifier
+hi def link scssAmpersand Character
+hi def link scssNestedProperty Type
+hi def link scssDebug     Debug
+hi def link scssWarn      Debug
+hi def link scssDefault   Special
+hi def link scssIf        Conditional
+hi def link scssElse      Conditional
+hi def link scssElseIf    Conditional
+hi def link scssWhile     Repeat
+hi def link scssFor       Repeat
+hi def link scssFrom      Repeat
+hi def link scssTo        Repeat
+hi def link scssThrough   Repeat
+hi def link scssEach      Repeat
+hi def link scssIn        Repeat
+hi def link scssInterpolation Delimiter
+hi def link scssImport    Include
+hi def link scssImportStr Include
+
+let b:current_syntax = "scss"
--- a/rc/vimrc	Tue Sep 04 10:22:46 2012 +0700
+++ b/rc/vimrc	Tue Sep 04 10:23:37 2012 +0700
@@ -39,7 +39,10 @@
   autocmd BufRead,BufNewFile Gemfile :set ft=ruby
   autocmd BufRead,BufNewFile crontab.* :set noet ts=8 nolist
   autocmd BufRead,BufNewFile crontab :set noet ts=8 nolist
+  autocmd BufRead,BufNewFile fstab :set noet ts=8 nolist
   autocmd BufRead,BufNewFile .git/COMMIT_EDITMSG :set noet ts=8 nolist
   autocmd BufRead,BufNewFile .gitconfig :set noet ts=8 nolist
   autocmd BufRead,BufNewFile .git/config :set noet ts=8 nolist
+  autocmd BufRead,BufNewFile *.erb :set ft=eruby ts=2 et list
+  autocmd BufRead,BufNewFile *.scss :set ft=scss
 endif
--- a/setup	Tue Sep 04 10:22:46 2012 +0700
+++ b/setup	Tue Sep 04 10:23:37 2012 +0700
@@ -112,6 +112,7 @@
     _rc "${1}" "hgrc" ".hgrc"
     _rc "${1}" "vimrc" ".vimrc"
     _rc "${1}" "vim-solarized" ".vim/colors/solarized.vim"
+    _rc "${1}" "vim-syntax-scss" ".vim/syntax/scss.vim"
     _rc "${1}" "inputrc" ".inputrc"
     _rc "${1}" "../bin" ".ecos_bin"
   ;;