List of my CGCC Meta posts as user100411

23942 24001 24042 24043 24045 20913 22022 22181 22424 23585 23714

23942

Implement Unix Timestamp to Daytime

Given an unsigned integer that represents a timestamp since 1970/01/01 00:00:00 (which is Unix epoch time), output one of these to represent the daytime in GMT timezone:

Rules

Examples of bad answers

Test cases

0
-> 1970/01/01 00:00:00
999999999
-> 2001/09/09 01:46:39
1145141919
-> 2006/04/15 22:58:39
1330500000
-> 2012/02/29 07:20:00
1633773293
-> 2021/10/09 09:54:53
2147483647
-> 2038/01/19 03:14:07

Hint

Here are implementations:

Related problems

Meta

24001

What is the maximum value generated by interleaving?

INTERCAL has an interleave operator which does the following operation. Let left operand be asdf and right one qwer in binary, respectively. The operation produces a binary value aqswdefr.

INTERCAL internally treats data as unsigned integers, so the value of the eight-bit value represents 0 to 255 in decimal, inclusively.

If one operand has fewer bits than the other, the fewer one gets padded with zero before operation. So, asd interleaving with qwer is equal to 0asd interleaving with qwer, which is 0qawsedr: it represents 0 to 127 in decimal.

Also, INTERCAL has an extension that handles any bases. Let's assume if 3-base numbers are handled. If each operand has 1 and 3 digits respectively, the maximum value for each operand is represented as 2 and 222 in 3-base number, respectively. Interleaving them results in 020222, which is 188 in decimal.

Task

Given an input of three unsigned integers, output the largest possible value generated by interleaving. The three integers are: number of digits for left operand, number of digits for right operand, and in what base those operands are described with.

Restrictions

Rules

Test cases

TODO.

meta

24042

I have posted this golfing tip for Bash before:

In Pure Bash (or any other pure shellscript), use . for looping.

It's a tip that recomments using a file whose the program has. I have ever posted these answers that uses the tip:

But I have thought that these situations can be thought:

What assumptions must be given for such programs?

24043

Convert codepoint to UTF-1

24045

Implement every dirname (1p)

Implement the dirname utility from scratch. It can be either a program or a fucntion. Assume input string satisfies these constraints:

The dirname utility, however, has two kinds of implementations. This is because some POSIX systems treat //foo/bar differently from /foo/bar. So in this challenge, you must output every possible outputs, in any order. They can be duplicated.

Here is the algorithm to implement the utility, provided string to be input:

  1. If string is //, skip steps 2 to 5.
  2. If string consists entirely of <slash> characters, string shall be set to a single <slash> character. In this case, skip steps 3 to 8.
  3. If there are any trailing <slash> characters in string, they shall be removed.
  4. If there are no <slash> characters remaining in string, string shall be set to a single <period> character. In this case, skip steps 5 to 8.
  5. If there are any trailing non- <slash> characters in string, they shall be removed.
  6. If the remaining string is //, it is implementation-defined whether steps 7 and 8 are skipped or processed.
  7. If there are any trailing <slash> characters in string, they shall be removed.
  8. If the remaining string is empty, string shall be set to a single <slash> character.

The final string is the output.

Standard I/O rules apply. Standard Loopholes apply. No builtins or libraries that does exactly same functionality. Shortest code wins.

Examples

Some examples are taken from POSIX explaination of basename().

* means an empty string. 1st column is input and 2nd and 3rd are possible outputs.

usr               .
usr/              .
*                 .
..                .
../               .
/                 /
//                /          //
///               /
/usr/             /
//usr/            /          //
///usr/           /
/usr/lib          /usr
//usr//lib//      //usr
/home//dwc//test  /home//dwc

Meta

20913

I am a Pxem user; I have answered some in Pxem. Since tio.run does not provide Pxem, I am posting online demo, with my interpreter, like this.

The problem is: code for the interpreter is long; so does the url. I have never been critized about that, but would I mind you if I keep submitting so?

22022

Non-Hamming numbers

22181

Solve the halting problem for ^/a*b*/b*a*/[ab]*$ in ///

///, a.k.a. Slashes is an esoteric programming language with simple two operations. One is to output its source to remove from it. The other is to substitute itself. The language is proven to be Turing-complete, so some programs such as /ab/bbaa/aab won't halt while some such as /ab/bbaa/ab will.

At first I questioned if halting problem for ^/[ab]*/[ab]*/[ab]*$ is solvable, but I learned unlikely.

So I am simplying to ^/a*b*/b*a*/[ab]*$.

Problem

Given a slashes program that matches ^/a*b*/b*a*/[ab]*$ in POSIX BRE (i.e. below), determine whether the program halts or not.

Format of program, if you are not familiar with POSIX BRE

program = "/" first "/" second "/" third
first = "" | first "a" | first first.b
first.b = "" | first.b "b"
second = "" | second "b" | second second.a
second.a = "" | second.a "a"
third = "" | third "a" | third "b"

Constrains

In this problem every program's length is up to 153.

Detailed rules

Examples

Testcase generator 1

My noncompetive solution

///: no
/a//: yes
/ab/bba/aab: yes
/ab/bba/aaab: yes
/ab/bba/aabb: no

Meta

22424

My quine in Pxem was criticised as not being a quine, as they output their filenames, not the content of those files. A Pxem program is represented as a pair of a filename and content of file.

So far I have submitted three versions of quines; one requires content of file to be empty; the other two do not. Are these valid quines per our site rules?

Should I consider resubmitting as distinct notation such as esolang-box who represents a Pxem program as a string?

23585

Convert codepoint to UTF-9

23714

Custom Rows of Smileys Triangle