import os
import re
import shutil

class Item:

    def __init__(self, path, index, no_name):
        self.path = path
        self.index = index
        self.no_name = no_name
        self.next = None

    def __str__(self):
        return str(self.index) + "\t" + self.path

    def __len__(self):
        ii = 0
        current = self
        while current != None:
            ii += 1
            current = current.next
        return ii

    def insert(self, path, index=None):
        head = self
        previous = head.advance_to_index_predecessor(index)
        if index == None:
            index = previous.index + 1
        item = Item(path, index, self.no_name)
        if previous != None:
            item.next = previous.next
            previous.next = item
        else:
            item.next = head
            head = item
        item.increase_indices()
        return head

    def advance_to_index_predecessor(self, index=None):
        previous = None
        current = self
        while current != None:
            if index != None and current.index >= index:
                break
            previous = current
            current = current.next
        return previous

    def increase_indices(self):
        current = self.next
        previous_index = self.index
        while current != None and current.index == previous_index:
            current.index += 1
            previous_index += 1
            current = current.next

    def remove_path(self, path):
        head = self
        current = head
        previous = None
        while current != None:
            if os.path.samefile(path, current.path):
                if previous != None:
                    previous.next = current.next
                else:
                    head = current.next
                break
            previous = current
            current = current.next
        return head

    def bunch(self):
        index = 1
        current = self
        while current != None:
            current.index = index
            index += 1
            current = current.next

    def erase_index(self):
        self.index = None

    def save(self, directory_path, prefix_length, delimiter, copy, simulate,
             verbosity):
        name = self.extract_name()
        name = name.lstrip(delimiter)
        prefix = self.build_prefix(prefix_length)
        if self.no_name:
            file_name = prefix + self.extract_extension(name)
        else:
            file_name = prefix + delimiter + name
        path = os.path.join(directory_path, file_name)
        self.write_path(path, copy, simulate, verbosity)

    def build_prefix(self, prefix_length):
        prefix = ""
        if self.index != None:
            prefix = str(self.index).zfill(prefix_length)
        return prefix

    def extract_extension(self, name):
        return "." + name.split(".")[-1]

    def write_path(self, path, copy, simulate, verbosity):
        if not os.path.isfile(path) or not os.path.samefile(self.path, path):
            if not simulate:
                if copy:
                    shutil.copy(self.path, path)
                else:
                    shutil.move(self.path, path)
            if verbosity > 0:
                print "Wrote:", self.path, "=>", path

    def get_largest_index(self):
        current = self
        while current.next:
            current = current.next
        return current.index

    def extract_name(self):
        file_name = os.path.basename(self.path)
        match = re.match("^[0-9]*(.*)", file_name)
        return match.group(1)
<?php

define("STYLE_SHEET", "style.css");
define(
   "PAGE_TITLE",
   "Elemental Parents &#187; Lightweight Hierarchical Database");

display_page();
function display_page() { echo build_page(); }

function build_page()
{
   $markup = "<html>\n\n";
   $markup .= build_head();
   $markup .= build_body();
   $markup .= "</html>";
   return $markup;
}

function build_body()
{
   $markup = file_get_contents("elmp.html") . "\n";
   return $markup;
}

function build_head()
{
   $markup = "<head>\n";
   $markup .= "<title>" . PAGE_TITLE . "</title>\n";
   $markup .= build_style_sheet_tag();
   $markup .= "</head>\n\n";
   return $markup;
}

function build_style_sheet_tag()
{
   $markup = "<link href=\"";
   $markup .= STYLE_SHEET;
   $markup .= "\" rel=\"stylesheet\" type=\"text/css\"/>\n";
   return $markup;
}
<?php

define("OPEN_ELEMENT_CHAR", "(");
define("CLOSE_ELEMENT_CHAR", ")");

define("NAME_COMPONENT", 0);
define("ID_COMPONENT", 1);
define("DATA_COMPONENT", 2);
define("COMPONENT_COUNT", 3);

define("ELMP_VERBOSE", True);
<?php

// The refrigerator picked up a mix of transmissions from Andromeda, one of
// them was a loop, "Attention All Humans..."

class Element
{
   public function __construct($id=NULL, $name=NULL, $content=NULL)
   {
      $this->id = $id;
      $this->name = $name;
      $this->content = $content;
   }

   public function __toString()
   {
      return "Element $this->id -- $this->name\n";
   }

   public function count()
   {
      return ((is_object($this->content)) ? $this->content->count() : 0) +
         (($this->next) ? $this->next->count() : 0) + 1;
   }

   public function measure_depth()
   {
      $current = $this;
      while ($current)
      {
         if (is_object($current->content))
         {
            $nodes[] = 1 + $current->content->measure_depth();
         }
         $current = $current->next;
      }
      return ($nodes) ? max($nodes) : 1;
   }

   // Run a user supplied function on every member of the tree.  Return the
   // concatenation of the values given by each recursive call.
   public function format($editor, $indent=False, $level=0)
   {
      $markup = call_user_func($editor, $this, $indent, $level);
      if (is_object($this->content))
      {
         $markup .= $this->content->format($editor, True, $level+1);
      }
      if ($this->next)
      {
         $markup .= $this->next->format($editor, False, $level);
      }
      else
      {
         $markup .= call_user_func($editor, $this->next, $indent, $level);
      }
      return $markup;
   }

   public function convert_to_raw_string()
   {
      $message = "($this->name $this->id";
      $message .= ($this->content || $this->next) ? " " : "";
      $message .= (is_object($this->content)) ?
         $this->content->convert_to_raw_string() : "";
      $message .= (!is_object($this->content)) ? "$this->content)" : ")";
      $message .= ($this->next) ? $this->next->convert_to_raw_string() : "";

      return $message;
   }

   public function convert_to_tabbed_string($level=0)
   {
      $string = str_repeat("   ", $level);
      $string .= "$this->id $this->name";
      $string .= (is_object($this->content)) ? " ยป\n" : ": $this->content\n";

      $string .= (is_object($this->content)) ?
         $this->content->convert_to_tabbed_string($level+1) : "";
      $string .= ($this->next) ?
         $this->next->convert_to_tabbed_string($level) : "";

      return $string;
   }
}
18.116.15.22
18.116.15.22
18.116.15.22
 
July 18, 2022


A new era โ€ผ

Our infrastructure has recently upgraded โ€ผ

Nugget Communications Bureau ๐Ÿ‘

You've never emailed like this before โ€ผ

Roundcube

Webmail software for reading and sending email from @nugget.fun and @shampoo.ooo addresses.

Mailman3

Email discussion lists, modernized with likes and emojis. It can be used for announcements and newsletters in addition to discussions. See lists for Picture Processing or Scrapeboard. Nowadays, people use Discord, but you really don't have to!

FreshRSS

With this hidden in plain sight, old technology, even regular people like you and me can start our own newspaper or social media feed.

Nugget Streaming Media ๐Ÿ‘

The content you crave โ€ผ

HLS

A live streaming, video format based on M3U playlists that can be played with HTML5.

RTMP

A plugin for Nginx can receive streaming video from ffmpeg or OBS and forward it as an RTMP stream to sites like Youtube and Twitch or directly to VLC.


Professional โ€ผ

Nugget Productivity Suite ๐Ÿ‘

Unleash your potential โ€ผ

Kanboard

Virtual index cards you can use to gamify your daily grind.

Gitea

Grab whatever game code you want, share your edits, and report bugs.

Nugget Security ๐Ÿ‘

The real Turing test โ€ผ

Fail2ban

Banning is even more fun when it's automated.

Spamassassin

The documentation explains, "an email which mentions rolex watches, Viagra, porn, and debt all in one" will probably be considered spam.

GoAccess

Display HTTP requests in real time, so you can watch bots try to break into WordPress.

Nugget Entertainment Software ๐Ÿ‘

The best in gaming entertainment โ€ผ

Emoticon vs. Rainbow

With everything upgraded to the bleeding edge, this HTML4 game is running better than ever.


Zoom โ€ผ

The game engine I've been working on, SPACE BOX, is now able to export to web, so I'm planning on turning nugget.fun into a games portal by releasing my games on it and adding an accounts system. The upgraded server and software will make it easier to create and maintain. I'm also thinking of using advertising and subscriptions to support the portal, so some of these services, like webmail or the RSS reader, may be offered to accounts that upgrade to a paid subscription.