MAME on OpenEmu

If like me, you decided to try out OpenEmu and then thought you’d like to try running MAME games but couldn’t get it going with other guides, try this. I didn’t worry about losing saved states.

Find OpenEmu in the Applications folder (or wherever you keep your apps) and move it to the the trash.

Use the shortcut ⌘ ⇧ G to go to a folder.

~/Library

Find the OpenEmu folder in the Application Support folder and move it to the trash. (Don’t empty trash yet). There was another OpenEmu folder in there too which I moved to the trash.

Download the OpenEmu Experimental version by clicking the disclosure triangle on the right end of the download button at http://openemu.org/

Move OpenEmu to the Applications folder.

Open OpenEmu

Open Preferences > Cores

Install the Cores you want.

Find your ROMs in the OpenEmu folder now in the Trash, and drag them bag to the new OpenEmu.

Make sure the MAME ROMs are .zip compressed.

Adding AirPlay

I’ve been meaning to look at this since 2013. Easy to get a second screen. Next, interacting with it.

References:
Understanding Windows and Screens
UIWindow
UIScreen
Presenting Content on an External Display

Setting up nginx on Ubuntu for parse-server

Before You Begin

  1. Check for updates
    sudo apt-get update && sudo apt-get upgrade

Install nginx

  1. Install nginx
    sudo apt-get install -y nginx
  2. Decide how you want to access parse:
    a. example.com/parseapp/
    b. parseapp.example.com/ (don’t forget to add an A record for parseapp pointing to the IP address and include subdomain in Let’s Encrypt certificates)

Setup nginx for example.com/parseapp/

  1. Change directory
    cd /etc/nginx/sites-enabled/
  2. Open default
    sudo nano default
  3. Select all
    ctrl+shift+6
    ↓↓↓↓ to the bottom
    ctrl+K
  4. Paste the following in, changing example.com, parseapp, and portnumber
  5. Save and exit
  6. Restart nginx
    sudo service nginx restart

Setup nginx for parseapp.example.com/

  1. Change directory
    cd /etc/nginx/sites-enabled/
  2. Open default
    sudo nano default
  3. Select all
    ctrl+shift+6
    ↓↓↓↓ to the bottom
    ctrl+K
  4. Paste the following in, changing example.com, parseapp, and portnumber
  5. Save and exit
  6. Restart nginx
    sudo service nginx restart

Mini series

  1. Setting up a server at Linode
  2. Install Let’s Encrypt to Create SSL Certificates on Ubuntu
  3. Setting up MongoDB on Ubuntu
  4. Setting up nginx on Ubuntu for parse-server
  5. Setting up parse-server on Ubuntu

How to Keep Your SSH Sessions Alive

(Episode #39 – CLI Monday: How to Keep Your SSH Sessions Alive)

  1. Create a file locally ~/.ssh/config
  2. Restart any ssh sessions

Setting up parse-server on Ubuntu

(Digital Ocean: How To Run Parse Server on Ubuntu 14.04)
(Digital Ocean: How To Migrate a Parse App to Parse Server on Ubuntu 14.04)
(GitHub: NodeSource Node.js and io.js Binary Distributions)

Before You Begin

  1. Check for updates
    sudo apt-get update && sudo apt-get upgrade

Install Node.js, Development Tools, other stuff, and parse-server

  1. Go to user’s home directory
    cd ~
  2. See NodeSource page for up-to-date installation instructions
    curl -sL https://deb.nodesource.com/setup_7.x | sudo -E bash -
  3. Install nodejs, build-essential and git
    sudo apt-get install -y nodejs build-essential git
  4. Install htop
    sudo apt-get install htop
  5. Install bcrypt
    sudo apt-get install bcrypt
  6. Install tmux to allow processes to run without ssh connection
    sudo apt install tmux
  7. Install parse-server and mongodb-runner (I haven’t figured out what the runner does)
    sudo npm install -g parse-server mongodb-runner

Setup Parse Cloud Code

  1. Go to user’s home directory
    cd ~
  2. Make a cloud directory
    mkdir -p ~/cloud
  3. Make a main.js file
    nano ~/cloud/main.js
  4. Paste
  5. Save and exit

Setup a new parse-server app

  1. Things you need
    • App name (long) ${newAppLong}
    • App name (short) ${newApp}
    • Password (no funny characters) ${password}
    • Parse port number ${port}
    • Parse appId ${appId}
    • Parse masterKey ${masterKey}
  2. Open port in ufw
    sudo ufw allow ${port}
  3. Add a new user to mongoDB
    mongo --port 27017
    use ${newApp}
    db.createUser({user: "${newApp}", pwd: "${password}", roles: [ { role: "dbOwner", db: "${newApp}"} ]})
    exit
  4. Restart MongoDB
    sudo service mongod restart
  5. Configure nginx for ${newApp} (parseapp) as per Setting up nginx on Ubuntu for parse-server
  6. Start parse-server on boot
    crontab -e
    If first run, select nano, 2
    At the bottom of the file add either:

    • for https://example.com/${newApp}/
      @reboot tmux new-session -s test -d parse-server --port ${port} --appId ${appId} --masterKey ${masterKey} --databaseURI mongodb://${newApp}:${password}@localhost:27017/${newApp} --cloud /home/parse/cloud/main.js --serverURL https://example.com/${newApp}/ --appName "${newAppLong}"
    • or for https://${newApp}.example.com/
      @reboot tmux new-session -s test -d parse-server --port ${port} --appId ${appId} --masterKey ${masterKey} --databaseURI mongodb://${newApp}:${password}@localhost:27017/${newApp} --cloud /home/${currentUser}/cloud/main.js --serverURL https://${newApp}.example.com/ --appName "${newAppLong}"

    Save & exit

  7. Open a new terminal window
  8. Check if npm and node are installed locally
    npm -v
    node -v
  9. If not, download and install fromhttps://nodejs.org/

  10. Install parse-dashboard locally
    sudo npm install -g parse-dashboard
  11. Run parse-dashboard locally
    parse-dashboard --appId ${appId} --masterKey ${masterKey} --serverURL https://example.com/${newApp}/ --appName "${newAppLong}"
    or
    parse-dashboard --appId ${appId} --masterKey ${masterKey} --serverURL https://${newApp}.example.com/ --appName "${newAppLong}"

Mini series

  1. Setting up a server at Linode
  2. Install Let’s Encrypt to Create SSL Certificates on Ubuntu
  3. Setting up MongoDB on Ubuntu
  4. Setting up nginx on Ubuntu for parse-server
  5. Setting up parse-server on Ubuntu

Install Let’s Encrypt to Create SSL Certificates on Ubuntu

(Linode: Install Let’s Encrypt to Create SSL Certificates)
[Update 2018 03 06: You might want to look at Certbot]

Before You Begin

  1. Check for updates
    sudo apt-get update && sudo apt-get upgrade
  2. Check if git is installed
    which git
    If not install git
    sudo apt-get install git
    Password
    y
  3. Open a port for Let’s Encrypt
    sudo ufw allow 443
    [Update 2018 03 06: (you might need to allow port 80 as well for some reason)]

Install Let’s Encrypt

  1. Download and install Let’s Encrypt
    sudo git clone https://github.com/letsencrypt/letsencrypt /opt/letsencrypt
  2. Navigate to the new /opt/letsencrypt directory:
    cd /opt/letsencrypt

Create an SSL Certificate

  1. Run Let’s Encrypt including each domain to be covered with a -d
    • sudo -H ./letsencrypt-auto certonly --standalone -d example.com -d www.example.com
    • password
    • a good email address
    • Agree
    • Success!
      IMPORTANT NOTES: - Congratulations! Your certificate and chain have been saved at/etc/letsencrypt/live/example.com/fullchain.pem. Your cert will expire on 2017-xx-xx. To obtain a new or tweaked version of this certificate in the future, simply run letsencrypt-auto again. To non-interactively renew *all* of your certificates, run "letsencrypt-auto renew" - If you like Certbot, please consider supporting our work by:Donating to ISRG / Let's Encrypt:   https://letsencrypt.org/donateDonating to EFF:   https://eff.org/donate-le
  2. Setup auto renewals of certificates
    • sudo crontab -e
    • First run select nano as editor
    • Add the line to the bottom of the file to run at 02:30 every Monday, pausing nginx to allow access to port 443 as required.
      30 2 * * 1 /opt/letsencrypt/letsencrypt-auto renew --quiet --pre-hook "sudo service nginx stop" --post-hook "sudo service nginx start"
      (I HAVEN’T confirmed this is working yet, but it should be)

Mini series

  1. Setting up a server at Linode
  2. Install Let’s Encrypt to Create SSL Certificates on Ubuntu
  3. Setting up MongoDB on Ubuntu
  4. Setting up nginx on Ubuntu for parse-server
  5. Setting up parse-server on Ubuntu

Setting up MongoDB on Ubuntu

(MongoDB: Install MongoDB Community Edition on Ubuntu)
(Linode: Install MongoDB on Ubuntu 16.04 (Xenial))
(Digital Ocean: How To Install MongoDB on Ubuntu 14.04)

Before You Begin

  1. Check for updates
    sudo apt-get update && sudo apt-get upgrade

Add the MongoDB repository

  1. Import the MongoDB public GPG key for package signing
    sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 0C49F3730359A14518585931BC711F9BA15703C6
  2. Add the MongoDB repository to your sources.list.d directory
    echo "deb [ arch=amd64,arm64 ] http://repo.mongodb.org/apt/ubuntu xenial/mongodb-org/3.4 multiverse" | sudo tee /etc/apt/sources.list.d/mongodb-org-3.4.list
  3. Update your repositories. This allows apt to read from the newly added MongoDB repo
    sudo apt-get update
  4. Install MongoDB
    sudo apt-get install mongodb-org
  5. Enable auto-start on reboot
    sudo systemctl enable mongod.service
  6. Open a port in ufw
    sudo ufw allow 27017

Running MongoDB

  1. Start MongoDB
    sudo service mongod start
  2. Verify MongoDB started
    sudo nano /var/log/mongodb/mongod.log
    and look for
    [initandlisten] waiting for connections on port 27017
  3. Stop MongoDB
    sudo service mongod stop
  4. Restart MongoDB
    sudo service mongod restart

Setup MongoDB users

  1. Open MongoDB
    mongo --port 27017
  2. Create an admin database
    use admin
  3. Add a mongodbAdminUsername and mongodbAdminPassword (letters and numbers, no funny characters)
    db.createUser({user: "mongodbAdminUsername", pwd: "mongodbAdminPassword", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]})
  4. Exit
    exit
  5. Restart MongoDB
    sudo service mongod restart

Mini series

  1. Setting up a server at Linode
  2. Install Let’s Encrypt to Create SSL Certificates on Ubuntu
  3. Setting up MongoDB on Ubuntu
  4. Setting up nginx on Ubuntu for parse-server
  5. Setting up parse-server on Ubuntu