2016 Update

This commit is contained in:
Tina Müller 2016-12-05 22:15:40 +01:00
parent 948b86eafa
commit dcf5d15da3
7965 changed files with 139854 additions and 31002 deletions

View file

@ -0,0 +1,83 @@
#!/usr/bin/osascript
-- format a number as a string with leading zero if needed
to format(aNumber)
set resultString to aNumber as text
if length of resultString < 2
set resultString to "0" & resultString
end if
return resultString
end format
-- join a list with a delimiter
to concatenation of aList given delimiter:aDelimiter
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to { aDelimiter }
set resultString to aList as text
set AppleScript's text item delimiters to tid
return resultString
end join
-- apply a handler to every item in a list, returning
-- a list of the results
to mapping of aList given function:aHandler
set resultList to {}
global h
set h to aHandler
repeat with anItem in aList
set resultList to resultList & h(anItem)
end repeat
return resultList
end mapping
-- return an ISO-8601-formatted string representing the current date and time
-- in UTC
to iso8601()
set { year:y, month:m, day:d, ¬
hours:hr, minutes:min, seconds:sec } to ¬
(current date) - (time to GMT)
set ymdList to the mapping of { y, m as integer, d } given function:format
set ymd to the concatenation of ymdList given delimiter:"-"
set hmsList to the mapping of { hr, min, sec } given function:format
set hms to the concatenation of hmsList given delimiter:":"
set dateTime to the concatenation of {ymd, hms} given delimiter:"T"
return dateTime & "Z"
end iso8601
to exists(filePath)
try
filePath as alias
return true
on error
return false
end try
end exists
on run argv
set curDir to (do shell script "pwd")
set notesFile to POSIX file (curDir & "/NOTES.TXT")
if (count argv) is 0 then
if exists(notesFile) then
set text item delimiters to {linefeed}
return paragraphs of (read notesFile) as text
else
log "No notes here."
return
end if
else
try
set fd to open for access notesFile with write permission
write (iso8601() & linefeed & tab) to fd starting at eof
set AppleScript's text item delimiters to {" "}
write ((argv as text) & linefeed) to fd starting at eof
close access fd
return true
on error errMsg number errNum
try
close access fd
end try
return "unable to open " & notesFile & ": " & errMsg
end try
end if
end run

View file

@ -0,0 +1,15 @@
defmodule Take_notes do
@filename "NOTES.TXT"
def main( [] ), do: display_notes
def main( arguments ), do: save_notes( arguments )
def display_notes, do: IO.puts File.read!(@filename)
def save_notes( arguments ) do
notes = "#{inspect :calendar.local_time}\n\t" <> Enum.join(arguments, " ")
File.open!(@filename, [:append], fn(file) -> IO.puts(file, notes) end)
end
end
Take_notes.main(System.argv)

View file

@ -1,15 +1,15 @@
/*REXX program implements the "NOTES" command (append text to a file).*/
timestamp=right(date(),11,0) time() date('W') /*create date/time stamp.*/
nFID = 'NOTES.TXT' /*the fileID of the "notes" file.*/
/*REXX program implements the "NOTES" command (append text to a file from the C.L.).*/
timestamp=right(date(),11,0) time() date('W') /*create a (current) date & time stamp.*/
nFID = 'NOTES.TXT' /*the fileID of the "notes" file. */
if 'f0'x==0 then tab='05'x /*this is an EBCDIC system. */
else tab='09'x /* " " " ASCII " */
if 'f2'x==2 then tab="05"x /*this is an EBCDIC system. */
else tab="09"x /* " " " ASCII " */
if arg()==0 then do while lines(nFID) /*No args? Then show the file. */
say linein(Nfid) /*show a line of file ──► screen.*/
if arg()==0 then do while lines(nFID) /*No arguments? Then display the file.*/
say linein(Nfid) /*display a line of file ──► screen. */
end /*while*/
else do
call lineout nFID,timestamp /*append the timestamp. */
call lineout nFID,tab||arg(1) /*append the "note" text*/
call lineout nFID,timestamp /*append the timestamp to "notes" file.*/
call lineout nFID,tab||arg(1) /* " " text " " " */
end
/*stick a fork in it, we're done.*/
/*stick a fork in it, we're all done. */