Wednesday, May 1, 2024

Nullmailer Single-User Local Mail Setup

This is a way to setup local mail on a single-user Linux machine.

 I wanted to quickly jot down my notes on how to get nullmailer to route all local mail to my main user, for example for cron. This uses procmail. The mail client is neomutt.

Be sure to add a local mailbox or two to ~/.neomuttrc or similar files: mailboxes +local +Junk

Look for Nullmailer's protocol binary files. On Ubuntu this is at /usr/lib/nullmailer/, In this directory, write the following file and chmod +x it:


/usr/lib/nullmailer/local
#!/bin/bash
# Copyright 2018,2024 M Bazz <bazz@bazz1.com>
#
# Mail messages come in on fd3. Capture into a var, trim it so procmail
# recognizes it (nullmailer has the first 2 lines sender/receiver and a
# blank line, which procmail doesn't recognize).

# This is the mail as nullmailer expects it. See `man nullmailer-queue` to
# understand that format.
mail="`cat <&3`"

cat > /tmp/mail.log <<<"$mail"

n=0 # trigger for when blank line is found (sender/recipients lines done)
{ while IFS= read -r line; do
  if test $n = 0 ; then
    test -z "$line" && n=1
  else
    echo "$line"
  fi
done | /usr/bin/procmail -m /etc/procmailrcs/bazz ; } <<<"$mail"

let's look at the next file.

/etc/procmailrcs/bazz:
VERBOSE=1
SHELL=/bin/sh
PATH=$HOME/.local/bin:/usr/sbin:/usr/bin:/usr/local/sbin:/usr/local/bin
MAILDIR=$HOME/Maildir
INBOX=$MAILDIR/bazz1/INBOX
LIST=$MAILDIR/list
NEWS=$MAILDIR/news
DEFAULT=$MAILDIR/Junk/
LOGFILE=/var/log/bazz/procmail.log
LOG=""
#octal u=rw,g=rw
UMASK=007


:0
* ^(From|To|Cc).*@(localhost|beastlin.int.bazz1.com)
{
  :0cWhi
  | newmail-hook local

  :0
  $MAILDIR/local/
}

Note that if the file is a symlink, then the symlink itself's ownership must be changed using `chown -h`

Essentially, if the rule matches then it goes into the local inbox, but if it doesn't match at all then it goes into the Junk folder.

/etc/nullmailer/remotes
localhost localhost

This says mail destined to the localhost will use the "localhost" protocol script listed earlier.

That's essentially it. Hopefully these quick notes are helpful.

Tuesday, February 21, 2012

Writing a Qt Image Plugin, 8Bit Indexed Images

I decided to write something on this since I just broke my ass to get this working. I am converting BGR555 4bpp SNES images to 8bpp RGB24 indexed for my QT Program. There are a number of things you need to simply "try"/"know" before getting the EFFING thing to WORK! So, since I've already done the ass-breaking. Let me show you..

STEP 1) Learn how to write a QT Image plugin.. http://doc.qt.nokia.com/qq/qq17-imageio.html
Simply edit the downloadable code so that the read/write functions reflect what you want to do...

Here are the finnicky things you need to know for 8-bit indexed QImages..

After creating a QImage img, you MUST img.setColorCount( int n), or your results will be CORRUPT. setColorCount sets the amount of colors to index with.
 Note: you don't have to actually set any colors at this point...

You are now free to index pixels with setPixel(x,y,colorindex);


random ass note: if you want to get the pixel index, use img.pixelIndex(x,y);
random article, hopefully your frustration now = 0 :)

Saturday, September 24, 2011

What's Left...

It took some modifcations to the ROM reading code, but I can now dump roms.. =] So.. this is not me playing a ROM from the internet.. I actually dumped this off of a REAL game catridge :) MY next plan is to hack the cartridge so I can upload code to it...

Sunday, September 18, 2011

Saturday, September 17, 2011

: D

SNES Cart Connector Wired to Gameboy Cart

I know its ugly.. but not as ugly as you!!! lol jk




The MBC5 capability is not plugged in yet.. First I will test communication with SNES carts by reading ROM header.