Chit chat

======

Instead of cooking a turkey, will probably just bake a hen for Thanksgiving.

Found qb2c. It converts good old basic into c code and then you can compile it.  Perfect for the nslu2 running debian since to my knowledge freebasic will not work.

PCDuino? Old pc motherboard used for hardware interfacing.

Want to see what is in a file in your computer, just use a cat.

——————————————–

Easel is sort of a new “Logo” turtle language for web pages.  You can create graphics very easily. They have a server for the time being, so you do not have to host the software. That is a plus.  The package comes with many demonstration html pages to work with.   Below is a super basic example.

Screenshot from 2014-11-14 14:46:24

Simple beginner web page.

<!DOCTYPE html>
<html>
<head>
<script src=”http://code.createjs.com/easeljs-0.7.0.min.js”></script&gt;
<script>
function init() {
var stage = new createjs.Stage(“demoCanvas”);
var circle = new createjs.Shape();
circle.graphics.beginFill(“red”).drawCircle(0, 0, 50);
circle.x = 100;
circle.y = 100;
stage.addChild(circle);
stage.addChild(new createjs.Shape()).setTransform(100,100).graphics.f(“red”).dc(0,0,50);
stage.addChild(new createjs.Shape()).setTransform(100,100).graphics.f(“green”).dc(200,0,50);
stage.update();
}
</script>

</head>
<body onload=”init();”>
<canvas id=”demoCanvas” width=”500″ height=”200″>
alternate content
</canvas>
</body>
</html>

If you want to install it on a local machine, you can do that too. I had planned to install it on a server, but found that it required the installation of a program called inetd. Traditionally you were encouraged not to install it for security issues. The install was also sort of a clunky procedure. The software was not installed on the server. Maybe for a standalone machine that is not net connected could be a good choice. One other item bothered me was that so much code had to go into the header and not into the body of the document. But that is doable I suppose.  Some eople say that it is very usabe for interfacing with cnc and other form molding systems. Doe more information go to: http://www.createjs.com/

———————————————-

Thinking about doing animated shorts. On to doing a real video. Used the Openshot video editor. Imported the music clip and then imported the picture. The picture was copied repeatedly until the pictures filled the second time line for the length of the video.

Screenshot - 11162014 - 08:31:34 PM

See video at: http://itcartoons.blogspot.com/2014/11/music-video.html

Screenshot from 2014-11-16 21:20:56

———————————————-

Using a blog to keep miscellaneous notes is a wonderful idea.  They should be always there.

#—————————-
# original install
ls -l /var/log/installer

#—————————–
# uptime
uptime

#—————————–
# Quicknote (goes into .bash_history)
cat > filename <<EOF

#———————————
# Quick append (goes into .bash_history)
cat >> filename <<EOF

#——————————–
#Gif to avi
convert test.gif old%02d.jpg
ffmpeg -r 25 -i old%02d.jpg -y -an new.avi

#———————————
# Strip music
mplayer -ao pcm:fast:file=batmanpiano.mp3 -vo null -vc null Batmanpiano.flv

#———————————-
# get screen size
$ fullscreen=$(xwininfo -root | grep ‘geometry’ | awk ‘{print $2;}’)
$ echo $fullscreen
1280×768+0+0

#———————————-
# put picures in frame
montage Inputfiles outputfile

#———————————-
# Get video no sound

avconv -f alsa -i pulse -f x11grab -r 30 -s 1280*720 -i :0.0 -vcodec libx264 -preset ultrafast -ab 320k -threads 8 screen.mkv

#———————————–
# remove shopping crap
$ sudo apt-get remove unity-scope-home

#———————————–
#Create the pictures:

$ ffmpeg -i PICT0220.AVI -r 1 -f image2 %05d.png

The pictures should all be the same size as they came from a movie.

Now let’s make an animated gif

$ convert -delay 100 *.png hand.gif

Split out gif and reassemble at a slower speed.

convert a.gif %02d.png
convert -delay 6 -loop 0 *.png animation.gif

Note: check the documentation for the programs to get more possibilities.

Gifs to avi

convert test.gif old%02d.jpg
ffmpeg -r 25 -i old%02d.jpg -y -an new.avi

run qemu on 64 bit
qemu-system-x86_64 -m 512 -fda testdisk.img

#———————————————
# How to convert to/from DOS format in VIM…
By Matt Fahrner, on October 9th, 2008

It’s very easy, but also easy to forget how to convert to or from a DOS format file in Unix using “vim” (Vi iMproved), the Open Source “vi”. If the file is in DOS format and you want to convert to Unix, use the command:

:set ff=unix

note that “ff” is an abreviation for “fileformat” which you can also use.

If the file is Unix and you want to write DOS format, use the following command:

:set ff=dos

In both examples it is assuming you are ESCaped out of edit mode and the leading “:” is required.

Note that the difference between the two formats is that:

DOS format ends each line with a CRLF (carriage-return line-feed) pair.
Unix format ends each line with a simple LF (line feed).

Neither of these forms should be confused with the C language string delimiter ‘NUL’ which is an ASCII “zero”. That however is an entirely different subject.

#———————————————
# cdrom burning
wodim -devices
wodim: Overview of accessible drives (1 found) :
————————————————————————-
0  dev=’/dev/sg1′    rwrw– : ‘HL-DT-ST’ ‘DVD-RW GWA-4082N’
————————————————————————-
$ wodim -eject -tao speed=0 dev=/dev/sg1 -v -data debian-7.6.0-i386-netinst.iso
TOC Type: 1 = CD-ROM
wodim: Operation not permitted. Warning: Cannot raise RLIMIT_MEMLOCK limits.
scsidev: ‘/dev/sg1’
devname: ‘/dev/sg1’
scsibus: -2 target: -2 lun: -2
Linux sg driver version: 3.5.34
Wodim version: 1.1.11
SCSI buffer size: 64512
Device type    : Removable CD-ROM
Version        : 5
Response Format: 2
Capabilities   :
Vendor_info    : ‘HL-DT-ST’
Identification : ‘DVD-RW GWA-4082N’
Revision       : ‘CC15’
Device seems to be: Generic mmc2 DVD-R/DVD-RW.

#——————————————-
#bash to create web pages
#pdfs to html
ls *.pdf > pdflista
cut -d “.” -f1 filenames > descripts
sed -i -e ‘s/^/<a href=\”/’ pdflista
paste pdflista descripts > pdflista.html
sed -i ‘s/$/”\>\<\/a\>/’ pdflista.html
sed -i ‘s/$/\<br \/\>/’ pdflista.html

#pics to html
#!/bin/bash
# daffinitions
ls *.png > picdatafile
datafile=”picdatafile”
htmlfile=”test.html”
a=1
m=”not done”
d=” ”

#read the file
while read line
do fdata[$a]=$line
let a=a+1
done < $datafile
a=$a-1
# top
echo “<html>” > $htmlfile
echo “<body>” >> $htmlfile
echo “<h2><center>Picture list</center></h2>” >> $htmlfile
echo “<hr>” >> $htmlfile

echo “<center>” >> $htmlfile
echo “<table border=”10″>” >> $htmlfile

# middle
for (( COUNTER=1; COUNTER<=$a; COUNTER+=3 )); do
echo “<tr>” >> $htmlfile
for i in `seq 0 2`;
do
echo “<td>” >> $htmlfile
d=`echo ${fdata[$i+$COUNTER]} | sed ‘s/\([^\.]*\)\..*/\1/’`
theline='<img src=”‘${fdata[$i+$COUNTER]}'” alt=”‘${d}'” width=”300″ height=”300″ hspace=”20″ vspace=”20″>’
echo “$theline” >> $htmlfile
echo “</td>” >> $htmlfile
done
echo “</tr>” >> $htmlfile
echo “<br />” >> $htmlfile
done

echo “</table>” >> $htmlfile
echo “</center>” >> $htmlfile

#  bottom
echo “</body>” >> $htmlfile
echo “</html>” >> $htmlfile

#————————————————
# pxeboot scripts
# openbsd pxeboot script
dhcp auto
kernel -n img http://static.netboot.me/memdisk-iso iso
initrd -n img http://ftp3.usa.openbsd.org/pub/OpenBSD/5.6/i386/cd56.iso
boot img

#netbsd in progress
dhcp net0

initrd http://192.168.1.32/netbsd/netbsd.img
kernel http://192.168.1.32/netbsd/pxeboot_ia32.bin
boot

#——————————————————
# local dns file setup
sudo vim /etc/resolvconf/resolv.conf.d/base
sudo resolvconf  -u

———————————————-

(old) Ubuntu for the Nslu2

Partial installation instructions for the NSLU2 At Your own risk.
This page describes the installation of a minimal ubuntu system on a Linksys NSLU2 NAS device. We bear no responsibility if you do this as you do this at your own risk to self or the equipment.

Requirements

USB Key (or USB disk) to attach to the NSLU2 to carry the root filesystem (connect this before starting the installation procedure)
A second machine to run an ssh client on in which you execute the installation

Getting the software
Get the latest installer image from:
http://ports.ubuntu.com/ubuntu-ports/dists/jaunty/main/installer-armel/current/images/ixp4xx/netboot/di-nslu2.bin
ld-releases.ubuntu.com/ubuntu/dists/jaunty/main/installer-armel/current/images/ixp4xx/netboot/
To install the image you need the upslug2 tool installed

sudo apt-get install upslug2

Put your NSLU2 into upgrade mode

Poweroff the device
Hold down the reset button in powered down state
Press and release the power button of the device
Wait until the status LED turns red, now quickly release the reset button (See note below)
The status LED will start alternating between red and green, your device is now in upgrade mode

Note: Older NSLU2s have a clearly red LED but later model (late 2006 and younger) are not so clearly distinguishable

Uploading the installer firmware
Run the following command on a system that is connected to the same wired network as your NSLU2

sudo upslug2 -i di-nslu2.bin

By default, upslug2 will look for the NSLU2 on the network connected to the eth0 interface of your machine. If you have multiple network interfaces and the NSLU2 is not connected to eth0, you have to specify the network interface with the -d option (for example, -d eth1).
After the upslug2 tool is done flashing the firmware image, your NSLU2 will automatically be rebooted into the ubuntu installer. Wait some minutes to give it the time to generate ssh keys and set up the hardware, then you can try to connect to actually start the install.

Connecting to the device to start the installation
If you have a DHCP server in your network, make sure you have access to the logs to see which address the NSLU2 recieved. If you don’t have a DHCP server, the device will default to 192.168.1.77 for its IP address. Connect to the NSLU2 with the command below.

ssh installer@192.168.1.77

Note: if you are upgrading an already flashed NSLU2 or the system was previously configured the NSLU2 will use that configuration. for information about resetting network configuration see the Resetting Network Configuration.
The installer password used is “install”, please follow the install guide to install your system now.

Alpha5 errata
Directly after the installer downloaded additional installer components, hit the tab key to select “Go back”, there make sure to have unselected all languages, else your installation will take a very long time.

Resetting Network Configuration
The network settings of an NSLU2 persist though the flashing of the system. If the system is of an unknown state before flashing or is upgrading a flashed system with an unknown networking configuration the system can be reset with the linksys firmware.

Flash with Linksys Firmware
If the system is already flashed with linksys firmware this step can be skipped.

Download and extract linksys firmware (Firmware) Older version it should get you up and running for another flash. Cisco no longer supports this device. The original link is dead, but you might still find it on the net or contact Cisco directly.

Put the system in upgrade mode (see Put Your NSLU2 Into Upgrade Mode)
Upload the linksys firmware using upslug2

sudo upslug2 -i ./NSLU2_V23R63.bin

Reset Configuration

Power on NSLU2 and wait for the system to boot
Press and hold the the reset button for 2 seconds. You should hear a beep from the NSLU2 indicating that the reset completed properly
Power cycle the device
Verify that the system is using DHCP or defaulting to 192.168.1.77
Repeat the installation process (see Put Your NSLU2 Into Upgrade Mode)

Using command line tools to find out about a document.

#!/bin/bash
# data file
INPUT=$1
let a=0
echo “The file: $1″
echo ” ——————–”
# while loop
while IFS= read -r -n1 char
do
#let a=$a+1
# display one character at a time
echo -n “$char”
done < “$INPUT”
#echo “The total characters are $a”
echo
echo ” ——————–”
vowel_no= cat $1 | tr -d ‘ ‘ | tr -cd \AEIOUaeiou\ | wc -c ; echo “The vowel count is: $vowel_no”

character_no= cat $1 | wc -c ; echo “The character count is: $character_no”

consonent_no= cat $1 | tr -d ‘ ‘ | tr -cd \BCDFGHJKLMNPQRSTVWXYZbcdfghjklmnpqrstvwxyz\ | wc -c ; echo “The consonent count is $consonent_no”

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

Led throwie from Hackaday.com. “An LED-throwie which only activates at dawn or night. Add a magnet and you can stick it at metallic surfaces.  ATTENTION: For red, yellow and orange use a 120 Ohm resistor. For blue, green or white no resistor is needed.”  Looks neat, but wish it used some parts that I am more familiar with. Wonder if you could not use just any pnp transistor. And etc…Per NTE:
?
T 2N4401 = 123AP or 2n3906 or 2N2222?
R GL5516 = generic photo resistor

Polenta con spinaci.

SUNP0102

Good day.

Advertisements