OK, turing.

<- leave blank

Wed Jan 16 05:43:35 EST 2019

sudo dnf install --nogpgcheck
https://download1.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E
%fedora).noarch.rpm
https://download1.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E
%fedora).noarch.rpm

Wed Jan 16 00:30:54 EST 2019
diff -r ad9d484cd0c7 commands.go
--- a/commands.go Tue Jan 15 19:53:46 2019 -0600
+++ b/commands.go Wed Jan 16 00:32:17 2019 -0700
@@ -1,6 +1,7 @@
 package main

 import (
+ "regexp"
	"strconv"
	"strings"
	"github.com/bwmarrin/discordgo"
@@ -12,6 +13,41 @@
		return line
	}
	switch line[:2] {
+ case "s/":
+ r := regexp.MustCompile(`s\/((\w|\s)+)\/((\w|\s|)+)\/`)
+ n := r.FindStringSubmatchIndex(line)
+ if len(n) < 1 {
+ return ""
+ }
+ msg := State.Messages
+ for i := len(msg)-1; i >= 0; i-- {
+ if (msg[i].ChannelID != State.Channel.ID && msg[i].GuildID != State.Guild.ID) {
+ break
+ }
+ if msg[i].Author.ID != Session.User.ID {
+ break
+ }
+ if strings.Contains(msg[i].Content, line[n[2]:n[3]]) {
+ cmd, err := regexp.Compile("(" + line[n[2]:n[3]] + ")")
+ if err != nil {
+ Msg(ErrorMsg, "%s - invalid regex\n", line)
+ }
+ rep := cmd.ReplaceAllString(msg[i].Content, "")
+ if len(line) == 5 {
+ rep = cmd.ReplaceAllString(msg[i].Content, line[n[4]:n[5]])
+ }
+ data := discordgo.NewMessageEdit(msg[i].ChannelID, msg[i].ID)
+ data = data.SetContent(rep)
+ _, err = State.Session.DiscordGo.ChannelMessageEditComplex(data)
+ if err != nil {
+ Msg(ErrorMsg, "%s\n", err)
+ return ""
+ }
+ Msg(TextMsg, "%s -> %s\n", msg[i].Content, rep)
+ return ""
+ }
+ }
+ return line
	case ":?":
		// Show help menu
		Msg(TextMsg, "Commands: ")


Tue Jan 15 23:25:27 EST 2019
diff -r a22f5c0ac3a9 commands.go
--- a/commands.go Wed Dec 26 16:28:08 2018 -0600
+++ b/commands.go Tue Jan 15 23:26:49 2019 -0700
@@ -1,6 +1,7 @@
 package main

 import (
+ "regexp"
	"strconv"
	"strings"
	"github.com/bwmarrin/discordgo"
@@ -12,6 +13,41 @@
		return line
	}
	switch line[:2] {
+ case "s/":
+ r := regexp.MustCompile(`s\/((\w|\s)+)\/((\w|\s|)+)\/`)
+ n := r.FindStringSubmatchIndex(line)
+ if len(n) < 1 {
+ return ""
+ }
+ msg := State.Messages
+ for i := len(msg)-1; i >= 0; i-- {
+ if (msg[i].ChannelID != State.Channel.ID && msg[i].GuildID != State.Guild.ID) {
+ break
+ }
+ if msg[i].Author.ID != Session.User.ID {
+ break
+ }
+ if strings.Contains(msg[i].Content, line[n[2]:n[3]]) {
+ cmd, err := regexp.Compile("(" + line[n[2]:n[3]] + ")")
+ if err != nil {
+ Msg(ErrorMsg, "%s - invalid regex\n", line)
+ }
+ rep := cmd.ReplaceAllString(msg[i].Content, "")
+ if len(line) == 5 {
+ rep = cmd.ReplaceAllString(msg[i].Content, line[n[4]:n[5]])
+ }
+ data := discordgo.NewMessageEdit(msg[i].ChannelID, msg[i].ID)
+ data = data.SetContent(rep)
+ _, err = State.Session.DiscordGo.ChannelMessageEditComplex(data)
+ if err != nil {
+ Msg(ErrorMsg, "%s\n", err)
+ return ""
+ }
+ Msg(TextMsg, "%s -> %s\n", msg[i].Content, rep)
+ return ""
+ }
+ }
+ return line
	case ":?":
		// Show help menu
		Msg(TextMsg, "Commands: ")
@@ -80,7 +116,7 @@
		Msg(InfoMsg, "Printing last %d messages!\n", Amount)
		State.RetrieveMessages(Amount)
		PrintMessages(Amount)
- return line
+ return ""
	case ":u":
		session := State.Session
		user := session.User
@@ -88,8 +124,10 @@
		_, err := State.Session.DiscordGo.UserUpdate(user.Email,
		session.Password, newName, user.Avatar, "")
		if err != nil {
			Msg(ErrorMsg, "[:u] Argument Error: %s\n", err)
+ return ""
		}
- return line
+ Msg(TextMsg, "name -> %s\n", newName)
+ return ""
	}
	return line
 }


Tue Jan 15 22:56:31 EST 2019
diff -r a22f5c0ac3a9 commands.go
--- a/commands.go Wed Dec 26 16:28:08 2018 -0600
+++ b/commands.go Tue Jan 15 22:57:52 2019 -0700
@@ -1,6 +1,7 @@
 package main

 import (
+ "regexp"
	"strconv"
	"strings"
	"github.com/bwmarrin/discordgo"
@@ -12,6 +13,38 @@
		return line
	}
	switch line[:2] {
+ case "s/":
+ r := regexp.MustCompile(`s\/(\w+)\/(\w+)\/`)
+ n := r.FindStringSubmatchIndex(line)
+ if len(n) < 1 {
+ return ""
+ }
+ msg := State.Messages
+ for i := len(msg)-1; i >= 0; i-- {
+ if (msg[i].ChannelID != State.Channel.ID && msg[i].GuildID != State.Guild.ID) {
+ break
+ }
+ if msg[i].Author.ID != Session.User.ID {
+ break
+ }
+ if strings.Contains(msg[i].Content, line[n[2]:n[3]]) {
+ cmd, err := regexp.Compile("(" + line[n[2]:n[3]] + ")")
+ if err != nil {
+ Msg(ErrorMsg, "%s - invalid regex\n", line)
+ }
+ rep := cmd.ReplaceAllString(msg[i].Content, line[n[4]:n[5]])
+ data := discordgo.NewMessageEdit(msg[i].ChannelID, msg[i].ID)
+ data = data.SetContent(rep)
+ _, err = State.Session.DiscordGo.ChannelMessageEditComplex(data)
+ if err != nil {
+ Msg(ErrorMsg, "%s\n", err)
+ return ""
+ }
+ Msg(TextMsg, "%s -> %s\n", msg[i].Content, rep)
+ return ""
+ }
+ }
+ return line
	case ":?":
		// Show help menu
		Msg(TextMsg, "Commands: ")
@@ -80,7 +113,7 @@
		Msg(InfoMsg, "Printing last %d messages!\n", Amount)
		State.RetrieveMessages(Amount)
		PrintMessages(Amount)
- return line
+ return ""
	case ":u":
		session := State.Session
		user := session.User
@@ -88,8 +121,10 @@
		_, err := State.Session.DiscordGo.UserUpdate(user.Email,
		session.Password, newName, user.Avatar, "")
		if err != nil {
			Msg(ErrorMsg, "[:u] Argument Error: %s\n", err)
+ return ""
		}
- return line
+ Msg(TextMsg, "name -> %s\n", newName)
+ return ""
	}
	return line
 }


Tue Jan 15 15:06:16 EST 2019
#!/bin/rc
# man - print manual pages
rfork e

. /sys/man/fonts

out=cat
search=yes
fpath=no
cmd=n
sec=()
files=()
done=no

fn usage {
	echo 'Usage: man [-bfnpPStw] [section ...] title ...' >[1=2]
	exit
}

fn roff {
	preproc=()
	postproc=cat
	opts=-Tutf
	x=`{doctype $2}
	if (~ $1 t){
		for(p in grap pic)
			if(~ $x *^$p^*) preproc=($preproc $p)
	}
	if not{
		opts='-N -rL1000i'
		if (grep -s '^\.(2C|sp *[0-9]*\.)' $2)
			postproc=col
	}
	for(p in eqn tbl)
		if(~ $x *^$p^*) preproc=($preproc $p)
	preproc=`{echo $preproc | sed 's/ /|/g'}
	if(~ $#preproc 0)
		preproc=cat
	cat /env/FONTS $2 | eval $preproc | troff $opts -$MAN | $postproc
}

fn doman {
	cmd=$1; shift
	for(i){
		switch($cmd){
		case w
			echo $i
		case t
			roff t $i
		case p
			roff t $i | grep -v '^x X html'
		case P
			roff t $i
		case n
			roff n $i | sed '
				${
				       /^$/p
				}
				//N
				/^\n$/D'
		case b
			x=`{echo $i | sed 's;/sys/man/(.*)/(.*);\1 \2;'}
			if(~ $x(2) 0intro) x=($x(1) intro)
			roff n $i | sed '
				${
				       /^$/p
				}
				//N
				/^\n$/D' |
			plumb -i -d edit -a 'action=showdata
			filename=/man/'$x(2)^'('$x(1)^')'
		}
	} | $out
}

done=no
while(~ $done no){
	if(~ $#* 0) usage
	if(test -d /sys/man/$1){
		sec=($sec $1)
		shift
	}
	if not
		switch($1){
		case -b ; cmd=b ; shift
		case -f ; fpath=yes ; shift
		case -n ; cmd=n ; shift
		case -P ; cmd=P ; out=page ; shift
		case -p ; cmd=p ; out=proof ; shift
		case -S ; search=no ; shift
		case -t ; cmd=t ; shift
		case -w ; cmd=w ; shift
		case * ; done=yes
		}
}
if(~ $#* 0) usage

if(~ $fpath yes){
	doman $cmd $*
	exit
}
if(~ $#sec 0)
	sec=`{ls -pd /sys/man/[0-9]*}
if(~ $search yes){
	pat='^('^`{echo $* | sed 's/ /|/g'}^') '
	for(i in /sys/man/$sec)
		if(/bin/test -f $i/INDEX){
			try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //' | sort -u}
			if(!  ~ $#try 0)
				files=($files $i/$try)
		}
}
if(~ $#files 0)
	for(i){
		if(~ $i intro) i=0intro
		for(n in $sec){
			try=`{echo /sys/man/$n/$i | tr A-Z a-z}
			if (/bin/test -f $try)
				files=($files $try)
		}
	}
if(~ $#files 0){
	echo 'man: no manual page' >[1=2]
	exit 'no man'
}
doman $cmd $files


Tue Jan 15 15:03:11 EST 2019
#!/bin/rc
# man - print manual pages
rfork e

. /sys/man/fonts

out=cat
search=yes
fpath=no
cmd=n
sec=()
files=()
done=no

fn usage {
	echo 'Usage: man [-bfnpPStw] [section ...] title ...' >[1=2]
	exit
}

fn roff {
	preproc=()
	postproc=cat
	opts=-Tutf
	x=`{doctype $2}
	if (~ $1 t)
		for(p in grap pic)
			if(~ $x *^$p^*) preproc=($preproc $p)
	if not{
		opts='-N -rL1000i'
		if (grep -s '^\.(2C|sp *[0-9]*\.)' $2)
			postproc=col
	}
	for(p in eqn tbl)
		if(~ $x *^$p^*) preproc=($preproc $p)
	preproc=`{echo $preproc | sed 's/ /|/g'}
	if(~ $#preproc 0)
		preproc=cat
	cat /env/FONTS $2 | eval $preproc | troff $opts -$MAN | $postproc
}

fn doman {
	cmd=$1; shift
	for(i){
		switch($cmd){
		case w
			echo $i
		case t
			roff t $i
		case p
			roff t $i | grep -v '^x X html'
		case P
			roff t $i
		case n
			roff n $i | sed '
				${
				       /^$/p
				}
				//N
				/^\n$/D'
		case b
			x=`{echo $i | sed 's;/sys/man/(.*)/(.*);\1 \2;'}
			if(~ $x(2) 0intro) x=($x(1) intro)
			roff n $i | sed '
				${
				       /^$/p
				}
				//N
				/^\n$/D' |
			plumb -i -d edit -a 'action=showdata
			filename=/man/'$x(2)^'('$x(1)^')'
		}
	} | $out
}

done=no
while(~ $done no){
	if(~ $#* 0) usage
	if(test -d /sys/man/$1){
		sec=($sec $1)
		shift
	}
	if not
		switch($1){
		case -b ; cmd=b ; shift
		case -f ; fpath=yes ; shift
		case -n ; cmd=n ; shift
		case -P ; cmd=P ; out=page ; shift
		case -p ; cmd=p ; out=proof ; shift
		case -S ; search=no ; shift
		case -t ; cmd=t ; shift
		case -w ; cmd=w ; shift
		case * ; done=yes
		}
}
if(~ $#* 0) usage

if(~ $fpath yes){
	doman $cmd $*
	exit
}
if(~ $#sec 0)
	sec=`{ls -pd /sys/man/[0-9]*}
if(~ $search yes){
	pat='^('^`{echo $* | sed 's/ /|/g'}^') '
	for(i in /sys/man/$sec)
		if(/bin/test -f $i/INDEX){
			try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //' | sort -u}
			if(!  ~ $#try 0)
				files=($files $i/$try)
		}
}
if(~ $#files 0)
	for(i){
		if(~ $i intro) i=0intro
		for(n in $sec){
			try=`{echo /sys/man/$n/$i | tr A-Z a-z}
			if (/bin/test -f $try)
				files=($files $try)
		}
	}
if(~ $#files 0){
	echo 'man: no manual page' >[1=2]
	exit 'no man'
}
doman $cmd $files


Tue Jan 15 11:05:16 EST 2019
a2sdi# memory
no memory for allocb
no memory for sdbio
no memory for allocb


Tue Jan 15 11:04:13 EST 2019
no memory for allocb

a2sdi# no memory for allocb
no memory for sdbio
no memory for sdbio
no memory for sdbio


Mon Jan 14 15:48:15 EST 2019
diff --git a/rc/bin/man b/rc/bin/man
--- a/rc/bin/man
+++ b/rc/bin/man
@@ -57,6 +57,7 @@ fn page {


 search=yes
+fpath=no
 while(~ $d 0) {
	if(~ $#* 0) {
		echo 'Usage: man [-bntpPSw] [0-9] [0-9] ...  name1 name2 ...'
		>[1=2]
@@ -69,6 +70,7 @@ while(~ $d 0) {
	if not
		switch($1) {
		case -b ; cmd=b ; shift
+ case -f ; fpath=yes ; shift
		case -n ; cmd=n ; shift
		case -P ; cmd=P ; shift
		case -p ; cmd=p ; shift
@@ -85,7 +87,7 @@ ix=$S/$sec/INDEX
 if(~ $#* 1) pat='^'^$1^' '
 if not pat='^('^`{echo $* | sed 's/ /|/g'}^') '
 fils=()
-if(~ $search yes)
+if(~ $search yes && ~ $fpath no)
 for(i in $S/$sec){
	if(/bin/test -f $i/INDEX){
		try=`{grep -i $pat $i/INDEX | sed 's/^[^ ]* //' | sort -u}
@@ -94,7 +96,7 @@ for(i in $S/$sec){
	}
 }
 # bug: should also do following loop if not all pages found
-if(~ $#fils 0) {
+if(~ $#fils 0 && ~ $fpath no) {
	# nothing in INDEX.  try for file of given name
	for(i) {
		if(~ $i intro) i=0intro
@@ -104,10 +106,14 @@ if(~ $#fils 0) {
				fils=($fils $try)
		}
	}
- if(~ $#fils 0) {
- echo 'man: no manual page' >[1=2]
- exit 'no man'
- }
+}
+if(~ $fpath yes)
+ for(i)
+ if(/bin/test -f $i)
+ fils=($fils $i)
+if(~ $#fils 0) {
+ echo 'man: no manual page' >[1=2]
+ exit 'no man'
 }
 switch($cmd) {
 case p; out=proof


Mon Jan 14 10:35:01 EST 2019
private String getData(String continent, String param) {
	DownloadListTask countryTask = new DownloadListTask(){
	    @Override
	    protected void onPostExecute(String result) {
		super.onPostExecute(result);
		showData(convertData(result));
	    }
	};
	countryTask.execute(getString(R.string.baseUrl), "region", continent,
	param);
	return null;
    }

Mon Jan 14 10:25:13 EST 2019
 private void fillList() {
	listView = findViewById(R.id.listView);
	ListAdapter listAdapter = new ListAdapter() {

	    @Override
	    public void registerDataSetObserver(DataSetObserver observer) {

	    }

	    @Override
	    public void unregisterDataSetObserver(DataSetObserver observer) {

	    }

	    @Override
	    public int getCount() {
		Log.d(TAG, "getCount called.  jsonArray.length() = " +
		jsonArray.length());
		return jsonArray.length();
	    }

	    @Override
	    public Object getItem(int position) {
		Log.d(TAG, "getItem called with " + position);
		try {
		    return jsonArray.get(position);
		} catch (JSONException e) {
		    return null;
		}
	    }

	    @Override
	    public long getItemId(int position) {
		try {
		    return jsonArray.getJSONObject(position).getLong("id");
		} catch (JSONException e) {
		    e.printStackTrace();
		    return -1;
		}
	    }

	    @Override
	    public boolean hasStableIds() {
		return true;
	    }

	    @Override
	    public View getView(int position, View convertView, ViewGroup parent)
	    {
		View view = convertView;
		if (view == null) {
		    view = getLayoutInflater().inflate(R.layout.cell, parent,
		    false);
		}
		TextView left = view.findViewById(R.id.cell);
		left.setText(String.format("zelle %d", position));

		view.setOnClickListener(listener);
		view.setTag(position);
		return view;
	    }

	    @Override
	    public int getItemViewType(int position) {
		return 0;
	    }

	    @Override
	    public int getViewTypeCount() {
		return 1;
	    }

	    @Override
	    public boolean isEmpty() {
		Log.d(TAG, "isEmpty called.  jsonArray.length() = " +
		jsonArray.length());
		return jsonArray == null || jsonArray.length() == 0;
	    }

	    @Override
	    public boolean areAllItemsEnabled() {
		return true;
	    }

	    @Override
	    public boolean isEnabled(int position) {
		return true;
	    }
	};
	listView.setAdapter(listAdapter);

next