OK, turing.

<- leave blank

Thu Feb 14 13:24:02 EST 2019

#!/bin/rc
window 0,0,161,117 stats -lmisce
window -r 32 130 1236 994
window -r 83 54 1273 948 'acme -l $home/acme.dump'
window -r 3 772 578 1023 'cat /dev/kprint'
window -r 3 241 105 643 winwatch


Thu Feb 14 08:39:08 EST 2019
diff -r 7bb53313aac9 sys/src/cmd/cifs/ChangeLog
--- a/sys/src/cmd/cifs/ChangeLog Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/cifs/ChangeLog Thu Feb 14 13:39:13 2019 -0500
@@ -271,7 +271,7 @@
 ----------------------------------------------------------------

 aquarela fails
- fixed server timestamp in negioate
+ fixed server timestamp in negotiate
	bodged support of GENERRIC_READ/WRITE/EXECUTE in smb_com_open
	added find_first+full_directory_info & find_next+full_directory_info
	added smb_com_write_andx
diff -r 7bb53313aac9 sys/src/cmd/cifs/main.c
--- a/sys/src/cmd/cifs/main.c Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/cifs/main.c Thu Feb 14 13:39:13 2019 -0500
@@ -1275,7 +1275,7 @@
	sysfatal("%s - cannot dial, %r\n", Host);
 connected:
	if(CIFSnegotiate(Sess, &svrtime, windom, sizeof windom, cname, sizeof
	cname) == -1)
- sysfatal("%s - cannot negioate common protocol, %r\n", Host);
+ sysfatal("%s - cannot negotiate common protocol, %r\n", Host);

 #ifndef DEBUG_MAC
	Sess->secmode &= ~SECMODE_SIGN_ENABLED;


Thu Feb 14 08:39:03 EST 2019
diff -r 7bb53313aac9 sys/lib/dist/cfg/plan9.ini
--- a/sys/lib/dist/cfg/plan9.ini Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/lib/dist/cfg/plan9.ini Thu Feb 14 13:39:07 2019 -0500
@@ -3,3 +3,4 @@
 mouseport=ask
 monitor=ask
 vgasize=ask
+bootfile=/386/9pc
diff -r 7bb53313aac9 sys/src/cmd/cifs/ChangeLog
--- a/sys/src/cmd/cifs/ChangeLog Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/cifs/ChangeLog Thu Feb 14 13:39:07 2019 -0500
@@ -271,7 +271,7 @@
 ----------------------------------------------------------------

 aquarela fails
- fixed server timestamp in negioate
+ fixed server timestamp in negotiate
	bodged support of GENERRIC_READ/WRITE/EXECUTE in smb_com_open
	added find_first+full_directory_info & find_next+full_directory_info
	added smb_com_write_andx
diff -r 7bb53313aac9 sys/src/cmd/cifs/main.c
--- a/sys/src/cmd/cifs/main.c Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/cifs/main.c Thu Feb 14 13:39:07 2019 -0500
@@ -1275,7 +1275,7 @@
	sysfatal("%s - cannot dial, %r\n", Host);
 connected:
	if(CIFSnegotiate(Sess, &svrtime, windom, sizeof windom, cname, sizeof
	cname) == -1)
- sysfatal("%s - cannot negioate common protocol, %r\n", Host);
+ sysfatal("%s - cannot negotiate common protocol, %r\n", Host);

 #ifndef DEBUG_MAC
	Sess->secmode &= ~SECMODE_SIGN_ENABLED;
diff -r 7bb53313aac9 sys/src/cmd/gs/amd64.h
--- a/sys/src/cmd/gs/amd64.h Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/gs/amd64.h Thu Feb 14 13:39:07 2019 -0500
@@ -33,13 +33,13 @@

	 /* ---------------- Cache sizes ---------------- */

-#define ARCH_CACHE1_SIZE 131072
-#define ARCH_CACHE2_SIZE 4194304
+#define ARCH_CACHE1_SIZE 8192
+#define ARCH_CACHE2_SIZE 32768

	 /* ---------------- Miscellaneous ---------------- */

 #define ARCH_IS_BIG_ENDIAN 0
-#define ARCH_PTRS_ARE_SIGNED 0
+#define ARCH_PTRS_ARE_SIGNED 1
 #define ARCH_FLOATS_ARE_IEEE 1
 #define ARCH_ARITH_RSHIFT 2
 #define ARCH_CAN_SHIFT_FULL_LONG 0
diff -r 7bb53313aac9 sys/src/cmd/mothra/mothra.c
--- a/sys/src/cmd/mothra/mothra.c Wed Feb 13 18:56:21 2019 +0100
+++ b/sys/src/cmd/mothra/mothra.c Thu Feb 14 13:39:07 2019 -0500
@@ -79,6 +79,8 @@
 Url *selection=0;
 int mothmode;
 int kickpipe[2];
+int history[NWWW];
+int histindex = 0;

 void docmd(Panel *, char *);
 void doprev(Panel *, int, int);
@@ -93,6 +95,7 @@
 char *buttons[]={
	"alt display",
	"moth mode",
+ "back",
	"snarf",
	"paste",
	"search",
@@ -556,6 +559,7 @@
	int i;
	new=www(index);
	if(new==current && (tag==0 || tag[0]==0)) return;
+ history[histindex] = index;
	if(current)
		current->yoffs=plgetpostextview(text);
	current=new;
@@ -685,6 +689,13 @@
		else
			message("Usage: j index");
		break;
+ case 'b':
+ hit3(3, 2);
+ break;
+ case 'f':
+ histindex = (histindex+1) % NWWW;
+ doprev(nil, 1, wwwtop-history[histindex]-1);
+ break;
	case 'm':
		mothon(current, !mothmode);
		break;
@@ -1054,6 +1065,7 @@
			}
			plinitlist(list, PACKN|FILLX, genwww, 8, doprev);
			if(defdisplay) pldraw(list, screen);
+ histindex = (histindex+1) % NWWW;
			setcurrent(i, selection->tag);
			break;
		case GIF:
@@ -1193,15 +1205,19 @@
		mothon(current, !mothmode);
		break;
	case 2:
+ histindex = (histindex-1) % NWWW;
+ doprev(nil, 1, wwwtop-history[histindex]-1);
+ break;
+ case 3:
		snarf(plkbfocus);
		break;
- case 3:
+ case 4:
		paste(plkbfocus);
		break;
- case 4:
+ case 5:
		search();
		break;
- case 5:
+ case 6:
		if(!selection){
			message("no url selected");
			break;
@@ -1221,11 +1237,11 @@
		fprint(fd, "<p><a href=\"%s\">%s</a>\n",
		urlstr(selection), urlstr(selection));
		close(fd);
		break;
- case 6:
+ case 7:
		snprint(name, sizeof(name), "file:%s/hit.html", mkhome());
		geturl(name, -1, 1, 0);
		break;
- case 7:
+ case 8:
		if(confirm(3))
			exits(0);
		break;


Wed Feb 13 22:28:47 EST 2019
Cyber Libel

Wed Feb 13 13:38:07 EST 2019
#!/usr/bin/env python3
"""Freeze detector"""

from time import sleep, time

tt = 0.01

print('Freeze detection started!')

while True:
    x = time()
    sleep(1)
    y = time()
    z = y - x
    a = z - 1
    if a > tt:
	print(
	    'Freeze detected; freeze duration: {} sec'.format(
		round(a, 3)))


Wed Feb 13 11:02:26 EST 2019
#!/bin/rc
# ux - unix execute
# ux [ user@host ] [cmd]
#
# Login to user@host over ssh(1) and run a cmd.
#
rfork e
cmd=''
insist=false
userhost=$ux
opts=()
while(!  ~ $#* 0 && ~ $1 -*){
	opts=($opts $1)
	shift
}
if(~ $1 *@*){
	userhost=$1
	insist=true
	shift
}
cmd=$*
cwd=`{pwd}
if(echo $cwd | grep -s /ux/'.*' && ~ $insist false){
	userhost=`{echo $cwd | sed 's#/ux/##; s#/.*##'}
	cdto=`{echo $cwd | sed 's#/ux/'$userhost'/?##'}
	if(!  ~ $#cmd 0 && ! ~ $#cdto 0){
		if(~ $userhost root@*)
			cmd=('cd /'$cdto';' $cmd)
		if not
			cmd=('cd '$cdto';' $cmd)
	}
}
ssh -r $opts $userhost $cmd


Wed Feb 13 10:46:09 EST 2019
if(isretarded)
{
	return 1;
}
else
{
	return 0;
}


Wed Feb 13 00:34:18 EST 2019
type expr = union
	`Add (expr#, expr#)
	`Mul (expr#, expr#)
	`Val int
;;

cosnt fold = {expr
	match expr
	| `Plus (`Val 0, x): -> fold(x)
	| `Plus (x, `Val 0): -> fold(x)
	| `Mul (`Val 0, `Val _): -> `Val 0
	| `Mul (`Val _, `Val 0): -> `Val 0
	| other: -> other
	;;
}

Roughly equivalent to....


enum {
	Add,
	Mul,
};

struct Expr {
	int op;
	union {
		struct {
			Expr *left;
			Expr *right;
		};
		int val;
	};
};

Expr fold(Expr *e){
	switch(op){
	case Plus:
		switch(e->left->op){
		case Val:
			if(e->left->val == 0)
				return e->right;
			break;
		default:
			switch(e->right->op){
			case Val:
				if(e->right->val == 0)
					return e->left;
				break;
			default:
				return e;
			}
	...


Wed Feb 13 00:27:00 EST 2019
const fold = {expr
match expr
| `Plus (`Val 0, x): -> fold(x)
| `Plus (`x, `Val 0): -> fold(x)
| `Mul (`Val 0, `Val _): -> `Val 0
| `Mul (`Val _, `Val 0): -> `Val 0
...
}

Wed Feb 13 00:18:37 EST 2019
enum {
	Ok,
	Err,
}

struct Result {
	int tag;
	union {
		Dir *dir;
		Err err;
	};
};

Result diropen(char *path);

Result tmp = diropen(path);
if(result.tag == Ok)
	printf("%D", result.dir)
else if(result.tag == Err)
	printf("%D", result.err)

Tue Feb 12 22:04:56 EST 2019
use std

const sequencer = {x : int
	-> std.fndup({
		-> x++
	})
}

const main = {
	var seq1 = sequencer(2)
	var seq2 = sequencer(42)
	std.put("{}\n", seq1()) // prints 2
	std.put("{}\n", seq1()) // prints 3
	std.put("{}\n", seq2()) // prints 42
	std.put("{}\n", seq2()) // prints 43
}

prev | next