Chit chat

=======

lsblk is a nice way to find out what storage devices are on your system instead of sudo fdisk -l.

$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 74.5G 0 disk
├─sda1 8:1 0 71.5G 0 part /
├─sda2 8:2 0 1K 0 part
└─sda5 8:5 0 3.1G 0 part [SWAP]
sdd 8:48 1 982.5M 0 disk
└─sdd1 8:49 1 982.5M 0 part /media/eddie/disk
sr0 11:0 1 1024M 0 rom

Installed some of my old apps back on the web server such as Oscommerce and Flatpress.

More and more linux distros are beginning to drop MySQL for MariaDB.  So far they seem compatible to me. Been practising setting up lamp servers on the Raspberry Pi and old Pentium one computers.

Screenshot from 2015-01-02 02:52:15

 

SUNP0034

Amazing that you can take what some people would call a legacy machine and create a web server that does virtual hosting. (i.e. one computer and many websites).

vh

——————————————

So I have talked about booting from a web server to do an install. Now we are going to go a bit farther and boot a live image from a web server. Depending on the size of the image, your destination machine will have to have enough memory to handle the load. For our purposes, we will use a very small linux distro for testing purposes. In this case, Slitaz should fit the bill so to speak. http://www.slitaz.org/en/get/.   Like the web installs we did, you will need a pxebootable device such as a floppy, usb, or cdrom/dvdrom.

Doing a web load has been around a long time, but the average user may not be aware of it. What is really neat about this is that you have older thin clients, they would be perfect for use with the web boot for the ones that will. While I was at it, I was  able to get it to boot from tftp server to a thin client. That setup is more involved and for another day.  One shortcoming is that Slitaz does not seem to use the usb keyboard out of the box.

:/var/www/slitaz$ ls
memdisk  slitaz5.iso

If you have been following my articles, you should be aware of how to make the boot media for the ipxe boot.  Had to get to files to the web directory to boot from first is the iso of course and the second is the memdisk. If you have syslinux installed, it should be there on your system.

#!ipxe
dhcp any
initrd http://192.168.1.32/tinycore/slitaz5.iso
chain http://192.168.1.32/debianlive/memdisk iso raw

or

    kernel Kernel/memdisk (or http://192.168.10.1/Kernel/memdisk)
    append iso initrd=192.168.10.1/Images/ubcd.iso

In doing the research for this, quite a few ways to do this.

——————————————

We use the simple whiteboard like a chalk board. Surprised it even worked will being hosted on a pentium one computer running Slackware 14.1. The code is based off of the Canvas developers project. You will want to download the special programs to make the page faster to load.

$ wget https://code.jquery.com/jquery-1.11.0.min.js
$ wget https://awwapp.com/static/1.0/aww.min.js
$ wget https://awwapp.com/nowjs/now.js
$ wget https://awwapp.com/static/1.0/aww.css

You will want your web page and the files all in the same directory aka folder.

wb.hrml

<html>
<head>
<!-- jQuery 1.x is required; if you already have it included in your page,
 no need to include this -->
<script type="text/javascript" src="jquery-1.11.0.min.js"></script>

<!-- AWW widget -->
<script type="text/javascript" src="aww.min.js"></script>

<!-- Connection to the whiteboard sharing service -->
<script type="text/javascript" src="now.js"></script>

<!-- CSS styles used by the widget -->
<link rel="stylesheet" type="text/css" href="aww.css"/>

</head>
<body>
<!-- the whiteboard widget will be shown inside this element -->
<div id="wrapper" style="width: 100%; height: 600px;"></div>

<!-- this actually initializes the widget -->
<script type="text/javascript">
    $(function() {
        /* initialize the whiteboard widget on #wrapper element */
        var aww = $('#wrapper').awwCanvas();
    });
</script>
</body>
</html>

——————————————

Keeping medical records is very important. Of course, your doctor’s office will keep records, but you will want to keep your own set. Was looking at this software for doctor’s offices so they can keep records. It is so detailed, that you would enriched if you used this program yourself. The program is called openemr and is available from www.openemr.com (perfect for a doctors office). The have version for several operating systems.  The version that interested me the most was the web version, so you could install it on your own private server and everyone on the network can use it.

We setup what is known as a virtual site so that it co resides with other websites from the same server (just like the pros do it).  What is interesting os that you can keep a record of office visits. You cn even printout records for  just one visit or print the whole month out.

Of course you can add any member of the family maybe add or setup up accounts for relatives that you care about.

Of course, the financial records are important, especially at tax time.

Some people might think it is a bit overdoing it, but wait till you want to get at the information and you will really appreciate the software. Have only scratched the surface of what can be done. Check it out!

Simple mandlebrot prog compile in freebasic.

Screenshot from 2015-01-06 14:51:29


SCREEN 13
WINDOW (-2, 1.5)-(2, -1.5)
FOR x0 = -2 TO 2 STEP .01
FOR y0 = -1.5 TO 1.5 STEP .01
x = 0
y = 0
iteration = 0
maxIteration = 223
WHILE (x * x + y * y <= (2 * 2) AND iteration < maxIteration)
xtemp = x * x - y * y + x0
y = 2 * x * y + y0
x = xtemp
iteration = iteration + 1
WEND
IF iteration <> maxIteration THEN
c = iteration
ELSE
c = 0
END IF
PSET (x0, y0), c + 32
NEXT
NEXT
Input"press enter to quit",a

——————————————

FVIYRO9I4IDCEC4.LARGE

The Chumby make a great Musak type device. You will need a program like gnump3d on a server with some audio files.

You can use a program on linux called fapg to create an m3u playlist.

Our connection from the Chumby to the server is:

FTB1702I4IDD8C1.LARGE

Name: Typo1

URL: http://typo1:8888:/stream.m3u

typo1:/var/media/musi

Note: music server directory is set to /var/media/music

typo1:/var/media/music$ ls
bsd contemporary stream.m3u clientplaylist_192.168.1.122.m3u folk and classical

——————————————

Python is the rage these days so here is a simple editor in python (requires gui)

Screenshot from 2015-01-06 15:09:15


from Tkinter import *
from tkSimpleDialog import askstring
from tkFileDialog import asksaveasfilename
from tkMessageBox import askokcancel
class Quitter(Frame):
def __init__(self, parent=None):
Frame.__init__(self, parent)
self.pack()
widget = Button(self, text='Quit', command=self.quit)
widget.pack(expand=YES, fill=BOTH, side=LEFT)
def quit(self):
ans = askokcancel('Verify exit', "Really quit?")
if ans: Frame.quit(self)
class ScrolledText(Frame):
def __init__(self, parent=None, text='', file=None):
Frame.__init__(self, parent)
self.pack(expand=YES, fill=BOTH)
self.makewidgets()
self.settext(text, file)
def makewidgets(self):
sbar = Scrollbar(self)
text = Text(self, relief=SUNKEN)
sbar.config(command=text.yview)
text.config(yscrollcommand=sbar.set)
sbar.pack(side=RIGHT, fill=Y)
text.pack(side=LEFT, expand=YES, fill=BOTH)
self.text = text
def settext(self, text='', file=None):
if file:
text = open(file, 'r').read()
self.text.delete('1.0', END)
self.text.insert('1.0', text)
self.text.mark_set(INSERT, '1.0')
self.text.focus()
def gettext(self):
return self.text.get('1.0', END+'-1c')
class SimpleEditor(ScrolledText):
def __init__(self, parent=None, file=None):
frm = Frame(parent)
frm.pack(fill=X)
Button(frm, text='Save', command=self.onSave).pack(side=LEFT)
Button(frm, text='Cut', command=self.onCut).pack(side=LEFT)
Button(frm, text='Paste', command=self.onPaste).pack(side=LEFT)
Button(frm, text='Find', command=self.onFind).pack(side=LEFT)
Quitter(frm).pack(side=LEFT)
ScrolledText.__init__(self, parent, file=file)
self.text.config(font=('courier', 9, 'normal'))
def onSave(self):
filename = asksaveasfilename()
if filename:
alltext = self.gettext()
open(filename, 'w').write(alltext)
def onCut(self):
text = self.text.get(SEL_FIRST, SEL_LAST)
self.text.delete(SEL_FIRST, SEL_LAST)
self.clipboard_clear()
self.clipboard_append(text)
def onPaste(self):
try:
text = self.selection_get(selection='CLIPBOARD')
self.text.insert(INSERT, text)
except TclError:
pass
def onFind(self):
target = askstring('SimpleEditor', 'Search String?')
if target:
where = self.text.search(target, INSERT, END)
if where:
print where
pastit = where + ('+%dc' % len(target))
#self.text.tag_remove(SEL, '1.0', END)
self.text.tag_add(SEL, where, pastit)
self.text.mark_set(INSERT, pastit)
self.text.see(INSERT)
self.text.focus()
if __name__ == '__main__':
try:
SimpleEditor(file=sys.argv[1]).mainloop()
except IndexError:
SimpleEditor().mainloop()

——————————————

sinewave

#!/bin/bash
# plotsine.sh
# A DEMO to display a sinewave inside a standard bash terminal.
# Issued as Public Domain, 2014, B.Walker, G0LCU.
# Device: Macbook Pro 13", OSX 10.7.5, default bash terminal.
# Use variables so that you can see how it works.
angle=0
step_angle=5
vert_plot=0
horiz_plot=5
centreline=12
amplitude=11
PI=3.14159
clear
# Do a single cycle, quantised graph.
while [ $angle -le 359 ]
do
# Create each floating point value...
# CygWin now catered for... ;o)
vert_plot=$(awk "BEGIN{ printf \"%.12f\", ((sin($angle*($PI/180))*$amplitude)+$centreline)}")
#vert_plot=$(bc -l <<< "{print ((s($angle*($PI/180))*$amplitude)+$centreline)}")
# Truncate the floating point value to an integer then invert the plot to suit the x y co-ordinates inside a terminal...
vert_plot=$((24-${vert_plot/.*}))
# Plot the point(s) and print the angle at that point...
printf "\x1B["$vert_plot";"$horiz_plot"f*"
printf "\x1B[22;1fAngle is $angle degrees..."
sleep 0.1
# Increment values...
angle=$((angle+step_angle))
horiz_plot=$((horiz_plot+1))
done
printf "\x1B[23;1fSinewave plotted as a quantised text mode graph.\n"
exit 0

Change it into a cosine wave by changine line 9 from sine to cos.

vert_plot=$(awk “BEGIN{ printf \”%.12f\”, ((cos($angle*($PI/180))*$amplitude)+$centreline)}

cosine

——————————————

Original test page:

Screenshot from 2015-01-06 22:59:48

Copy files to your web server in one pass.

$ ssh typo1
eddie@typo1’s password:
Linux typo1 3.2.0-4-686-pae #1 SMP Debian 3.2.63-2+deb7u2 i686

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
You have new mail.
Last login: Tue Jan 6 04:37:43 2015 from oelt02.main

eddie@typo1:~$ cd /var/www
eddie@typo1:/var/www$ ls
eyeOS index.html
eddie@typo1:/var/www$ sudo mv index.html indexhtml.old
[sudo] password for eddie:

eddie@typo1:/var/www$ ls
eyeOS indexhtml.old
eddie@typo1:/var/www$ sudo scp eddie@oelt02:~/pwsrvr/* .
[sudo] password for eddie:
eddie@oelt02’s password:
1.gif 100% 7455 7.3KB/s 00:01
scp: /home/eddie/pwsrvr/backup: not a regular file
bash1.png 100% 55KB 55.5KB/s 00:00
bashscript.html 100% 805 0.8KB/s 00:00
scp: /home/eddie/pwsrvr/cgi-bin: not a regular file
cgi.gif 100% 3902 3.8KB/s 00:00
chmod.png 100% 51KB 50.9KB/s 00:00
cron.png 100% 49KB 49.3KB/s 00:00
ha.jpg 100% 7474 7.3KB/s 00:00
icon.ico 100% 1406 1.4KB/s 00:00
index.html 100% 4583 4.5KB/s 00:00
indexhtml.old 100% 91 0.1KB/s 00:00
ip.png 100% 67KB 66.5KB/s 00:00
scp: /home/eddie/pwsrvr/lo: not a regular file
sl.png 100% 73KB 72.9KB/s 00:00
sp.png 100% 102KB 102.5KB/s 00:00
ss.png 100% 33KB 32.9KB/s 00:00
thankyou1.php 100% 367 0.4KB/s 00:00
wmfb.dat 100% 261 0.3KB/s 00:00
wmfb.html 100% 781 0.8KB/s 00:00
wmfb.php 100% 565 0.6KB/s 00:00
eddie@typo1:/var/www$ ls
1.gif chmod.png icon.ico sl.png wmfb.dat
bash1.png cron.png index.html sp.png wmfb.html
bashscript.html eyeOS indexhtml.old ss.png wmfb.php
cgi.gif ha.jpg ip.png thankyou1.php

Reload the page and voila:

Screenshot from 2015-01-06 22:46:47

——————————————

Msp430 blinky (uses onboard led!)

EnergiaMainWindow

Get your Energia development package here: http://energia.nu/ /download/

LaunchPadMSP430G2452-v1.5

#include  <msp430g2553.h>
 unsigned int i = 0;          // Initialize variables. This will keep count of how many cycles between LED toggles
void main(void)
{
  WDTCTL = WDTPW + WDTHOLD;   // Stop watchdog timer. This line of code is needed at the beginning of most MSP430 projects.
                              // This line of code turns off the watchdog timer, which can reset the device after a certain period of time.
  P1DIR |= 0x01;              // P1DIR is a register that configures the direction (DIR) of a port pin as an output or an input.
                              // To set a specific pin as output or input, we write a '1' or '0' on the appropriate bit of the register.
                              // P1DIR = <PIN7><PIN6><PIN5><PIN4><PIN3><PIN2><PIN1><PIN0>
                              // Since we want to blink the on-board red LED, we want to set the direction of Port 1, Pin 0 (P1.0) as an output
                              // We do that by writing a 1 on the PIN0 bit of the P1DIR register
                              // P1DIR = <PIN7><PIN6><PIN5><PIN4><PIN3><PIN2><PIN1><PIN0>
                              // P1DIR = 0000 0001
                              // P1DIR = 0x01     <-- this is the hexadecimal conversion of 0000 0001
  for (;;)                    // This empty for-loop will cause the lines of code within to loop infinitely
  {
    P1OUT ^= 0x01;            // Toggle P1.0 using exclusive-OR operation (^=)
                              // P1OUT is another register which holds the status of the LED.
                              // '1' specifies that it's ON or HIGH, while '0' specifies that it's OFF or LOW
                              // Since our LED is tied to P1.0, we will toggle the 0 bit of the P1OUT register
    for(i=0; i< 20000; i++);  //Delay between LED toggles. This for-loop will run until the condition is met.
                              //In this case, it will loop until the variable i increments to 20000.
  }
}

——————————————

Home made fries. So good.

SUNP0023

Good day.

Advertisements