changeset 113:9b91e702c19c

Latestest merge.
author Edho Prima Arief <edho@myconan.net>
date Wed, 19 Oct 2011 06:51:43 +0000
parents 917b525eaee0 (current diff) abc5c2edb967 (diff)
children eb4dddd48f29 548cf46e9cb4
files
diffstat 6 files changed, 95 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/bash	Wed Oct 19 06:50:41 2011 +0000
+++ b/bash	Wed Oct 19 06:51:43 2011 +0000
@@ -6,9 +6,17 @@
 export PATH="${HOME}/.ecos_bin:${HOME}/bin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin"
 
 PS1='[\u@\h \W]\$ '
+#PS1='[\[\e[0;33m\]\u\[\e[0m\]@\[\e[0;32m\]\h\[\e[0m\] \[\e[1;34m\]\W\[\e[0m\]]\$ '
+
+shopt -s histappend
+PROMPT_COMMAND='history -a'
+export HISTFILESIZE=10000
+export HISTCONTROL=ignoredups
 
 export PAGER="less -Rins"
 export EDITOR=vi
+export LANG="en_US.UTF-8"
+unset LS_COLORS
 
 alias less="less -Rins"
 #assuming POSIX grep
@@ -25,6 +33,7 @@
   Linux)
     _has_rm_I=y
     _has_gnu_ls=y
+    _has_gnu_grep=y
   ;;
   SunOS)
     [ -x /usr/gnu/bin/rm ] && _has_rm_I=y
@@ -40,7 +49,8 @@
   ;;
   FreeBSD)
     _has_rm_I=y
-    CLICOLOR=
+    export CLICOLOR=
+    export LSCOLORS=ExGxFxdxCxegedabagExEx
   ;;
   OpenBSD)
     if command -v colorls > /dev/null 2>&1; then
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/dumpshot	Wed Oct 19 06:51:43 2011 +0000
@@ -0,0 +1,28 @@
+#!/usr/bin/env python
+
+import sys, os, re
+
+def is_shotfile(inpath):
+  finpath = os.path.basename(inpath)
+  return (finpath[-4:] == ".png") and (finpath[:4] == "shot")
+
+def main(source_files, targetdir):
+  max_shot=0
+  try:
+    current_files=os.listdir(targetdir)
+    for current_file in current_files:
+      if is_shotfile(current_file):
+        file_shot = int(re.findall("\d+", current_file)[0])
+        if file_shot > max_shot:
+          max_shot = file_shot
+    for source_file in source_files:
+      if is_shotfile(source_file):
+        max_shot += 1
+        target_file = os.path.join(targetdir, "shot%04d.png" % max_shot)
+        print "Moving: %s => %s" % (source_file, target_file)
+        os.rename(source_file, target_file)
+  except:
+    print "(%s: %s)" % (sys.exc_type, sys.exc_value)
+
+if __name__ == "__main__":
+  main(sys.argv[2:], sys.argv[1])
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/bin/recompress	Wed Oct 19 06:51:43 2011 +0000
@@ -0,0 +1,46 @@
+#!/usr/bin/env python
+
+import sys, os
+from PIL import Image
+
+
+# Raises a generic exception (exception.Exception) if input is not a PNG file.
+def repng(filename):
+  im = Image.open(filename)
+  if im.format == "PNG":
+    im.save(filename, "PNG", optimize=1)
+  else:
+    raise Exception("Not a PNG image file")
+
+def hbytes(inbyte):
+  units = ["B", "kB", "MB", "GB", "TB", "PB"] 
+  outbyte = float(inbyte)
+  current_unit = 0
+  while outbyte > 1000:
+    outbyte /= 1000
+    current_unit += 1
+  return "%.2f %s" % (outbyte, units[current_unit])
+
+def sane_fn(filename):
+  import re
+  return re.sub(r"[\x00-\x1F\x7F\n\r]", "?", filename)
+
+def main(files):
+  for filename in files:
+    print "Recompressing %s:" % sane_fn(filename),
+    sys.stdout.flush()
+    try:
+      byte_orig = os.path.getsize(filename)
+      repng(filename)
+      byte_new = os.path.getsize(filename)
+      print "OK (%s => %s, %.2f%% saving)" % (hbytes(byte_orig), hbytes(byte_new), (byte_orig - byte_new)*100/float(byte_orig)),
+      re = 0
+    except:
+      print "Failed",
+      print "(%s: %s)" % (sys.exc_type, sys.exc_value),
+      re = 1
+    finally:
+      print "[%s]" % re
+
+if __name__ == "__main__":
+  main(sys.argv[1:])
--- a/hg	Wed Oct 19 06:50:41 2011 +0000
+++ b/hg	Wed Oct 19 06:51:43 2011 +0000
@@ -1,5 +1,5 @@
 [ui]
-username = Edho Prima Arief <me@myconan.net>
+username = Edho Prima Arief <edho@myconan.net>
 merge = vimdiff
 verbose = true
 
@@ -10,3 +10,7 @@
 [extensions]
 #hgext.convert = 
 #progress =
+
+[hostfingerprints]
+bitbucket.org = 81:2b:08:90:dc:d3:71:ee:e0:7c:b4:75:ce:9b:6c:48:94:56:a1:fe
+
--- a/inputrc	Wed Oct 19 06:50:41 2011 +0000
+++ b/inputrc	Wed Oct 19 06:51:43 2011 +0000
@@ -29,5 +29,5 @@
 "\eOB": history-search-forward
 
 #Misc
-"\C-w": backward-kill-word
+"\C-w": unix-filename-rubout
 
--- a/tcsh	Wed Oct 19 06:50:41 2011 +0000
+++ b/tcsh	Wed Oct 19 06:51:43 2011 +0000
@@ -70,13 +70,16 @@
     ( which gnuls ) > /dev/null && alias ls gnuls ${gnuls_opts}
     alias man man -o
     alias rm rm -I
+    alias top top -P
   breaksw
   case NetBSD:
     set path=(${path} /usr/pkg/{bin,sbin})
     breaksw
-    case OpenBSD:
+  case OpenBSD:
     set path=(${path} /usr/local/{bin,sbin})
+    setenv LSCOLORS ExGxFxdxCxegedabagExEx
     [ "${iscolor}" -eq 1 ] && setenv TERM xterm-256color
+    ( which colorls ) > /dev/null && alias ls colorls -FG
   breaksw
   case DragonFly:
     set path=(${path} /usr/pkg/{bin,sbin})