-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
315 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
var LambdaMOOProcess = { | ||
conn: null, | ||
|
||
init: function(terminal) { | ||
this.conn = new WebSocket("ws://existencia.org:8080/"); | ||
this.conn.onopen = function(e) { | ||
terminal.print("Connection established!"); | ||
window.setTimeout(function() { | ||
LambdaMOOProcess.conn.send("CO guest nopass"); | ||
window.setInterval(function() { | ||
LambdaMOOProcess.conn.send("_/_"); | ||
}, 1000); | ||
}, 500); | ||
}; | ||
this.conn.onmessage = function(e) { | ||
terminal.print(e.data); | ||
}; | ||
}, | ||
|
||
config: { | ||
prompt: '>> ', | ||
}, | ||
|
||
handle: function(terminal, content) { | ||
this.conn.send(content); | ||
} | ||
}; | ||
|
||
Terminal.processCatalog['l'] = LambdaMOOProcess; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
ShellProcess.commands['arch'] = function(terminal) { | ||
var sources = ['laptop', 'backups', 'pics', 'cards', 'projects', 'existencia', 'blogs', 'contacts', 'email', 'folders']; | ||
var index = Math.floor(Math.random() * sources.length); | ||
terminal.print("Revisit something in " + sources[index] + '.'); | ||
}; | ||
|
||
ShellProcess.commands['ts'] = function(terminal) { | ||
var args = Array.prototype.slice.call(arguments); | ||
|
||
urlargs = { | ||
pass: terminal.supass, | ||
op: args[1] | ||
}; | ||
for (var ii = 2; ii < args.length; ii++) { | ||
if (args[ii].match(/\d/) && args[ii].match(/^\d*\.?\d*$/)) { | ||
urlargs['dur'] = args[ii]; | ||
terminal.print("Duration: " + args[ii]); | ||
} | ||
else if (args[ii].match(/^\d\d:\d\d$/)) { | ||
urlargs['start'] = args[ii]; | ||
terminal.print("Start: " + args[ii]); | ||
} | ||
else | ||
urlargs['task'] = args[ii]; | ||
} | ||
|
||
$.post("time.php", urlargs, function(result) { | ||
terminal.print(result); | ||
}); | ||
}; | ||
|
||
ShellProcess.commands['post'] = function(terminal) { | ||
var args = Array.prototype.slice.call(arguments); | ||
args.shift(); // terminal | ||
category = args.shift(); | ||
if (args.length > 0) | ||
doPost(terminal, category, args.join(' ')); | ||
else { | ||
gettext(terminal, 'post> ', function(allcontent) { | ||
doPost(terminal, category, allcontent); | ||
}); | ||
} | ||
}; | ||
|
||
function doPost(terminal, category, content) { | ||
terminal.setWorking(true); | ||
$.post("post.php", { | ||
category: category, | ||
content: content, | ||
pass: terminal.supass | ||
}, function(result) { | ||
terminal.print(result); | ||
terminal.setWorking(false); | ||
}); | ||
} | ||
|
||
// Entertain me! | ||
ShellProcess.commands['ent'] = function(terminal) { | ||
terminal.setWorking(true); | ||
$.get("entertain.php", { | ||
pass: terminal.supass | ||
}, function(result) { | ||
terminal.print(result); | ||
terminal.setWorking(false); | ||
}); | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php | ||
require_once('/home/jrising/common/base.php'); | ||
require_once(comdir("sql/dbfuncs.php")); | ||
|
||
if ($_POST['pass'] != 'qhww0c') { | ||
echo "Password failure."; | ||
exit(0); | ||
} | ||
|
||
// Try sinfest | ||
$rss = simplexml_load_file("http://existencia.org/feeds/comics/sinfest.pl"); | ||
|
||
for ($rss->channel->item as $item) { | ||
$row = dbgetrow("select id from glanced where source = 'sinfest' and link = %s", $item->link); | ||
if (!$row) { | ||
dbquery("insert into glanced (source, link) values ('sinfest', %s)", $link); | ||
echo $item->description; | ||
exit(); | ||
} | ||
} | ||
|
||
echo "Entertain yourself!"; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
require_once('/home/jrising/common/base.php'); | ||
require_once(comdir("sql/dbfuncs.php")); | ||
|
||
$dbc = dbconnect("memoir", "ignore"); | ||
|
||
$rows = dbgetarray("select id, task, UNIX_TIMESTAMP(time_start), duration_hours - adjusted_hours, UNIX_TIMESTAMP(last_updated) from times"); | ||
|
||
$ical = "BEGIN:VCALENDAR | ||
VERSION:2.0 | ||
PRODID:-//hacksw/handcal//NONSGML v1.0//EN | ||
"; | ||
|
||
foreach ($rows as $row) { | ||
if (!$row[3]) | ||
continue; | ||
$ical .= | ||
"BEGIN:VEVENT | ||
UID:memoir-times-" . md5($row[0]) . "@existencia.org | ||
DTSTAMP:" . gmdate('Ymd', $row[4]).'T'. gmdate('His', $row[4]) . "Z | ||
DTSTART:" . gmdate('Ymd', $row[2]).'T'. gmdate('His', $row[2]) . "Z | ||
DTEND:" . gmdate('Ymd', $row[2] + $row[3]*3600).'T'. gmdate('His', $row[2] + $row[3]*3600) . "Z | ||
SUMMARY:" . $row[1] . " | ||
END:VEVENT | ||
"; | ||
} | ||
|
||
$ical .= " | ||
END:VCALENDAR"; | ||
|
||
//set correct content-type-header | ||
header('Content-type: text/calendar; charset=utf-8'); | ||
header('Content-Disposition: inline; filename=calendar.ics'); | ||
echo $ical; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php | ||
require_once('/home/jrising/common/base.php'); | ||
require_once(comdir("sql/dbfuncs.php")); | ||
|
||
if ($_POST['pass'] != 'qhww0c') { | ||
echo "Password failure."; | ||
exit(0); | ||
} | ||
|
||
$dbc = dbconnect("memoir", "ignore"); | ||
dbquery("insert into entries (content, category) values (%s, %s)", $_POST['content'], $_POST['category']); | ||
echo "Posted."; | ||
|
||
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?php | ||
require_once('/home/jrising/common/base.php'); | ||
require_once(comdir("sql/dbfuncs.php")); | ||
|
||
$args = array_merge($_POST, $_GET); | ||
|
||
if ($args['pass'] != 'qhww0c') { | ||
echo "Password failure."; | ||
exit(0); | ||
} | ||
|
||
$dbc = dbconnect("memoir", "ignore"); | ||
|
||
if ($args['op'] == 'register') { | ||
$process_id = dbquery("insert into processes (server, name) values (%s, %s)", $args['server'], $args['name']); | ||
echo $process_id; | ||
} else if ($args['op'] == 'update') { | ||
dbquery("update processes set message = %s, type = %s where id == %d", $args['message'], $args['type'], $args['id']); | ||
if ($args['type'] == 'done') | ||
dbquery("delete from processes where process_id = %d", $args['id']); | ||
} else if ($args['op'] == 'notify') { | ||
dbquery("insert into process_logs (process_id, message, type) values (%d, %s, %s)", $args['id'], $args['message'], $args['type']); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
<?php | ||
require_once('/home/jrising/common/base.php'); | ||
require_once(comdir("sql/dbfuncs.php")); | ||
|
||
$args = array_merge($_POST, $_GET); | ||
|
||
if ($args['pass'] != 'qhww0c') { | ||
echo "Password failure."; | ||
exit(0); | ||
} | ||
|
||
$dbc = dbconnect("memoir", "ignore"); | ||
|
||
if ($args['start']) { | ||
if (!strpos($args['start'], ' ')) | ||
$args['start'] = date('Y-m-d ') . $args['start']; | ||
} | ||
|
||
if ($args['op'] == 'a') { | ||
// Check what's active | ||
$row = dbgetrow("select task, time_start, adjusted_hours from times where time_start is not null and duration_hours is null"); | ||
if ($row) { | ||
if ($row[2] > 0) | ||
echo "Active: " . $row[0] . ": " . $row[1] . " (-" . $row[2] . ") -"; | ||
else | ||
echo "Active: " . $row[0] . ": " . $row[1] . " -"; | ||
} else { | ||
echo "None active."; | ||
} | ||
} else if ($args['op'] == 'd') { | ||
// How much time have we spent on what in the last 24 hours? | ||
$row = dbgetarray("select task, time_start, duration_hours - adjusted_hours from times where time_start is not null and to_days(time_start) == to_days(now)"); | ||
print_r($row); | ||
} else if ($args['op'] == '/') { | ||
// start, stop, or swap | ||
if ($args['start']) | ||
dbquery("update times set duration_hours = timestampdiff(minute, time_start, %s) / 60 where time_start is not null and duration_hours is null", $args['start']); | ||
else | ||
dbquery("update times set duration_hours = timestampdiff(minute, time_start, now()) / 60 where time_start is not null and duration_hours is null"); | ||
$had_active = mysql_affected_rows(); | ||
if ($args['task']) { | ||
if ($args['start']) | ||
dbquery("insert into times (task, time_start) values (%s, %s)", $args['task'], $args['start']); | ||
else | ||
dbquery("insert into times (task, time_start) values (%s, now())", $args['task']); | ||
|
||
if ($had_active > 0) | ||
echo "Task swapped."; | ||
else | ||
echo "Task started."; | ||
} else | ||
echo "Task ended."; | ||
} else if ($args['op'] == '-') { | ||
// always duration; may have task and start | ||
dbquery("update times set adjusted_hours = adjusted_hours + %f where time_start is not null and duration_hours is null", $args['dur']); | ||
$had_active = mysql_affected_rows(); | ||
if ($args['task']) { | ||
if ($args['start']) { | ||
dbquery("insert into times (task, time_start, duration_hours) values (%s, %s, %f)", $args['task'], $args['start'], $args['dur']); | ||
if ($had_active) | ||
echo "Added timed task within active task."; | ||
else | ||
echo "Added timed task."; | ||
} else { | ||
dbquery("insert into times (task, duration_hours) values (%s, %f)", $args['task'], $args['dur']); | ||
if ($had_active) | ||
echo "Added interval within active task."; | ||
else | ||
echo "Added interval."; | ||
} | ||
} else { | ||
if ($had_active) | ||
echo "Added break."; | ||
else | ||
echo "Nothing to break from."; | ||
} | ||
} |