Monday, March 11, 2019

Fwd: ssh pi

Remember to try this tip to get Rasbian running headless.

it says:
Once you've burned/etched the Raspbian image onto the microSD card, connect the card to your working PC and you'll see the card being mounted as "boot". Inside this "boot" directory, you need to make 2 new files. You can create the files using Atom code editor.

Step 1: Create an empty file. You can use Notepad on Windows or TextEdit to do so by creating a new file. Just name the file ssh. Save that empty file and dump it into boot partition (microSD).

Step 2: Create another file name wpa_supplicant.conf . This time you need to write a few lines of text for this file. For this file, you need to use the FULL VERSION of wpa_supplicant.conf. Meaning you must have the 3 lines of data namely country, ctrl_interface and update_config


Sunday, March 10, 2019

audio thru USB device

audio thru USB device

make sure user is in "audio" group

uppercase L to list devices, then aplay to play to device

peter@smallfry:/mnt/Music/Music/iTunes/iTunes Music/Deacon Blue/Raintown $ aplay -L
null
    Discard all samples (playback) or generate zero samples (capture)
default:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
sysdefault:CARD=ALSA
    bcm2835 ALSA, bcm2835 ALSA
    Default Audio Device
dmix:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample mixing device
dmix:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample mixing device
dsnoop:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct sample snooping device
dsnoop:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct sample snooping device
hw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Direct hardware device without any conversions
hw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Direct hardware device without any conversions
plughw:CARD=ALSA,DEV=0
    bcm2835 ALSA, bcm2835 ALSA
    Hardware device with all software conversions
plughw:CARD=ALSA,DEV=1
    bcm2835 ALSA, bcm2835 IEC958/HDMI
    Hardware device with all software conversions
default:CARD=UA1A
    EDIROL UA-1A, USB Audio
    Default Audio Device
sysdefault:CARD=UA1A
    EDIROL UA-1A, USB Audio
    Default Audio Device
front:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    Front speakers
surround21:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    2.1 Surround output to Front and Subwoofer speakers
surround40:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    4.0 Surround output to Front and Rear speakers
surround41:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    4.1 Surround output to Front, Rear and Subwoofer speakers
surround50:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    5.0 Surround output to Front, Center and Rear speakers
surround51:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    5.1 Surround output to Front, Center, Rear and Subwoofer speakers
surround71:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    7.1 Surround output to Front, Center, Side, Rear and Woofer speakers
iec958:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    IEC958 (S/PDIF) Digital Audio Output
dmix:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    Direct sample mixing device
dsnoop:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    Direct sample snooping device
hw:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    Direct hardware device without any conversions
plughw:CARD=UA1A,DEV=0
    EDIROL UA-1A, USB Audio
    Hardware device with all software conversions
peter@smallfry:/mnt/Music/Music/iTunes/iTunes Music/Deacon Blue/Raintown $ aplay -D "hw:CARD=UA1A,DEV=0" "../../../iTunes Music/Soup Dragons/Unknown Album/I'm Free.wav"


Playing WAVE '../../../iTunes Music/Soup Dragons/Unknown Album/I'm Free.wav' : Signed 16 bit Little Endian, Rate 44100 Hz, Stereo


ffmpeg to convert to PCM and pipe to aplay

ffmpeg -i 01\ Peter\ and\ the\ Wolf.m4a  -f wav pipe:1 | aplay -D "hw:CARD=UA1A,DEV=0" -


curl http://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_q | ffmpeg -i - -f wav pipe:1 | aplay -D "hw:CARD=UA1A,DEV=0" -

or one pipe less

ffmpeg -i http://bbcmedia.ic.llnwd.net/stream/bbcmedia_6music_mf_p -f wav pipe:1 | aplay -D "hw:CARD=UA1A,DEV=0" -



Thursday, September 17, 2015

mdadm software RAID


Great instructions at:


http://www.ducea.com/2009/03/08/mdadm-cheat-sheet/


though after the sfdisk part re-install GRUB on the new disk

sudo grub-install /dev/sdX # Example: sudo grub-install /dev/sda
found at
https://help.ubuntu.com/community/Grub2/Installing


someting still not right, won't boot from new disk. new instructions on Grub.
http://lists.us.dell.com/pipermail/linux-poweredge/2003-July/008898.html



Friday, May 29, 2015

wifi notes

Enable WiFi, but disable networking.

List available interfaces
sudo airmon-ng

Start monitor mode, assuming wlan0 appears above, substitute alternatives
sudo airmon-ng start wlan0

See what's going on, scanning not saving, note channel, ssid and APs MAC
sudo airodump-ng mon0

fix channel 11, AP mac 00:, and save to a file called SSID (change the name):
sudo airodump-ng -c 11 --bssid 00:00:00:00:00:00 -w SSID mon0

crack WEP key, with only one AP in the file, it'll be selected as target, substitute pcap names
aircrack-ng SSID*.cap

decrypt the pcap, substitute key and AP's MAC
airdecap-ng -w Key-from-crack -b 00:00:00:00:00:00 SSID-##.cap

view the content with foremost or chaosreader

Tuesday, May 26, 2015

tunnel and mount a cifs/samba share

mountpoint Z:

mkdir Z

set-up Local listener tunnel, 9445 is my choice, my-fileserver is the hostname on the remote network,  445 is the actual SMB listener number port, files.network.org, is my ssh entry to the remote network. -f Fork/background listener, N no command.

ssh -L 9445:my-fileserver:445 -fN files.network.org

Mount CIFS type, localhost is this machine, /files/ is the share on the remote file server, Z is my mountpoint. remoteuser is the user on the file server, uid i can't remember, noperm means don't locally worry about permissions, port should be the tunnel choice above.

sudo mount -t cifs //localhost/files/ Z/ -o username=remoteuser,uid=5000,rw,noperm,port=9445

Sunday, February 2, 2014

Here strings, three less-than-signs

something i just learned about: the here string, rather than echo pipe to command, it is quicker.


flatmac:~ peter$ a="london 43 smog cafes thames uk"
flatmac:~ peter$ read City Value Bad Good Positive Country <<< $a
flatmac:~ peter$ echo $City
london
flatmac:~ peter$ echo $Good
cafes
flatmac:~ peter$ echo $Country
uk


...or if the delimiter is different, this also works though I need to find out how the IFS assignment and read command work together.
flatmac:record peter$ a="london|43|smog|nice shops|river thames|uk"
flatmac:record peter$ IFS='|' read City Value Bad Good Positive Country <<< "$a"
flatmac:record peter$ echo $Positive
river thames
flatmac:record peter$ echo $City
london



Monday, January 27, 2014

sudo for a new user

1. Don't edit /etc/sudoers

when it has this line:
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL


use this to add the user to sudo:
sudo usermod -a -G sudo peter

-a means additional group for this user.
-G is the group. Uppercase may be excessive, should check if lower will do.