Thread: [Assorted-commits] SF.net SVN: assorted:[1814] shell-tools/trunk/src/bash-commons/common.bash (Page 2)
Brought to you by:
yangzhang
From: <yan...@us...> - 2011-11-17 05:25:32
|
Revision: 1814 http://assorted.svn.sourceforge.net/assorted/?rev=1814&view=rev Author: yangzhang Date: 2011-11-17 05:25:26 +0000 (Thu, 17 Nov 2011) Log Message: ----------- Improve pg-stat Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2011-11-09 06:55:33 UTC (rev 1813) +++ shell-tools/trunk/src/bash-commons/common.bash 2011-11-17 05:25:26 UTC (rev 1814) @@ -761,14 +761,18 @@ select usename as usr, waiting, - current_query, + case + when length(current_query) <= 40 then current_query + else substring(current_query for 20) || '...' || + substring(current_query from length(current_query) - 16) + end as current_query, array_to_string(array_agg(distinct nspname), ', ') as schemas, array_to_string(array_agg(distinct relname), ', ') as tables from pg_stat_activity - inner join pg_locks on (pid=procpid) - inner join pg_class on (relfilenode=relation) - inner join pg_namespace n on (n.oid=relnamespace) + left outer join pg_locks on (pid=procpid) + left outer join pg_class on (relfilenode=relation) + left outer join pg_namespace n on (n.oid=relnamespace) where current_query not like '%pg_stat_activity%' group by procpid, usename, waiting, current_query;" } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2012-07-10 00:52:22
|
Revision: 1830 http://assorted.svn.sourceforge.net/assorted/?rev=1830&view=rev Author: yangzhang Date: 2012-07-10 00:52:16 +0000 (Tue, 10 Jul 2012) Log Message: ----------- Add simple-date Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2012-05-17 19:30:43 UTC (rev 1829) +++ shell-tools/trunk/src/bash-commons/common.bash 2012-07-10 00:52:16 UTC (rev 1830) @@ -281,6 +281,10 @@ date +%Y%m%d } +simple-date() { + date +%Y-%m-%d +} + # from http://joen.dk/wordpress/?p=34 rsyncp() { rsync -e ssh -P "$@" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2012-07-13 21:55:45
|
Revision: 1831 http://assorted.svn.sourceforge.net/assorted/?rev=1831&view=rev Author: yangzhang Date: 2012-07-13 21:55:38 +0000 (Fri, 13 Jul 2012) Log Message: ----------- Add mount-ecryptfs Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2012-07-10 00:52:16 UTC (rev 1830) +++ shell-tools/trunk/src/bash-commons/common.bash 2012-07-13 21:55:38 UTC (rev 1831) @@ -786,6 +786,12 @@ eval "$(keychain --eval --timeout $minutes id_rsa)" } +mount-ecryptfs() { + local dir="$1" + sudo mount -t ecryptfs "$dir"{,} -o \ + ecryptfs_cipher=aes,ecryptfs_key_bytes=32,ecryptfs_passthrough=n,ecryptfs_enable_filename_crypto=n +} + wait-idle() { while (( $( top -b -n 2 | grep ^Cpu | tail -1 | sed 's/.* \([[:digit:]]*\)\.[[:digit:]]*%id.*/\1/g' ) < 50 )) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2012-07-14 05:47:58
|
Revision: 1832 http://assorted.svn.sourceforge.net/assorted/?rev=1832&view=rev Author: yangzhang Date: 2012-07-14 05:47:51 +0000 (Sat, 14 Jul 2012) Log Message: ----------- Add 7zc, 7zcd, 7zcdf Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2012-07-13 21:55:38 UTC (rev 1831) +++ shell-tools/trunk/src/bash-commons/common.bash 2012-07-14 05:47:51 UTC (rev 1832) @@ -799,6 +799,25 @@ done } +7zc() { + for i in "$@" ; do + local j="$( echo "$i" | sed 's|/\+$||' ).7z" + 7z a -mx=9 -m0=lzma2 -mmt=4 "$j" "$i" + done +} + +7zcd() { + for i in "$@" ; do + 7zc "$i" && rm -r "$i" + done +} + +7zcdf() { + for i in "$@" ; do + 7zc "$i" && rm -rf "$i" + done +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2012-08-09 03:46:52
|
Revision: 1834 http://assorted.svn.sourceforge.net/assorted/?rev=1834&view=rev Author: yangzhang Date: 2012-08-09 03:46:46 +0000 (Thu, 09 Aug 2012) Log Message: ----------- Fix pg-space handling of big sizes Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2012-07-14 05:49:41 UTC (rev 1833) +++ shell-tools/trunk/src/bash-commons/common.bash 2012-08-09 03:46:46 UTC (rev 1834) @@ -744,7 +744,7 @@ select _schema, sum(bytes) as bytes, - lpad(pg_size_pretty(sum(bytes)::int), 9) as size, + lpad(pg_size_pretty(sum(bytes)::bigint), 12) as size, sum(pct) as pct from base group by _schema This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2012-09-08 01:13:17
|
Revision: 1839 http://assorted.svn.sourceforge.net/assorted/?rev=1839&view=rev Author: yangzhang Date: 2012-09-08 01:13:11 +0000 (Sat, 08 Sep 2012) Log Message: ----------- Add pg-for-all Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2012-08-15 17:22:44 UTC (rev 1838) +++ shell-tools/trunk/src/bash-commons/common.bash 2012-09-08 01:13:11 UTC (rev 1839) @@ -672,6 +672,28 @@ psql } +# Outputs a query that selects all schema.table names. +# +# Usage example: +# pg-for-all tables | +# sudo -u postgres psql pod | +# xargs -I_ echo 'alter table _ owner to joe;' | +# sudo -u postgres psql pod +pg-for-all() { + local type=$1 where=${2:-true} + case $type in + tables ) + echo " + select schemaname || '.' || tablename + from pg_tables + where $where + and schemaname != 'pg_catalog' + and schemaname != 'information_schema' + order by 1; + " ;; + esac +} + # Resume SCP; from <http://joen.dk/wordpress/?p=34> scp-resume() { rsync --partial --progress "$@" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <yan...@us...> - 2013-03-31 22:39:08
|
Revision: 1852 http://sourceforge.net/p/assorted/svn/1852 Author: yangzhang Date: 2013-03-31 22:39:05 +0000 (Sun, 31 Mar 2013) Log Message: ----------- Add extract-audio Modified Paths: -------------- shell-tools/trunk/src/bash-commons/common.bash Modified: shell-tools/trunk/src/bash-commons/common.bash =================================================================== --- shell-tools/trunk/src/bash-commons/common.bash 2013-03-31 22:38:44 UTC (rev 1851) +++ shell-tools/trunk/src/bash-commons/common.bash 2013-03-31 22:39:05 UTC (rev 1852) @@ -840,6 +840,10 @@ done } +extract-audio() { + ffmpeg -i "$1" -acodec copy "${1%.*}.mp3" +} + #if ! is_declared indent ; then # noindent #else This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |