Month: June 2016

connecting a virtual console with VirtualBox and SoCat

connecting a virtual console with VirtualBox and SoCat

There are times when being able to connect a console to a terminal application becomes useful. For example, Getting kernel panic messages and you need to get the entire message so that it can help you figure out what is going on. If using Virtualbox on linux, the serial console with need to be setup:

 

Once that is set, download and install the command screen and socat.

yum install screen socat

When the programs have finished installing. Run this command:

./socat-2.0.0-b9/socat UNIX-CONNECT:/tmp/NyLinuxVM-con PTY,link=/tmp/NyLinuxVM-con-pty &

This creates a socket to the virtual machines console and the & allows it run in the background.


screen /tmp/NyLinuxVM-con-pty

Now I can connect to the console using the command screen.

Slow Cooker Lemon And Garlic Chicken

Slow Cooker Lemon And Garlic Chicken

INGREDIENTS

  • 1 whole chicken (based on the size of your slow cooker – a 1.3kg chicken should just about fit into a 3.5L slow cooker – while a 6.5L would probably fit a 2kg chicken)
  • 4 lemons
  • 10 garlic cloves divided (8 whole and 2 halved)
  • 4 sprigs rosemary
  • Salt
  • Pepper

INSTRUCTIONS

  • Remove any giblets etc. from the cavity of the chicken, sometimes in a small bag.
  • Stuff chicken with 1 sprig of rosemary, 1 lemon (quartered) and 4 cloves garlic.
  • Season all sides of the chicken with salt and pepper.
  • Remove both ends of a lemon, cut in half to create very thick slices.
  • Line the bottom of the slow cooker with 4 lemon slices, 4 whole garlic cloves and a sprig of rosemary.
  • Put the chicken in the slow cooker.
  • Cut 2 garlic cloves in half and put all four pieces on top of the chicken along with the 2 remaining lemon slices.
  • Garnish with 1-2 more sprigs of rosemary. Put the lid on the slow cooker and set to high for 4 hours.
  • Place cooked chicken under the grill (broil) for 10 minutes to crisp the skin (optional).

Allow chicken to rest for 10 minutes before carving and serving. Leftover juices in the slow cooker are mostly lemon juice with a bit of chicken fat and can be used sparingly as a strongly flavoured sauce.
Enjoy!

Pineapple Upside-Down Cupcakes

Pineapple Upside-Down Cupcakes

Ingredients

  • 1 can (20 oz) sliced pineapple, drained, juice reserved
  • 1 box Betty Crocker™ SuperMoist™ yellow cake mix
  • 1/2 cup vegetable oil
  • 3 eggs
  • 1/3 cup butter, melted
  • 2/3 cup packed brown sugar
  • 12 maraschino cherries, cut in half

Directions

Heat oven to 350°F. Spray 24 regular-size muffin cups with cooking spray. Cut each pineapple slice into 4 pieces; set aside. In large bowl, beat cake mix, oil, eggs and reserved pineapple juice with electric mixer on low speed 30 seconds. Beat on medium speed 2 minutes, scraping bowl occasionally. In small bowl, stir together melted butter and brown sugar. Spoon 1 1/2 teaspoons butter mixture into each muffin cup. Top each with 2 pineapple pieces. Place cherry half, cut side up, in center of pineapple pieces. Spoon 1/4 cup batter into each cup. Bake 20 to 25 minutes or until toothpick inserted in center comes out clean. Cool 5 minutes. Run knife around edge of cupcakes to loosen; invert onto cookie sheet.
Serve warm!!

Source: Pineapple Upside-Down Cupcakes

Sample List (PHP)

Sample List (PHP)

Date: 08/21/2009
Program Name: Sample List (PHP)
Description: The purpose of this PHP program is get records of a database, and show only the last 30 items.

<?php
  session_start();
  include ('request_processor.php');
  include ('********.php');
  include ('menu.php');
  include ('head.php');
 
  //were going to check of the were able to connect to the database.  If we can not then print a message that we can not
  $result = con_test();
  if (!$result) 
  {
      echo ('Connection status: <b><span style="color:red">error</span></b> <br /> <p>Please check to see if the MySQL database service is on.');
      exit(0);
  }
  else
  {
    if ($_SESSION['login'] == '') //indicating that if the variable is not set than the 
    {  //print the login page
      print ("<table align=\"center\" border=\"0\"><form action=\"login.php\" method=\"post\"><table border=\"0\" align=\"center\">");
      print ("<tr><td>User Name:</td><td><input type=\"text\" size=\"30\" maxlength=\"28\" name=\"Name\" /></td>");
      print ("</tr><tr><td>Password:</td><td><input type=\"text\" size=\"30\" maxlength=\"28\" name=\"pass\" /></td>");
      print ("<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" value=\"Login\" />");
      print ("<input type=\"button\" value=\"Lost Password\" /></td></tr></table></form></body></html>");
      $_SESSION['login'] = 'check';
      exit(0);
    }
    elseif($_SESSION['login'] == 'check')
    {
      //Will start first by openning a connection to mysql
      $connection = con();
 
      //get the name and password from the login page
      $name = $_POST["Name"];
      $pass = $_POST["pass"];
 
      //Create the query command for MySQL
      $query = "select * from users where UserName = '$name' and password = '$pass'";
 
      $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
 
      if (!mysql_fetch_object($result))
      {
				$_SESSION['login'] = '';
				print ("I am sorry but the username or password does not match!<br /><a href=\"/portfilo/login.php\"><td>Go Back</a>");
				exit(0);
      }
      else
      {
				$_SESSION['login'] = 'ja';
				head();  //Create the html headers
				styles(); //Then the styles
				menu();   //Menu option
				print ("This is a sample programming Work.");
      }
 
      // close connection
      mysql_close($connection);
    }
    elseif ($_SESSION['login'] == 'ja')
    {
      head();  //Create the html headers
      styles(); //Then the styles
      menu();   //Menu option
 
      print ("This is a sample programming Work.");
    }
    // Session cleanup
    session_destroy();
  }
?>
Sample Login Program (PHP)

Sample Login Program (PHP)

Date: 08/18/2009
Program Name: Sample Login Program (PHP)
Description: The purpose of this PHP program is allow a user to login and view the content of a page. If the user does not supply the correct login information, then the program will print out a message stating that the information is incorrect. In addition, The program checks to see if it’s able to connect to the database. If it can not than it will display a message stating that it can not connect to the database.

<?php
  session_start();
  include ('request_processor.php');
  include ('********.php');
  include ('menu.php');
  include ('head.php');
 
  //were going to check of the were able to connect to the database.  If we can not then print a message that we can not
  $result = con_test();
  if (!$result) 
  {
      echo ('Connection status: <b><span style="color:red">error</span></b> <br /> <p>Please check to see if the MySQL database service is on.');
      exit(0);
  }
  else
  {
    if ($_SESSION['login'] == '') //indicating that if the variable is not set than the 
    {  //print the login page
      print ("<table align=\"center\" border=\"0\"><form action=\"login.php\" method=\"post\"><table border=\"0\" align=\"center\">");
      print ("<tr><td>User Name:</td><td><input type=\"text\" size=\"30\" maxlength=\"28\" name=\"Name\" /></td>");
      print ("</tr><tr><td>Password:</td><td><input type=\"text\" size=\"30\" maxlength=\"28\" name=\"pass\" /></td>");
      print ("<tr><td align=\"center\" colspan=\"2\"><input type=\"submit\" value=\"Login\" />");
      print ("<input type=\"button\" value=\"Lost Password\" /></td></tr></table></form></body></html>");
      $_SESSION['login'] = 'check';
      exit(0);
    }
    elseif($_SESSION['login'] == 'check')
    {
      //Will start first by openning a connection to mysql
      $connection = con();
 
      //get the name and password from the login page
      $name = $_POST["Name"];
      $pass = $_POST["pass"];
 
      //Create the query command for MySQL
      $query = "select * from users where UserName = '$name' and password = '$pass'";
 
      $result = mysql_query($query) or die ("Error in query: $query. ".mysql_error());
 
      if (!mysql_fetch_object($result))
      {
				$_SESSION['login'] = '';
				print ("I am sorry but the username or password does not match!<br /><a href=\"/portfilo/login.php\"><td>Go Back</a>");
				exit(0);
      }
      else
      {
				$_SESSION['login'] = 'ja';
				head();  //Create the html headers
				styles(); //Then the styles
				menu();   //Menu option
				print ("This is a sample programming Work.");
      }
 
      // close connection
      mysql_close($connection);
    }
    elseif ($_SESSION['login'] == 'ja')
    {
      head();  //Create the html headers
      styles(); //Then the styles
      menu();   //Menu option
 
      print ("This is a sample programming Work.");
    }
    // Session cleanup
    session_destroy();
  }
?>
Security Update Check Using GLSA

Security Update Check Using GLSA

Date: 08/20/2009
Program Name: Security Update Check Using GLSA
Description: The object of this script is to get an update respiratory from a Gentoo server and check to see if their is any security issues that effect a system.

#!/bin/bash
 
# The script will check for new Security updates available in portage

#Information needed inorder to mail the admin
echo "From: root@test.com" >> $stat
echo "To: admin@test.com" >> $stat
echo "Subject: System Security Check" >> $stat
 
echo -e "Security Check Report for $HOSTNAME $(date)\n-------------------------------------------\n" >> $stat
#Were going to update The package Libarary
emerge --sync >> $stat
 
# Then check if it went ok
result=$(grep 'metadata/glsa/timestamp.chk' /tmp/test.txt)
 
if [ !$result ]; then
    echo -e "The Portage Library Update Failed. Here is the last message that was picked up by Portage.\n" >> $stat
    tail -n10 /tmp/test.txt >> $stat
    echo -e "\n-------------------------------------------\n" >> $stat
    echo -e "\nThings to Check with the system:\nPlease check if the system is able to resovle name server.\nCheck if their is any conitivity on the network.\nCall an Admin!!" >> $stat
else
    echo -e "The Portage Library Update Works! Doing a security Check on the system\n" >> $stat
    glsa-check --list affected >> $stat
    echo -e "\n System security Check Completed.\n-------------------------------------------" >> $stat
fi
 
#Mail the Results
cat $stat | /usr/sbin/sendmail -t -bm -v
#Clean up the mess
echo "" > $stat
Slow-Cooker Barbecued Ribs

Slow-Cooker Barbecued Ribs

Cooking Info Tools

Measuring Guide
Slow Cooking Conversions

Ingredients

  • 3 1/2 pounds pork loin back ribs
  • 1/4 cup packed brown sugar
  • 1 teaspoon salt
  • 1/2 teaspoon pepper
  • 3 tablespoons liquid smoke
  • 2 garlic cloves, chopped
  • 1 medium onion, sliced
  • 1/2 cup cola
  • 1 1/2 cups barbecue sauce

Directions

Spray inside of 4- to 5-quart slow cooker with cooking spray.
Remove inner skin from ribs. Mix brown sugar, salt, pepper, liquid smoke and garlic; rub mixture into ribs. Cut ribs into 4-inch pieces. Layers ribs and onion in slow cooker. Pour cola over ribs.
Cover and cook on low heat setting 8 to 9 hours or until tender. Remove ribs from slow cooker. Drain and discard liquid. Pour barbecue sauce into shallow bowl. Dip ribs into sauce. Place ribs in slow cooker. Pour any remaining sauce over ribs. Cover and cook on low heat setting 1 hour.
Note: This recipe was tested in slow cookers with heating elements in the side and bottom of the cooker, not in cookers that stand only on a heated base. For slow cookers with just a heated base, follow the manufacturer.s directions for layering ingredients and choosing a temperature.

Tips

(Total time will vary with appliance and setting.)

Ribs go great with deli coleslaw, biscuits and frosty mugs of beer.

Spraying the inside of the slow cooker with cooking spray makes cleanup a snap.

%d bloggers like this: