From d37fcfdce11711d916dfbcc55b9811126f4b7673 Mon Sep 17 00:00:00 2001 From: Fabien Benetou Date: Tue, 12 Jul 2011 23:26:49 +0200 Subject: [PATCH] added personal scripts --- shell_scripts/con_restart | 3 ++ shell_scripts/downloads_to_watch_later | 3 ++ shell_scripts/export_shared_links_per_person | 3 ++ shell_scripts/gallery_making | 4 ++ shell_scripts/gm_reverting_irc_logs_links | 45 ++++++++++++++++++ shell_scripts/gm_reverting_pim_links | 47 +++++++++++++++++++ .../last_tweeters_account_on_logname | 2 + shell_scripts/most_used_commands | 14 ++++++ shell_scripts/mytasks | 15 ++++++ shell_scripts/pmwiki | 20 ++++++++ shell_scripts/recently_modified_etc_configs | 2 + shell_scripts/social_behavior_distribution | 20 ++++++++ shell_scripts/social_grep | 14 ++++++ shell_scripts/tunkranker | 3 ++ shell_scripts/videolectures_rtmpdump_warper | 25 ++++++++++ shell_scripts/wiki_average_words_per_diff | 5 ++ shell_scripts/wiki_contribution_distribution | 9 ++++ shell_scripts/wiki_diff_distribution | 13 +++++ shell_scripts/wiki_link_checking | 19 ++++++++ shell_scripts/wiki_list_content | 7 +++ shell_scripts/wiki_oldest_mentions | 22 +++++++++ shell_scripts/wiki_page_diffs | 4 ++ shell_scripts/wiki_page_diffs_visualization | 18 +++++++ .../wiki_per_page_diffs_visualization | 13 +++++ shell_scripts/wiki_recent_untrusted_edits | 14 ++++++ shell_scripts/wiki_semantic_categories | 10 ++++ shell_scripts/wiki_total_diffs | 5 ++ shell_scripts/wiki_untrusted_edits | 16 +++++++ 28 files changed, 375 insertions(+) create mode 100755 shell_scripts/con_restart create mode 100755 shell_scripts/downloads_to_watch_later create mode 100755 shell_scripts/export_shared_links_per_person create mode 100755 shell_scripts/gallery_making create mode 100755 shell_scripts/gm_reverting_irc_logs_links create mode 100755 shell_scripts/gm_reverting_pim_links create mode 100755 shell_scripts/last_tweeters_account_on_logname create mode 100755 shell_scripts/most_used_commands create mode 100755 shell_scripts/mytasks create mode 100755 shell_scripts/pmwiki create mode 100755 shell_scripts/recently_modified_etc_configs create mode 100755 shell_scripts/social_behavior_distribution create mode 100755 shell_scripts/social_grep create mode 100755 shell_scripts/tunkranker create mode 100755 shell_scripts/videolectures_rtmpdump_warper create mode 100755 shell_scripts/wiki_average_words_per_diff create mode 100755 shell_scripts/wiki_contribution_distribution create mode 100755 shell_scripts/wiki_diff_distribution create mode 100755 shell_scripts/wiki_link_checking create mode 100755 shell_scripts/wiki_list_content create mode 100755 shell_scripts/wiki_oldest_mentions create mode 100755 shell_scripts/wiki_page_diffs create mode 100755 shell_scripts/wiki_page_diffs_visualization create mode 100755 shell_scripts/wiki_per_page_diffs_visualization create mode 100755 shell_scripts/wiki_recent_untrusted_edits create mode 100755 shell_scripts/wiki_semantic_categories create mode 100755 shell_scripts/wiki_total_diffs create mode 100755 shell_scripts/wiki_untrusted_edits diff --git a/shell_scripts/con_restart b/shell_scripts/con_restart new file mode 100755 index 0000000..9625ddb --- /dev/null +++ b/shell_scripts/con_restart @@ -0,0 +1,3 @@ +#!/bin/sh +CON=`nmcli con list | grep wireless | sed "s/ .*//"` +nmcli con down id $CON && nmcli con up id $CON diff --git a/shell_scripts/downloads_to_watch_later b/shell_scripts/downloads_to_watch_later new file mode 100755 index 0000000..8bae167 --- /dev/null +++ b/shell_scripts/downloads_to_watch_later @@ -0,0 +1,3 @@ +#!/bin/sh +RATE=50k +wget -c --limit-rate=$RATE -i ~/to_download_and_watch diff --git a/shell_scripts/export_shared_links_per_person b/shell_scripts/export_shared_links_per_person new file mode 100755 index 0000000..b90e247 --- /dev/null +++ b/shell_scripts/export_shared_links_per_person @@ -0,0 +1,3 @@ +#!/bin/sh +# if no $1 then ask for person name +grep $1 ~/sharedlinks | sed "s/$1 //" | sed "$ s/^/
/" | tac | sed "$ s/$/<\/table><\/html>/" | sed "s/^/
/" | sed "s/^\(.*\) +0200 \(.*\)/\1<\/td>\2/" | sed "s/http\([^ ]*\)/http\1<\/a>/g" | sed "s/$/<\/td><\/tr>/" > ~/web/benetou.fr/fabien/pub/sharedlinks/$1.html diff --git a/shell_scripts/gallery_making b/shell_scripts/gallery_making new file mode 100755 index 0000000..cdc0f63 --- /dev/null +++ b/shell_scripts/gallery_making @@ -0,0 +1,4 @@ +#!/bin/sh + +# consider using convert to generate thumbnails and auto-rotate +echo "" > gallery.html && ls *.jpg *.JPG |sort -n| sed "s/\(.*\)/\1<\/a>/" > gallery.html && echo "" >> gallery.html diff --git a/shell_scripts/gm_reverting_irc_logs_links b/shell_scripts/gm_reverting_irc_logs_links new file mode 100755 index 0000000..16813a7 --- /dev/null +++ b/shell_scripts/gm_reverting_irc_logs_links @@ -0,0 +1,45 @@ +#!/bin/sh +# http://fabien.benetou.fr/Tools/Greasemonkey#RevertedPIMLinks +# TODO +# properly declare +# path +# groups to avoid +# pages to avoid +DATE=$(date +%s) + +#cd /home/utopiah/web/benetou.fr/fabien/link_extractor + +USERS=$(ls */*.log | grep -v twitter | grep -v identica | grep -v '#' | grep -v http) +# # to remove chanels and http to remove mistakes that screw the rest of the script + +echo 'extract all the links from the logs' +# skipped here since the logs are small enough not to be pre-processed (rendered when its a wiki) +echo 'get all the links > sorted_global.txt' +grep http $USERS | grep -v "" | sed "s/http/\nhttp/g" | grep http | sed "s/ .*//" | grep -e='[http://[:alnum:]|https://[:alnum:]]' | sort | uniq > sorted_global.txt +# XXX somehow http alone goes through, this should not be the case + +echo 'for every link check in which page it is mentionned and append it without duplicates > indexed_links_uniqued' +echo '' > indexed_links_uniqued +while read line; do + echo -n "$line " >> indexed_links_uniqued + grep -i $line $USERS | sed "s/:.*//" | sort | uniq | xargs -0 echo "Discussion:" | sed "s/ //" >> indexed_links_uniqued +done < sorted_global.txt + +echo 'clean from improper URL (e.g. " present) sed "s/\"/\\\"/g"' +grep -v '"' indexed_links_uniqued | sort | uniq > indexed_links_uniqued_cleaned + +echo 'format as User.js and make it available' +cat indexed_links_uniqued_cleaned | grep http | sed 's/\([^ ]\+\) \(.*\)/user_pref("greasemonkey.scriptvals.Utopiah\/reverted PIM links.rPIMlinks \1", "\2");/' > user.js +echo "user_pref(\"greasemonkey.scriptvals.Utopiah/reverted PIM links.rPIMlinks IRCdate\", \"$DATE\");" >> user.js + +echo 'compress for faster transfert' +bzip2 -k -f user.js #compress by a factor 10 + +echo 'make the script available via http://cloud.benetou.fr/discussions/user.js.bz2' +#mv user.js.bz2 ../pub/ +echo '(note that since this is not merged with the existing user.js from user.js it will required another restart)' + +#echo 'periodically call this very script' + #server cron added + +#client cron not added diff --git a/shell_scripts/gm_reverting_pim_links b/shell_scripts/gm_reverting_pim_links new file mode 100755 index 0000000..e7e6ded --- /dev/null +++ b/shell_scripts/gm_reverting_pim_links @@ -0,0 +1,47 @@ +#!/bin/sh +# http://fabien.benetou.fr/Tools/Greasemonkey#RevertedPIMLinks +# TODO +# properly declare +# path +# groups to avoid +# pages to avoid +WIKI=/home/utopiah/web/benetou.fr/fabien/ +DATE=$(date +%s) + +cd /home/utopiah/web/benetou.fr/fabien/link_extractor + +echo 'extract all the links from the wiki by group' +for GROUP in $(ls ../wiki.d/ | sed "s/\..*//" | sort | uniq | grep -v PmWiki | grep -v Site ); +do + for PAGE in $(ls ../wiki.d/$GROUP.* | sed "s/\.\.\/wiki.d\///" ); do pmwiki n=$PAGE nolog=true | sed "s/http/\nhttp/g" | grep http | grep -v benetou.fr | grep -v seedea.org | grep -v 127.0.0.1 | grep -v .ico\" | sed "s/'.*//" | sed "s/<\/a>.*//" | sed "s/$/ $PAGE/"; done > links_from_$GROUP +done + +echo 'get all the links > sorted_global.txt' +cat links_from_* | sed "s/ .*//" | sort | uniq | grep -e "http://\w\|https://\w" > sorted_global.txt + +echo 'for every link check in which page it is mentionned and append it without duplicates > indexed_links_uniqued' +echo '' > indexed_links_uniqued +while read line; do + echo -n "$line " >> indexed_links_uniqued + grep -i $line links_from_* | sed "s/.* //" | sort | uniq | xargs >> indexed_links_uniqued +done < sorted_global.txt + +echo 'clean from improper URL (e.g. " present) sed "s/\"/\\\"/g"' +grep -v '"' indexed_links_uniqued > indexed_links_uniqued_cleaned + +echo 'format as User.js and make it available' +cat indexed_links_uniqued_cleaned | sed 's/\([^ ]\+\) \(.*\)/user_pref("greasemonkey.scriptvals.Utopiah\/reverted PIM links.rPIMlinks \1", "\2");/' > user.js +echo "user_pref(\"greasemonkey.scriptvals.Utopiah/reverted PIM links.rPIMlinks date\", \"$DATE\");" >> user.js + +# replaced by rsync +#echo 'compress for faster transfert' +#bzip2 -k -f user.js #compress by a factor 10 + +# replaced by rsync +# echo 'make the script available via http://fabien.benetou.fr/pub/user.js.bz2' +#mv user.js.bz2 ../pub/ + +#echo 'periodically call this very script' + #server cron added + +#client cron not added diff --git a/shell_scripts/last_tweeters_account_on_logname b/shell_scripts/last_tweeters_account_on_logname new file mode 100755 index 0000000..63c447b --- /dev/null +++ b/shell_scripts/last_tweeters_account_on_logname @@ -0,0 +1,2 @@ +#!/bin/sh +curl http://search.twitter.com/search?q=$LOGNAME | grep profile | sed "s/.*com\/\(.*\)\" onclick.*/http:\/\/twitter.com\/\1/" | grep -v $LOGNAME | sort | uniq diff --git a/shell_scripts/most_used_commands b/shell_scripts/most_used_commands new file mode 100755 index 0000000..9482135 --- /dev/null +++ b/shell_scripts/most_used_commands @@ -0,0 +1,14 @@ +#!/bin/sh +AVOID="con\|utopiah@benetou.fr" + +echo consider also http://fabien.benetou.fr/Tools/ and exercises + +# should also remove arguments without - e.g. nmcli con or ssh myserver +cat ~/.bash_history | sed "s/ /\n/g" | grep "^[[:alpha:]]" | sort | uniq -c | grep -v $AVOID | sort -n | tail | sed "s, \([a-zA-Z].*\), \1\t( http://unixhelp.ed.ac.uk/CGI/man-cgi?\1 ) ," +# simpler version for just the first word, which is bad for commands like sort which never appear first +#cat ~/.bash_history | sed "s/ .*//" | sort | uniq -c | sort -n | tail + +# consider similar usage for more than bash +# find ~ -name "*history*" +# ~/.vimperator/info/default/history-command (specific JSON format) +# ~/.newsbeuter/history.cmdline diff --git a/shell_scripts/mytasks b/shell_scripts/mytasks new file mode 100755 index 0000000..8aef543 --- /dev/null +++ b/shell_scripts/mytasks @@ -0,0 +1,15 @@ +#!/bin/sh + +# learn more about cron, at and batch +## note that at also requires to specify the DISPLAY +## e.g. using http://www.ibm.com/developerworks/linux/library/l-job-scheduling/index.html +# consider hooks and events e.g. inofity, git hooks, ratpoison hooks, ... + +QUESTION='read -p "finished? (^C to stop, make sure to delete previous done tasks) "' +#echo merge *.pmwiki to the wiki && `$QUESTION` +mottt_through_proxy & +#evince -p 47 book_or_article.pdf; $QUESTION +## note that evince remembers the last opended page +## re-opening the document update the page numbr in the running version +# script newsbeuter to handle evince +#echo watch videos in `ls ~/*.flv`; `$QUESTION` diff --git a/shell_scripts/pmwiki b/shell_scripts/pmwiki new file mode 100755 index 0000000..928dab0 --- /dev/null +++ b/shell_scripts/pmwiki @@ -0,0 +1,20 @@ +#!/usr/bin/php -q + 0) +{ + for ($i=1;$i < $argc;$i++) + { + parse_str($argv[$i],$tmp); + $_REQUEST = array_merge($_REQUEST, $tmp); + } +} + +require_once '~/web/benetou.fr/fabien/pmwiki.php'; + +?> diff --git a/shell_scripts/recently_modified_etc_configs b/shell_scripts/recently_modified_etc_configs new file mode 100755 index 0000000..33180dc --- /dev/null +++ b/shell_scripts/recently_modified_etc_configs @@ -0,0 +1,2 @@ +#!/bin/sh +find /etc/ -mtime -1 -name *.conf diff --git a/shell_scripts/social_behavior_distribution b/shell_scripts/social_behavior_distribution new file mode 100755 index 0000000..df4bae9 --- /dev/null +++ b/shell_scripts/social_behavior_distribution @@ -0,0 +1,20 @@ +#!/bin/sh + +# http://fabien.benetou.fr/Tools/Irssi#LogsSocialBehaviors +if [ $# -lt 1 ] +then + echo "usage: $0 pattern [network] [user]" ; exit; +fi + +#save params in ~/$0_history +# history | grep social_behavior_distribution +## cheaper version + +PERSON=$1; +BEHAVIOR_PATTERN=$2; +FRESHNESS=-20000; +tail $FRESHNESS ~/irclogs/seedeabitlbee/$PERSON.log | grep -i "$BEHAVIOR_PATTERN" | grep -i $PERSON | sed "s/:.*//" | sort -n | uniq -c | sort -n -r | head -3 +# note that seedeabitlbee is now fabien + +# note that comparison can't be done because freshness changes per person +# i.e. the more you talk with a person, the fresher the information will be, and vice versa diff --git a/shell_scripts/social_grep b/shell_scripts/social_grep new file mode 100755 index 0000000..1c71270 --- /dev/null +++ b/shell_scripts/social_grep @@ -0,0 +1,14 @@ +#!/bin/sh +# http://fabien.benetou.fr/Tools/Shell#Scripting +# shell prototype +# if 0 args display help +# $#==0 echo "usage: $0 pattern [network] [user]" ; exit; ? +grep $@ ~/irclogs/*/* +#$2 for server limitations +#$3 for user limitations + +#save params in ~/$0_history +echo $(date +%s) $@ >> ~/SocialMemorization_history + +# history | grep SocialMemorization.sh +## cheaper version diff --git a/shell_scripts/tunkranker b/shell_scripts/tunkranker new file mode 100755 index 0000000..21e351f --- /dev/null +++ b/shell_scripts/tunkranker @@ -0,0 +1,3 @@ +#!/bin/sh +# generalize via a parameter, default back to USER +curl http://tunkrank.com/refresh/utopiah.json && curl http://tunkrank.com/score/utopiah.json >> ~/web/benetou.fr/fabien/pub/socialbehaviors/tunkrank_utopiah.txt && echo "" >> ~/web/benetou.fr/fabien/pub/socialbehaviors/tunkrank_utopiah.txt diff --git a/shell_scripts/videolectures_rtmpdump_warper b/shell_scripts/videolectures_rtmpdump_warper new file mode 100755 index 0000000..45959f7 --- /dev/null +++ b/shell_scripts/videolectures_rtmpdump_warper @@ -0,0 +1,25 @@ +#!/bin/sh +# http://fabien.benetou.fr/Tools/Tools#RTMPDump +if [ $# -lt 1 ] +then + echo "VideoLectures helper for RTMPDump" + echo "usage: $0 http://VideoLecture.net/targetlecture/ [targetlecture.flv]" + echo "if the second parameter is omitted the name of the lecture from the URL will be used" + echo "" + echo "Want to grab a list of lectures? Consider xargs (e.g. xargs -n 1 -a list_of_lectures.txt videolectures.sh )." + echo "" + echo "(note that resuming does not work, neither does keyframe skipping)" + exit +fi +URL=$1 +DEST=$2 +# if $2 is empty, use the last part of the URI +if [ $# -lt 2 ] +then + DEST=$(echo $1 | sed "s|http://videolectures.net/\(.*\)/|\1|").flv +fi + +REMOTE=$(curl $1 | grep clip.url | sed "s/.*\"\(.*\)\".*/\1/" | grep -v flv) +SOURCE=rtmp://oxy.videolectures.net/video + +rtmpdump -W $1 -o $DEST -r $SOURCE -y $REMOTE diff --git a/shell_scripts/wiki_average_words_per_diff b/shell_scripts/wiki_average_words_per_diff new file mode 100755 index 0000000..3784f7f --- /dev/null +++ b/shell_scripts/wiki_average_words_per_diff @@ -0,0 +1,5 @@ +#!/bin/sh + +# takes are argument the wiki root + +grep diff: $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site.) | wc | awk '{print $2/$1}' | bc diff --git a/shell_scripts/wiki_contribution_distribution b/shell_scripts/wiki_contribution_distribution new file mode 100755 index 0000000..bb87d2e --- /dev/null +++ b/shell_scripts/wiki_contribution_distribution @@ -0,0 +1,9 @@ +#!/bin/sh + +#if not in wiki.d/ via pwd or parameter +##then display help +# `pwd|grep wiki.d` +## XXX this and those following script are not done at the root of the wiki +### wiki_oldest_mentions +### wiki_page_diffs +grep author: $@ | sed -e "s/.*=//" | sort | uniq -i -c | sort -nr | head diff --git a/shell_scripts/wiki_diff_distribution b/shell_scripts/wiki_diff_distribution new file mode 100755 index 0000000..255310a --- /dev/null +++ b/shell_scripts/wiki_diff_distribution @@ -0,0 +1,13 @@ +#!/bin/sh + +# to use in wiki root +## XXX this is not consistent with some other commands +### e.g. wiki_contribution_distribution +grep diff: $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site.) > alllines + +echo "" > diff_distribution +while read line; do + echo "$line " | wc -w >> diff_distribution +done < alllines + +sort -n diff_distribution | uniq -c | sort -r -n diff --git a/shell_scripts/wiki_link_checking b/shell_scripts/wiki_link_checking new file mode 100755 index 0000000..5d5be7e --- /dev/null +++ b/shell_scripts/wiki_link_checking @@ -0,0 +1,19 @@ +#!/bin/sh +# http://fabien.benetou.fr/Wiki/ToDo#Maintenance +# TODO +# generalize for other URLs +if [ $# -lt 1 ] +then + echo "Check page per page against dead links for PmWiki" + echo "usage: $0 PmWiki_path" + exit +fi +PATH=$1 +NOW_EPOCH=$(date +"%s") +URL=http://fabien.benetou.fr/ +for PAGE in $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site | sed "s/.*wiki\.d\///" | tr "." "/") +do + checklink -s $URL/$PAGE > $PATH/pub/checking/$(echo $PAGE|tr "/" ".").check + # using the Perl W3C-checklink + ## should fail if not installed and suggest the CPAN command +done; diff --git a/shell_scripts/wiki_list_content b/shell_scripts/wiki_list_content new file mode 100755 index 0000000..3e70730 --- /dev/null +++ b/shell_scripts/wiki_list_content @@ -0,0 +1,7 @@ +#!/bin/sh + +#to be done in the root of the wiki +for X in $(ls $1/wiki.d); +do + echo $X | grep -v -E ".flock|,new|,del|RecentChanges|PmWiki.|Site." +done diff --git a/shell_scripts/wiki_oldest_mentions b/shell_scripts/wiki_oldest_mentions new file mode 100755 index 0000000..670729e --- /dev/null +++ b/shell_scripts/wiki_oldest_mentions @@ -0,0 +1,22 @@ +#!/bin/sh +# http://fabien.benetou.fr/MemoryRecalls/ImprovingPIM +# TODO +# discard multiple edits on the same page +# put the number of results as a parameter (or just let the user do so?) +# cache the result as it should not change over time (except if pages are moved) +if [ $# -lt 1 ] +then + echo "Locating the first 10 edits of a word for PmWiki" + echo "usage: $0 word [PmWiki/wiki.d/path]" + echo "if the second parameter is omitted the path is assumed to be ." + exit +fi +WORD=$1 +DEST=$2 +NUMBEROFRESULT=10 +# if $2 is empty, use the last part of the URI +if [ $# -lt 2 ] +then + DEST=. +fi +grep -i $WORD $DEST/* | sed "s/=.*//" | grep diff | sort -n -t: -k3 -r | tail -$NUMBEROFRESULT diff --git a/shell_scripts/wiki_page_diffs b/shell_scripts/wiki_page_diffs new file mode 100755 index 0000000..abb5b5e --- /dev/null +++ b/shell_scripts/wiki_page_diffs @@ -0,0 +1,4 @@ +#!/bin/sh + +## to be done in wiki.d/ +grep diff: $1 | awk '{FS=":"; print $2}' | sort -n | uniq diff --git a/shell_scripts/wiki_page_diffs_visualization b/shell_scripts/wiki_page_diffs_visualization new file mode 100755 index 0000000..335eca9 --- /dev/null +++ b/shell_scripts/wiki_page_diffs_visualization @@ -0,0 +1,18 @@ +#!/bin/sh + +# deprecated for Processing visualizations http://fabien.benetou.fr/Wiki/Visualization#timeline +if [[ ! ("$#" == 1) ]]; then + echo 'Generate GNUPlot visualization for the PmWiki directory' + echo "Usage : $0 path_to_PmWiki_directory" + exit 1 +fi +NOW_EPOCH=$(date +"%s") +for PAGE in $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site | sed "s/.*wiki\.d\///") +do + wiki_page_diffs $1/wiki.d/$PAGE > $1/pub/visualization/edits_per_page/$PAGE.data; + echo -e "set terminal png\nset output '$PAGE.png'\nset notitle\nset nokey\nset xlabel ''\nset format x ''\nset format y ''\nset ylabel ''\nset timefmt '%s'\nset size 1,0.05\nplot [1214268628:$NOW_EPOCH] [0:] '$PAGE.data' using 1:0\n" > $1/pub/visualization/edits_per_page/$PAGE.plt; +done; +for PAGE in $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site | sed "s/.*wiki\.d\///") +do + (cd $1/pub/visualization/edits_per_page/; gnuplot $PAGE.plt;); +done diff --git a/shell_scripts/wiki_per_page_diffs_visualization b/shell_scripts/wiki_per_page_diffs_visualization new file mode 100755 index 0000000..7ed27e4 --- /dev/null +++ b/shell_scripts/wiki_per_page_diffs_visualization @@ -0,0 +1,13 @@ +#!/bin/sh + +# deprecated for Processing visualizations http://fabien.benetou.fr/Wiki/Visualization#timeline + +NOW_EPOCH=$(date +"%s") +WIKI_PATH=/home/utopiah/web/benetou.fr/fabien +sleep 1 +for PAGE in $(echo $1 | grep -v -E "flock|pageindex|RecentChanges" | sed "s/,new//"); +do + /home/utopiah/bin/wiki_page_diffs $WIKI_PATH/wiki.d/$PAGE > $WIKI_PATH/pub/visualization/edits_per_page/$PAGE.data; + echo -e "set terminal png\nset output '$PAGE.png'\nset notitle\nset nokey\nset xlabel ''\nset format x ''\nset format y ''\nset ylabel ''\nset timefmt '%s'\nset size 1,0.05\nplot [1214268628:$NOW_EPOCH] [0:] '$PAGE.data' using 1:0\n" > $WIKI_PATH/pub/visualization/edits_per_page/$PAGE.plt; + cd $WIKI_PATH/pub/visualization/edits_per_page/; gnuplot $PAGE.plt; +done diff --git a/shell_scripts/wiki_recent_untrusted_edits b/shell_scripts/wiki_recent_untrusted_edits new file mode 100755 index 0000000..08a04eb --- /dev/null +++ b/shell_scripts/wiki_recent_untrusted_edits @@ -0,0 +1,14 @@ +#!/bin/sh +# TODO +# fix untrusted_edits path problem first +# note that the output format changed too +EXP_ARGS=1 +if [ "$1" = "--help" -o "$1" = "-h" -o $# -lt $EXP_ARGS ] +then + echo "Search for the last non trusted edits in PmWiki" + echo "Usage: $0 PmWikiPath" + echo "(uses untrusted_edits)" + exit +fi +THA=$(($(date +"%s") - (60 * 60 * 24 * 2) )); +grep time= $( wiki_untrusted_edits "$1" ) | grep -v ctime | sed -e "s/$/=$THA/" | awk 'BEGIN{FS="="} {if ($2 > $3) print $0}' | sed "s/:.*//" diff --git a/shell_scripts/wiki_semantic_categories b/shell_scripts/wiki_semantic_categories new file mode 100755 index 0000000..dd6ab54 --- /dev/null +++ b/shell_scripts/wiki_semantic_categories @@ -0,0 +1,10 @@ +#!/bin/sh + +# to execute in wiki.d/ + +APIKEY=`cat ~/.semantichacker.com_apikey` +for PAGE in `echo $1 | sed "s/\./\//"`; +do + sleep 5 + echo "http://api.semantichacker.com/$APIKEY/category?showLabels=true&uri=http://fabien.benetou.fr/$PAGE" +done diff --git a/shell_scripts/wiki_total_diffs b/shell_scripts/wiki_total_diffs new file mode 100755 index 0000000..f7be7fa --- /dev/null +++ b/shell_scripts/wiki_total_diffs @@ -0,0 +1,5 @@ +#!/bin/sh + +# takes are argument the wiki root + +grep diff: $(ls $1/wiki.d/* | grep -v PmWiki. | grep -v Site.) | awk '{FS=":"; print $3}' | wc -l diff --git a/shell_scripts/wiki_untrusted_edits b/shell_scripts/wiki_untrusted_edits new file mode 100755 index 0000000..096aa3c --- /dev/null +++ b/shell_scripts/wiki_untrusted_edits @@ -0,0 +1,16 @@ +#!/bin/sh +# TODO +# BUG! works with . but not with full path +EXP_ARGS=1 +LIST=~/.wiki_trusted_authors +if [ "$1" = "--help" -o "$1" = "-h" -o $# -lt $EXP_ARGS ] +then + echo "Search for non trust edits in PmWiki" + echo "Usage: $0 PmWikiPath" + echo "(note that the list of trusted authors is in $LIST)" + exit +fi +grep author: $1/* | grep -v diff: | grep -v -f $LIST + +# seems to be more interesting to delegate that to the user +#| sed -e "s/:.*//" | sort | uniq