September 2017 Update

This commit is contained in:
Ingy döt Net 2017-09-23 10:01:46 +02:00
parent bba7bfd280
commit ba8067c3b7
14570 changed files with 153136 additions and 63871 deletions

View file

@ -0,0 +1,22 @@
(defparameter *notes* "NOTES.TXT")
(defun format-date-time (stream)
(multiple-value-bind (second minute hour date month year) (get-decoded-time)
(format stream "~D-~2,'0D-~2,'0D ~2,'0D:~2,'0D:~2,'0D"
year month date hour minute second)))
(defun notes (args)
(if args
(with-open-file (s *notes* :direction :output
:if-exists :append
:if-does-not-exist :create)
(format-date-time s)
(format s "~&~A~{~A~^ ~}~%" #\Tab args))
(with-open-file (s *notes* :if-does-not-exist nil)
(when s
(loop for line = (read-line s nil)
while line
do (write-line line))))))
(defun main ()
(notes (uiop:command-line-arguments)))

View file

@ -0,0 +1,23 @@
'Note that the 1st item in 'Args' is the file name as on the command line './CLIOnly.gambas'
Public Sub Main()
Dim sContents As String 'To store the file contents
Dim sArgs As String[] = Args.All 'To store all the Command line Arguments
If Not Exist(User.home &/ "NOTES.TXT") Then 'If NOTES.TXT doesn't already exist in the current directory then..
File.Save(User.home &/ "NOTES.TXT", "") 'a new NOTES.TXT file should be created.
Print "New file 'NOTES.TXT' created." 'A meassge
Endif
sContents = File.Load(User.home &/ "NOTES.TXT") 'Get the contents of the file
If Args.count < 2 Then 'If NOTES has arguments (other than the file name)
Print sContents 'Print the file contents
Else
sContents &= Format(Now, "dddd dd mmmm, yyyy, hh:nn:ss") & gb.NewLine & 'The current date and time are appended to the local NOTES.TXT followed by a newline and..
gb.Tab & sArgs.Join(" ") & gb.NewLine 'Then all the arguments, joined with spaces, prepended with a tab, and appended with a trailing newline
Print sContents 'Displays the current contents of the local NOTES.TXT
File.Save(User.home &/ "NOTES.TXT", sContents) 'Write contents to NOTES.TXT
Endif
End

View file

@ -1,15 +1,12 @@
import sys, datetime, shutil
#sys.argv[1:] = 'go for it'.split()
if len(sys.argv) == 1:
try:
f = open('notes.txt', 'r')
shutil.copyfileobj(f, sys.stdout)
f.close()
with open('notes.txt', 'r') as f:
shutil.copyfileobj(f, sys.stdout)
except IOError:
pass
else:
f = open('notes.txt', 'a')
f.write(datetime.datetime.now().isoformat() + '\n')
f.write("\t%s\n" % ' '.join(sys.argv[1:]))
f.close()
with open('notes.txt', 'a') as f:
f.write(datetime.datetime.now().isoformat() + '\n')
f.write("\t%s\n" % ' '.join(sys.argv[1:]))

View file

@ -1,4 +1,4 @@
#!/bin/env racket
#!/usr/bin/env racket
#lang racket
(define file "NOTES.TXT")
(require racket/date)

View file

@ -1,9 +1,10 @@
var file = %f'notes.txt';
var file = %f'notes.txt'
if (ARGV.len > 0) {
var fh = file.open_a;
fh.say(Time.local.ctime + "\n\t" + ARGV.join(" "));
fh.close;
var fh = file.open_a
fh.say(Time.local.ctime + "\n\t" + ARGV.join(" "))
fh.close
} else {
file.open_r.each { .print };
var fh = file.open_r
fh && fh.each { .say }
}

View file

@ -0,0 +1,9 @@
const notesName="NOTES.TXT";
args:=vm.arglist;
if (not args)
{ try{ File(notesName).read(*).text.print(); } catch{println("no file")} }
else{
f:=File(notesName,"a+");
f.writeln(Time.Date.ctime(),"\n\t",args.concat(" "));
f.close();
}