changeset 73:72667ffd72f0

Added BL scraping to DML startup goals
author daniel
date Fri, 02 Oct 2015 00:47:54 +0100
parents 3abaa9f50925
children 30d5c450cf0a
files .plrc .screenrc
diffstat 2 files changed, 1 insertions(+), 88 deletions(-) [+]
line wrap: on
line diff
--- a/.plrc	Fri Aug 14 17:00:07 2015 +0100
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,87 +0,0 @@
-:- op(200,fy,@).
-
-:- dynamic persistent_history_file/1.
-persistent_history(H) :- persistent_history(H,60).
-persistent_history(H,Interval) :-
-   (  persistent_history_file(H) -> true
-   ;  persistent_history_file(H1) -> throw(persistent_history_mismatch(H1,H))
-   ;  debug(history,'Will use persistent history in "~s", saving every ~d seconds.',[H,Interval]),
-      prolog_history(disable),
-      (exists_file(H) -> rl_read_history(H); true),
-      assert(persistent_history_file(H)),
-      current_prolog_flag(os_argv,ARGV),
-      atomics_to_string(ARGV," ",Command),
-      history_event('Start: ~s',[Command]),
-      periodic_save_history(Interval),
-      at_halt(history_event('Halt',[]))
-   ).
-
-history_event(Msg,Args) :-
-   persistent_history_file(H),
-   get_time(Now),
-   format_time(string(Time),'%+',Now),
-   format(string(Info),Msg,Args),
-   format(atom(Line),'% ~w | ~s',[Time,Info]),
-   debug(history,'History event: ~s',[Line]),
-   rl_add_history(Line),
-   rl_write_history(H).
-
-
-periodic_save_history(Interval) :-
-   persistent_history_file(H),
-   debug(history,'Saving history to "~s"...',[H]),
-   rl_write_history(H),
-   alarm(Interval,periodic_save_history(Interval),_,[remove(true)]).
-
-colour_terminal :- 
-	stream_property(user_output, tty(true)),
-	getenv('TERM',Term),
-	member(Term,[xterm,screen,'screen-256color','xterm-256color','xterm-color']).
-
-:- dynamic http_proxy/3.
-
-get_http_proxy(Host,Port,basic(User,Pwd)) :-
-	getenv(use_proxy,yes),
-	getenv(http_proxy,Proxy),
-	% proxy looks like http://User:Password@Host:Port
-	atom_concat('http://',Proxy1,Proxy), % strip off protocol
-	split_atom(Proxy1,Auth,'@',HostPort),
-	split_atom(Auth,User,':',Pwd),
-	split_atom(HostPort,Host,':',APort),
-	atom_number(APort,Port).
-
-split_atom(Atom,Pre,Mid,Post) :-
-	sub_atom(Atom,LPre,_,LPost,Mid),
-	sub_atom(Atom,0,LPre,_,Pre),
-	sub_atom(Atom,_,LPost,0,Post).
-	
-internal_host(localhost).
-internal_host(Host) :- sub_atom(Host,_,_,0,'bl.uk').
-
-:- multifile http:open_options/2.
-http:open_options(Parts,[proxy(Host,Port),proxy_authorization(Auth)|Opts]) :-
-	http_proxy(Host,Port,Auth),
-	option(host(Target),Parts),
-	\+internal_host(Target),
-	debug(proxy,'Using HTTP proxy ~w:~w for ~w',[Host,Port,Target]),
-	debug(proxy,'Parts: ~w',[Parts]),
-	( option(scheme(https),Parts)
-	->	debug(proxy,'Using HTTPS',[]),
-		Opts=[cert_verify_hook(verify_certificate)]
-	;	Opts=[]
-	).
-
-verify_certificate(_,_,_,_,_) :- format(user_error,'Accepting certificate\n',[]).
-
-:- %persistent_history('.swipl_history'),
-	(colour_terminal -> load_files(library(ansi_term), [silent(true)]); true),
-	set_prolog_flag(prompt_alternatives_on, determinism),
-	set_prolog_flag(editor, '$EDITOR'),
-	load_files(library(url), [silent(true)]),
-	load_files(library(http/http_ssl_plugin), [silent(true)]),
-	(	get_http_proxy(Host,Port,Auth) 
-	->	assert(http_proxy(Host,Port,Auth))
-	;	true
-	).
-
-
--- a/.screenrc	Fri Aug 14 17:00:07 2015 +0100
+++ b/.screenrc	Fri Oct 02 00:47:54 2015 +0100
@@ -23,7 +23,7 @@
 bind _ resize max
 
 screen -t dml-edit 1 runin $HOME/src/hg/dml-cliopatria/cpack/dml  bash
-screen -t dml-run 0 runin $HOME/var/dml forever ./run.pl --prefix=/cp --after_load='dml:start_matlab,dml:start_r_server'
+screen -t dml-run 0 runin $HOME/var/dml forever ./run.pl --prefix=/cp --after_load='dml:start_matlab,dml:start_r_server,dml:initiate_bl_scraping(_)'
 screen -t cp-edit 2 runin $HOME/src/github/ClioPatria  bash
 screen -t scratch 3 runin $HOME bash
 screen -t ml-in   4 runin $HOME/var/dml tail -f matlab_in.log