Posts

Showing posts from September, 2013

RPi Gpio update.

Image
  Found some of the commands on the Raspberry Pi changed a little bit The Raspberry Pi per se does not have analog ports like the Arduino. though you can get converters that can be attached to the gpio or use an r2r setup. To light an led, you will need to use at least two pins. A gpio and a ground pin. You will also need an led and an appropriate resistor. Once you master these simple steps you can additional electronics and control quite a few things. Remember the gpio only uses very low voltage. Additional safety circuitry is needed for other projects. Note: you can use jumper wires from  older computers if you do not need to use the whole header. old version -----------  # Turn light on cd /sys/class/gpio # Turn on pin but defaults to low. echo 17 > export # Set port direction, in this case we are doing output. echo out > gpio17/direction # Set pin high and turn on led. echo 1 > gpio17/value #Turn light off echo 0 > gpio17/value New versio...

Yet another chit chat.

Image
After installing Cobol on the Nslu2 running Debian, still had to load some libraries after and update to Debian. A learning experience.  One of the test programs I played with to relearn cobol. Cobol is so self documenting. ~$ ./readtest 6543218 Mend ed 1234 1957 1234567 Corona ra 5555 1958 :~$ cat STUDENTS.DAT 6543218Mend ed  195707141234m 1234567Corona ra195806135555f ~$ ~$ cat readtest.cob IDENTIFICATION DIVISION. PROGRAM-ID. SeqReadNo88. AUTHOR. Michael Coughlan. ENVIRONMENT DIVISION. INPUT-OUTPUT SECTION. FILE-CONTROL. SELECT StudentFile ASSIGN TO "STUDENTS.DAT" ORGANIZATION IS LINE SEQUENTIAL. DATA DIVISION. FILE SECTION. FD StudentFile. 01 StudentDetails. 02 StudentId PIC 9(7). 02 StudentName. 03 Surname PIC X(8). 03 Initials PIC XX. 02 DateOfBirth. 03 YOBirth PIC 9(4). 03 MOBirth PIC 9(2). 03 DOBirth PIC 9(2). 02 CourseCode PIC X(4). 02 Gender PIC X...

Simple pie chart with Qbasic/Freebasic.

Image
Just something to play with. DIM Angle(1) DIM MyData(0 TO 4) DIM C(1 TO 4) Pi = 4 * ATN(1)                                                   '  Can use 3.141593 Radius = 200                                                      '  Change these to suit your taste  Xc = 319                               ...

Server script.

Image
Wrote this script a while back to use the server to get information for me. Here is a newer incarnation of that same script. #!/bin/sh echo “Content-type: text/html\n” # read in our parameters CMD=`echo “$QUERY_STRING” | sed -n ‘s/^.*cmd=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”` FOLDER1=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder1=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER2=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder2=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER3=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder3=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER4=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder4=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER5=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder5=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER6=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder6=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER7=`echo “$QUERY...

Server script.

Image
Wrote this script a while back to use the server to get information for me. Here is a newer incarnation of that same script. #!/bin/sh echo “Content-type: text/html\n” # read in our parameters CMD=`echo “$QUERY_STRING” | sed -n ‘s/^.*cmd=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”` FOLDER1=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder1=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER2=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder2=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER3=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder3=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER4=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder4=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER5=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder5=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER6=`echo “$QUERY_STRING” | sed -n ‘s/^.*folder6=\([^&]*\).*$/\1/p’ | sed “s/%20/ /g”| sed “s/%2F/\//g”` FOLDER7=`echo “$QUERY...

Motd

Image
Message of the day, Message of the day if the screen you see when you log into the command line. Usually if s short and mundane, You may want to jazz it up a little bit with some text graphics.Some of the settings for your computer are int he /etc directory. Message of the day or motd usually resides in this directory. Now if you add your message  or graphic to the regular motd file, it will usually get wiped out. What you can do is add your messages ad or graphics into a file call /etc/motd.tail. Then when you log in you will see your message. You will need to reboot to see the message.You can also edit /etc/issue that is used by mgetty for when you log into a serial port. (rs232).

Emergency Usb condom.

Image
Emergency Usb condom. Connecting your phone or other computing device to an unknown usb port could get your device hacked. Protect yourself with a usb condomso data lines do not get connected to a nefarious host while charging. getting an usb extender bable from the dollar store is the easiest way to statr making one.

Emergency Usb condom.

Image
Emergency Usb condom. Connecting your phone or other computing device to an unknown usb port could get your device hacked. Protect yourself with a usb condomso data lines do not get connected to a nefarious host while charging. getting an usb extender bable from the dollar store is the easiest way to statr making one.

Weather report.

Image
Notice: this site was working last week, but now it is disabled. 07/04/2018 My stepfather was into meteorology. In fact, he was a weatherman in the military, He got us into it. So I like to look at a minimal weather report. Batch files make it easier for servers to display data as needed. Have an nslu2 running linux with very low resources. So a batch file is perfect for grabbing data off the web. You can also use it for mobile devices.  That also means you can insert the data grabbed into a database for later research, Actually I have been doing weather scraping for a while, This is probably almost the tenth script I have written.  From the command line it might look like this: ~$ ./gwp2.sh 22546 The weather for 22546 on Sep 19: Updated: 7:05 AM EDT on September 19, 2013 Observed at Mantico Hill, Beaverdam, Virginia Temperature 47.8°F / 8.8°C Humidity 98% Dew Point 47°F / 8°C Windchill 48°F / 9°C Win...

Do you know what time it is?

Image
Couple of simple command line clocks. Couple of simple clocks. Great for giving an old pc something to do for grins. Actually I was running these two programs from the nslu2 arm based unit running debian linux. To install: $ sudo apt-get install sysvbanner figlet If your system does not have figlet you can get it from the web. $ wget ftp://ftp.figlet.org/pub/figlet/program/unix/figlet-2.2.5.tar.gz $ tar zxvf  figlet-2.2.5.tar.gz $ cd figlet-2.2.5/ $ make $ sudo make install Usage: watch -tn 1 date +%T \|figlet -c or watch -t -n 1 "date +%T | xargs banner"

Mswindows legacy drivers on linux

Image
Install an MsWindows driver on linux. General linux has drivers for everything know to man, but because of propritary interference or hardware is not used anymore, you may still be able to get it working. Had some old wifi cards in the closet that I wanted to use for a Honeypot server. Linux did not have the drivers, but it did see the hards in hardware listings. I download the MSWindows driver and in minutes the card was usuable. Set up a legacy mswindows wifi card in linux..(Make sure your card was installed properly while the machine was off.) Download and extract the mswindows drivers for the card Unzip the files to a local directory $ unzip aw* Fw1130.bin FwRad17.bin radio17.bin TNET1130.INF FwRad16.bin radio16.bin tnet1130.cat tnet1130.sys Install the interfacing software. $ sudo apt-get install ndiswrapper-common ndiswrapper-utils-1.9 install ndiswrapper-dkms To see if your card is tetected. $ lspci … 00:0b.0 Network controller...

More arduino

Image
More arduino test curcuits: Ping sensor. Use pin 7 for data. /* Ping))) SensorThis sketch reads a PING))) ultrasonic rangefinder and returns the distance to the closest object in range. To do this, it sends a pulse to the sensor to initiate a reading, then listens for a pulse to return.  The length of the returning pulse is proportional to the distance of the object from the sensor.The circuit: * +V connection of the PING))) attached to +5V * GND connection of the PING))) attached to ground * SIG connection of the PING))) attached to digital pin 7http://www.arduino.cc/en/Tutorial/Pingcreated 3 Nov 2008 by David A. Mellis modified 30 Aug 2011 by Tom IgoeThis example code is in the public domain.*/// this constant won’t change.  It’s the pin number // of the sensor’s output: const int pingPin = 7;void setup() { // initialize serial communication: Serial.begin(9600); }void loop() { // establish variables for duration of the ping, // and the dis...

Waste not want not.

Image
Decided to make a pizza rather than order one in. You can get yeast that does not need any rising time. But the I realized I was out of sauce so we made the red sauce. But then I remembered  there was no cheese either. milk to the rescue. Everything you needed for pizza. But what to do with the milk whey left over from the cheese making. no problem we just made polenta. We made of pot of it for what the stores sell a small tube. If course we used the extra red sauce and cheese for the topping on the polenta. We also added green peas for color. Hmmm good.