Thursday, 3 November 2016

rsync from android MTP . . freezy/hangy problems. s/rsync/crude script/

Samsung Galaxy Nexus.
3.8G of photos in internal storage.
Options are MTP "mounting" or PTP.
Ubuntu 14.xx

1.

First attempt copying using file manager . . . started out okay. Reported 3.8G will be copied over in 7 mins . . 15 mins . . later 1 hour and x mins. And it was getting stuck / hanging up (looked like at the same point).

Unplug/replug USB did not bring back MTP connection after hang. Needed to go to phone USB computer connection Settings and un-check and then re-check MTP to recover it.

2.

rsync
cd /run/user/1000/gvfs/
cd mtp* # e.g. mtp::host=%5Busb%3A001%2C017%5D/
cd "Internal storage/DCIM"
rsync -avzhP ./ ~/Pictures/201611FionnOldMobilePhone/DCIM/
see errors like this:

          1.59M 100%    1.67MB/s    0:00:00 (xfr#1834, to-chk=957/2800)
Camera/IMG_20130808_123846.jpg
          1.98M 100%    1.25MB/s    0:00:01 (xfr#1835, to-chk=956/2800)
rsync: read errors mapping "/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C017%5D/Internal storage/DCIM/Camera/IMG_20130808_123846.jpg": No data available (61)
Camera/IMG_20130808_123902.jpg
          1.43M 100%    1.57MB/s    0:00:00 (xfr#1836, to-chk=955/2800)
rsync: read errors mapping "/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C017%5D/Internal storage/DCIM/Camera/IMG_20130808_123902.jpg": No data available (61)
Camera/IMG_20130808_124320.jpg
          1.58M 100%    1.21MB/s    0:00:01 (xfr#1837, to-chk=954/2800)
rsync: read errors mapping "/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C017%5D/Internal storage/DCIM/Camera/IMG_20130808_124320.jpg": No data available (61)
Camera/IMG_20130808_124435.jpg
          1.54M 100%    2.00MB/s    0:00:00 (xfr#1838, to-chk=953/2800)
rsync: read errors mapping "/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C017%5D/Internal storage/DCIM/Camera/IMG_20130808_124435.jpg": No data available (61)
Camera/IMG_20130808_124530.jpg
          1.90M 100%    1.54MB/s    0:00:01 (xfr#1839, to-chk=952/2800)
rsync: read errors mapping "/run/user/1000/gvfs/mtp:host=%5Busb%3A001%2C017%5D/Internal storage/DCIM/Camera/IMG_20130808_124530.jpg": No data available (61)
Camera/IMG_20130808_124625.jpg
         32.77K   1%  126.98kB/s    0:00:17 
. . restarted . .
. . stuck again . . 

. . seemed to be getting stuck on the same files . . 
 
These errors seem to be encountered if rsyncing from files which get changed while sync happens.  I think android should not be changing them. I don't think MTP would expose corrupt disk problem ? Something like antivirus locking the files should not be problem. Anyway, MTP connection a bit flaky . . maybe something on the android side is locking files or MTP drivers are a bit funny.
 
3.
 
Tried rsync with --remove-source-files on whole and on file selections (e.g. Camera/IMG_201606*) still got stuck. Each time after hang needed to go into droid unselect MTP and select again to connect again. At least files to be checked/transferred are being reduced now by removing them after they are synced.



    rsync -avzhP --remove-source-files ./ ~/Pictures/201611FionnOldMobilePhone/DCIM/

4.
 
rsync was getting stuck on the same file all the time. cp seemed to have less of a hanging problem. more tolerant of read errors? So made a script to do copy and remove if copy successful.

    # Script using cp -p (and remove files as we go)
    DEST=/home/jamesc/Pictures/201611FionnOldMobilePhone/DCIM/Camera/
    cd /run/user/1000/gvfs/mtp*/Intern*/DCIM
    FILES=$(ls Camera/)
    for f in $FILES; do echo -n $f; cp -p Camera/$f $DEST/ && rm Camera/$f && echo success; done

This was run in a while true loop periodically recovering MTP connection when it hung.
 
      while true; do ~/bin/sync_flaky_mtp.sh; sleep 1; done

The script saw some funny errors e.g. :
 
    IMG_20130814_113108.jpgsuccess
    IMG_20130815_145354.jpgsuccess
    IMG_20130815_145455.jpgcp: error reading ‘Camera/IMG_20130815_145455.jpg’: Input/output error
    cp: failed to extend ‘/home/jamesc/Pictures/201611FionnOldMobilePhone/DCIM/Camera/IMG_20130815_145455.jpg’: Input/output error
    IMG_20130815_145500.jpgsuccess
    IMG_20130815_151552.jpgsuccess
    . . .
    IMG_20130824_095526.jpgsuccess
    IMG_20130824_095537.jpg

And it would hang . . . periodically recovered MTP connection as already described.
 
5.
 
The script evolved . . . 

    Binary files Camera/IMG_20160104_095626.jpg and /home/jamesc/Pictures/201611FionnOldMobilePhone/DCIM/Camera//IMG_20160104_095626.jpg differ
    IMG_20160104_100128.jpgalready
    RM
    IMG_20160104_100157.jpgalready

       #!/bin/bash
DEST=/home/jamesc/Pictures/201611FionnOldMobilePhone/DCIM/Camera/
cd /run/user/1000/gvfs/mtp*/Intern*/DCIM
FILES=$(ls Camera/)
#echo FILES=$FILES
ls Camera/ |wc -l
for f in $FILES; do
   echo -n $f;
   if [[ ! -e $DEST/$f ]]; then
      # the timeout doesn't work on frozen mtp file
             # we run this full script in a while true; do ~/bin/sync_flaky_mtp.sh; sleep 1; done loop
             # and periodically visit, if stuck unlock phone, deselect MTP and select it again
             # (to interrupt and restart MTP connection)
             # simply unplug & replug doesn't bring MTP connection back ok
      timeout 20s cp -p Camera/$f $DEST/ && rm Camera/$f && echo success;
   else
      echo already done by earlier script which did not tidy up;
      diff -u Camera/$f $DEST/$f
      if [[ $? == 0 ]]; then
         rm Camera/$f && echo RM
      else
         # doing this copy on the weird files causes nasty freezy freezes.
         #cp -p Camera/$f $DEST/$f && rm Camera/$f && echo success;
                # ALOT of files found to be a few bytes different.
                # another copy caused hanging . . . so if dest file kindof looks ok we just remove source
         identify $DEST/$f && rm Camera/$f && echo RM
      fi
   fi;
done

beep

    # a few bytes in size different
    ls -al Camera/IMG_20150117_171621.jpg $DEST/Camera/IMG_20150117_171621.jpg
      -rw------- 1 jamesc jamesc 1277901 Jan 17  2015 Camera/IMG_20150117_171621.jpg
      -rwxr----- 1 jamesc jamesc 1275306 Nov  3 01:09 $DEST/Camera/IMG_20150117_171621.jpg
 
    # copy again ? results in same size difference, date/time fixed up though
    cp -p Camera/IMG_20150117_171621.jpg $DEST/Camera/IMG_20150117_171621.jpg
    ls -al Camera/IMG_20150117_171621.jpg $DEST/Camera/IMG_20150117_171621.jpg
      -rw------- 1 jamesc jamesc 1277901 Jan 17  2015 Camera/IMG_20150117_171621.jpg
      -rw------- 1 jamesc jamesc 1275306 Jan 17  2015 $DEST/Camera/IMG_20150117_171621.jpg
    diff -u Camera/IMG_20150117_171621.jpg $DEST/Camera/IMG_20150117_171621.jpg
      Binary files Camera/IMG_20150117_171621.jpg and $DEST/Camera/IMG_20150117_171621.jpg differ

So EVENTUALLY by removing files we had already copied we had less and less to do and got through all files. Phew. And yay.

    du -h $DEST/.. --max-depth=0
      3.6G    /home/jamesc/Pictures/201611FionnOldMobilePhone/DCIM/Camera//..


Various other reading . . . 



Tuesday, 18 October 2016

char c; int i; c[&i]; // index a simple var using pointer in c compiles (and runs often without segfault)


    char c;
    int i;
    printf("%02x",c[&i]);
    //printf("%02x",c[i]); // doesn't compile, error, cannot access c as array
    // "error: subscripted value is neither array nor pointer nor vector"


c[&i] there is SOOOO BAD and WROOONG. Semantically wrong. But apparently not syntactically wrong in c.

Why does it compile?
Because 1. array[i] == *(array+i) == *(i+array) == i[array]
And 2. c casts char to int happily

In case of c[&i] c is the index added to pointer &i.
Now &i + value of c indexes an undefined area of memory so it is not good to use this!!


    char c;
    int i[10];
    // normal access into array (bad to use a char as array index though)
    for(c=0;c<10;c++) printf("%02x",i[c]); // normal-ish
    for(c=0;c<10;c++) printf("%02x",*(i+c)); // equivalent pointer arithmetic
    for(c=0;c<10;c++) printf("%02x",*(c+i)); // equivalent
    for(c=0;c<10;c++) printf("%02x",c[i]);    // allowed BUT NOT NORMAL



    char c;
    int i;
    int buffer[20]; // buffer helps prog not seg fault!
    // abnormal access into memory at offset of (int)c from &i
    //for(c=0;c<10;c++) printf("%02x",&i[c]); // COMPILE ERROR
    for(c=0;c<10;c++) printf("%02x",*(&i+c)); // a bit weird
    for(c=0;c<10;c++) printf("%02x",*(c+&i)); // not normal
    for(c=0;c<10;c++) printf("%02x",c[&i]);    // but it compiles and runs(mostly)

    for(c=0;c<10;c++) printf("%02x,",i[&c]); // this is all
    printf(" ");
    for(c=0;c<10;c++) printf("%02x,",*(i+&c)); // a bit weird
    printf(" ");
    for(c=0;c<10;c++) printf("%02x,",*(&c+i)); // not normal
    //for(c=0;c<10;c++) printf("%02x,",&c[i]);    // COMPILE ERROR
    printf("\n");



While answering this question:
http://stackoverflow.com/questions/40116073/c-duplicate-character-character-by-character/40117178#40117178

Asked this question:
http://stackoverflow.com/questions/40118549/in-c-ci-compiles-where-c-and-i-are-variables-not-arrays-pointers-but-i

Monday, 26 September 2016

Reset Windows 7 Administrator account (or any user account) password

Had some fun on Sunday trying to get access to Admin account on Windows 7 laptop. 
I attempted some other methods but what eventually worked for me was a bit of a hack/trick. Replace sethc.exe (sticky keys) with cmd.exe and trigger sticky keys (sticky keys is run as Administrator). This was done through using Notepad.exe which is run to view logfiles after system recovery. Other techniques to get in on command-line as admin with drive mounted didn't work. This trick is at least quite amusing :-) also simple and portable :-D. 
Background: The Administrator password with laptop was not known. There was a user account with admin privs so users didn't find the need of it. UNTIL the windows login page stopped showing their user! We are guessing the User profile became corrupt or had something bad in it.
I attempted a series of procedures before getting the Notepad+sticky keys replace hack to work. For the record here they are (and the problem I encountered with them):
  1. When trying to log in as Administrator after an incorrect password you are prompted to insert rescue disk (in order to reset password). We had a Windows 7 rescue disk on cd. But the prompt asked for floppy or USB. I had no handy USB stick and was too lazy to go shopping and messing with creating USB boot disk.
  2. Using system repair disk to get in on command-line did not allow the replacing of sethc.exe with cmd.exe trick/hack. Or allow resetting admin password 'net use Administrator *'. The command-line was running as admin but not as the real admin on machine more as the system repair admin and the disk did not seem to be mounted with full access . . . ~ not sure ~
  3. Using linux system rescue cd (https://www.system-rescue-cd.org (version 4.8.2)) I could not mount the drive. I would kindof see it was a GPT partitioned drive - tools ntfs-3g gparted sfdisk should work with GPT but didn't. This computer has a prompt for username + domain + password before windows starts so not sure but maybe there is some extra security (which is needed to mount drive?)
  4. We looked at recovering the User Profile - editing registry - but . . . 
What eventually DID work was follow system recover sequence (no external/additional cd needed) at end view logfile (opens in Notepad). Then do file open - browse to cmd.exe - copy - paste - overwrite sethc.exe. Then reboot - trigger sticky keys - set password using command-line 'net user Administrator *'.
Procedure:
  1. Shutdown and reboot. When Windows starting is seen hold down the power button and power off.
  2. Power on. Windows boot should report that last Windows start up failed so it will give the option of "Launch startup repair". Choose this option.
  3. Cancel the Startup Repair. Cancel the System Restore.
  4. A report dialog will show reporting repair could not be done. In there expand "View problem details". Under problem details a link to x:/windows/... log file is shown. Click on this.
  5. Notepad.exe opens showing the logfile. This Notepad is running as Administrator and the mounted filesystem x: is your hard disk.
    5.1 Notepad: File - Open - browse to X:/Windows/system32 - scroll to sethc.exe
    5.2 Right-click on sethc.exe and rename to sethc-BACKUP.exe
    5.3 Scroll to cmd.exe. Right-click on cmd.exe. Copy. Right click. Paste.
    5.4. When I pasted cmd.exe the command-line ran (as Administrator) so I did 'cd x:/Windows/system32' and then 'copy cmd.exe sethc.exe' on command-line.
    5.4-1 If you prefer not command-line then just use Notepad File Open browser and make a copy of cmd.exe and rename it to sethc.exe
  6. Reboot without any funny stuff.
  7. At login page hit shift key 5 times or more triggering sticky keys. Instead of sticky keys prompt a command-line dialog appears. Running as Administrator. 'net user Administrator *' to set the password.
Good description with screenshots of the procedure here: http://null-byte.wonderhowto.com/how-to/hack-windows-7-become-admin-0160151/

The rsync of old user to new user after successful recover. And a game of blockus :-)


In conclusion, this solution doesn't require you to have any extra boot or repair CD. It is very portable :-) It is pretty simple. So it is probably worth trying as one of the first password recovery methods.
We finished up Sunday with making a new user, failing to copy files from old user -> new user using windows, installing cygwin with rsync, rsyncing from old user -> new user (-avzhP and excluding ntdata files and a few other). Then backing up stuff generally. Took ages (3/4hours?) but successful recover at the end, phew.

Saturday, 24 September 2016

Recipe: Mackerel with spinach and apple

Recipe: Mackerel with spinach and apple

As usual winging it in the kitchen. Successful and tasty soup and fish for tea today.
The selection of ingredients depends often on what is there, what needs to be used.

Apple baked with the mackerel was a nice combination. James & Fionnuala and the girls liked it alot.

Ingredients:
    2 plums
    2-3 tomatoes
    4 mushrooms (optional but good especially if you have a wife who loves them!)
    half a red onion
    mackerel - 3 fillets (Aldi's best)
    apple - tart(as in a bit sour) (my Mum and Dad brought some up from Cobh this Monday)
    spinach - we got a bag with the organic fruit & veg box
    oil, salt, pepper
    squeeze of lemon

Method:
   Turn on oven ~190 degrees.
   De-stone and slice plums, slice tomatoes, slice & dice onion, remove stalk from mushrooms.
   Put those in pyrex baking dish (some oil in first) and mix and put in oven.
   Shred/Chop some spinach - add spinach to dish in oven and mix in.
      (this was done a while after the rest baked a bit as I was making soup @ the same time).
   Add a small amount of lemon juice to dish in oven.
   Stir the dish in oven once or twice.
   Keep 3 large spinach leaves aside for the fish.

   Slice apple into wedges (quarter the apple, remove core/pips, slice).
   Take fish out of packet, rinse.
   Lay fish on a dish(I had it in a jug), season, put on oil, put apple on top.
   Squeeze on a small amount of lemon juice.
 
   13 mins to serving time put on the fish:
       Lay each fillet on a spinach leaf and lay wedges of apple on top.
       Lay side by side on top of the dish in oven.

   The apple stuck to top of mackerel and spinach stuck under.
   The spinach+fish+apple were easy to lift off and put on plate.
   Serve the mix underneath beside the fish.

https://en.wikipedia.org/wiki/Mackerel

--------------------------------------
We had soup with fish (and for he who didn't fancy fish):

Soup with 3 potatoes diced, half a butternut squash (deseeded but with skin) diced, 1 leek, 2 small carrots diced, some turmeric (the real root - small slices), grated ginger, chopped spinach, a black chilli pepper, a jug of vegetable broth(or stock), water, seasoning (salt, pepper, curry powder)
In that order (more or less) add ingredients and fry with oil first. Stirring frequently. If taking too long dicing and there is danger of burning then add some broth. You want to fry/broil the hard veg for a bit. I had broth from cooking potatoes + carrot + onion earlier in day. Add enough water at end to give a nice soup consistency not too thick. Spinach was added at end after heat was turned off.
After all cooked then buzz to smooth.

Serve with toast & butter.

--------------------------------------
Earlier on we had mash potato with black pudding, brocolli and eggs. (and some beans)

Mashed potato.
Potatoes roughly chopped. Carrot diced. Onion diced.
Boil potatoes with a small amount of salt in water. (some brine from an olive jar does nicely)
Add carrot and onion.
When potatoes  cooked (not soft/disentegrating) drain.
Keep the broth for making soup later.
Add some butter and a splash on milk.
Mash.

Serve with black pudding, egg, brocolli stalk and head fried with turmeric.
--------------------------------------

Friday, 5 August 2016

Major and minor chord notes and positions on guitar fretboard.

Useful for when you figure out nots in a tune and wish to fit chords to play along.


Major and Minor chord notes

A  Major chord  A   C#  E   A
A  Minor chord  A   C   E   A
A# Major chord  A#  D   F   A#
A# Minor chord  A#  C#  F   A#
B  Major chord  B   D#  F#  B
B  Minor chord  B   D   F#  B
C  Major chord  C   E   G   C
C  Minor chord  C   D#  G   C
C# Major chord  C#  F   G#  C#
C# Minor chord  C#  E   G#  C#
D  Major chord  D   F#  A   D
D  Minor chord  D   F   A   D
D# Major chord  D#  G   A#  D#
D# Minor chord  D#  F#  A#  D#
E  Major chord  E   G#  B   E
E  Minor chord  E   G   B   E
F  Major chord  F   A   C   F
F  Minor chord  F   G#  C   F
F# Major chord  F#  A#  C#  F#
F# Minor chord  F#  A   C#  F#
G  Major chord  G   B   D   G
G  Minor chord  G   A#  D   G
G# Major chord  G#  C   D#  G#
G# Minor chord  G#  B   D#  G#

Major chords on the fretboard:

 
A Major:
||| E |   |   |   |   | A |   |   |   | C#|   |   | E |   |   |   |   | A |   |   |
|||   |   | C#|   |   | E |   |   |   |   | A |   |   |   | C#|   |   | E |   |   |
|||   |   | A |   |   |   | C#|   |   | E |   |   |   |   | A |   |   |   | C#|   |
|||   |   | E |   |   |   |   | A |   |   |   | C#|   |   | E |   |   |   |   | A |
||| A |   |   |   | C#|   |   | E |   |   |   |   | A |   |   |   | C#|   |   | E |
||| E |   |   |   |   | A |   |   |   | C#|   |   | E |   |   |   |   | A |   |   |
A# Major:
|||   | F |   |   |   |   | A#|   |   |   | D |   |   | F |   |   |   |   | A#|   |
|||   |   |   | D |   |   | F |   |   |   |   | A#|   |   |   | D |   |   | F |   |
|||   |   |   | A#|   |   |   | D |   |   | F |   |   |   |   | A#|   |   |   | D |
||| D |   |   | F |   |   |   |   | A#|   |   |   | D |   |   | F |   |   |   |   |
|||   | A#|   |   |   | D |   |   | F |   |   |   |   | A#|   |   |   | D |   |   |
|||   | F |   |   |   |   | A#|   |   |   | D |   |   | F |   |   |   |   | A#|   |
B Major:
|||   |   | F#|   |   |   |   | B |   |   |   | D#|   |   | F#|   |   |   |   | B |
||| B |   |   |   | D#|   |   | F#|   |   |   |   | B |   |   |   | D#|   |   | F#|
|||   |   |   |   | B |   |   |   | D#|   |   | F#|   |   |   |   | B |   |   |   |
|||   | D#|   |   | F#|   |   |   |   | B |   |   |   | D#|   |   | F#|   |   |   |
|||   |   | B |   |   |   | D#|   |   | F#|   |   |   |   | B |   |   |   | D#|   |
|||   |   | F#|   |   |   |   | B |   |   |   | D#|   |   | F#|   |   |   |   | B |
C Major:
||| E |   |   | G |   |   |   |   | C |   |   |   | E |   |   | G |   |   |   |   |
|||   | C |   |   |   | E |   |   | G |   |   |   |   | C |   |   |   | E |   |   |
||| G |   |   |   |   | C |   |   |   | E |   |   | G |   |   |   |   | C |   |   |
|||   |   | E |   |   | G |   |   |   |   | C |   |   |   | E |   |   | G |   |   |
|||   |   |   | C |   |   |   | E |   |   | G |   |   |   |   | C |   |   |   | E |
||| E |   |   | G |   |   |   |   | C |   |   |   | E |   |   | G |   |   |   |   |
C# Major:
|||   | F |   |   | G#|   |   |   |   | C#|   |   |   | F |   |   | G#|   |   |   |
|||   |   | C#|   |   |   | F |   |   | G#|   |   |   |   | C#|   |   |   | F |   |
|||   | G#|   |   |   |   | C#|   |   |   | F |   |   | G#|   |   |   |   | C#|   |
|||   |   |   | F |   |   | G#|   |   |   |   | C#|   |   |   | F |   |   | G#|   |
|||   |   |   |   | C#|   |   |   | F |   |   | G#|   |   |   |   | C#|   |   |   |
|||   | F |   |   | G#|   |   |   |   | C#|   |   |   | F |   |   | G#|   |   |   |
D Major:
|||   |   | F#|   |   | A |   |   |   |   | D |   |   |   | F#|   |   | A |   |   |
|||   |   |   | D |   |   |   | F#|   |   | A |   |   |   |   | D |   |   |   | F#|
|||   |   | A |   |   |   |   | D |   |   |   | F#|   |   | A |   |   |   |   | D |
||| D |   |   |   | F#|   |   | A |   |   |   |   | D |   |   |   | F#|   |   | A |
||| A |   |   |   |   | D |   |   |   | F#|   |   | A |   |   |   |   | D |   |   |
|||   |   | F#|   |   | A |   |   |   |   | D |   |   |   | F#|   |   | A |   |   |
D# Major:
|||   |   |   | G |   |   | A#|   |   |   |   | D#|   |   |   | G |   |   | A#|   |
|||   |   |   |   | D#|   |   |   | G |   |   | A#|   |   |   |   | D#|   |   |   |
||| G |   |   | A#|   |   |   |   | D#|   |   |   | G |   |   | A#|   |   |   |   |
|||   | D#|   |   |   | G |   |   | A#|   |   |   |   | D#|   |   |   | G |   |   |
|||   | A#|   |   |   |   | D#|   |   |   | G |   |   | A#|   |   |   |   | D#|   |
|||   |   |   | G |   |   | A#|   |   |   |   | D#|   |   |   | G |   |   | A#|   |
E Major:
||| E |   |   |   | G#|   |   | B |   |   |   |   | E |   |   |   | G#|   |   | B |
||| B |   |   |   |   | E |   |   |   | G#|   |   | B |   |   |   |   | E |   |   |
|||   | G#|   |   | B |   |   |   |   | E |   |   |   | G#|   |   | B |   |   |   |
|||   |   | E |   |   |   | G#|   |   | B |   |   |   |   | E |   |   |   | G#|   |
|||   |   | B |   |   |   |   | E |   |   |   | G#|   |   | B |   |   |   |   | E |
||| E |   |   |   | G#|   |   | B |   |   |   |   | E |   |   |   | G#|   |   | B |
F Major:
|||   | F |   |   |   | A |   |   | C |   |   |   |   | F |   |   |   | A |   |   |
|||   | C |   |   |   |   | F |   |   |   | A |   |   | C |   |   |   |   | F |   |
|||   |   | A |   |   | C |   |   |   |   | F |   |   |   | A |   |   | C |   |   |
|||   |   |   | F |   |   |   | A |   |   | C |   |   |   |   | F |   |   |   | A |
||| A |   |   | C |   |   |   |   | F |   |   |   | A |   |   | C |   |   |   |   |
|||   | F |   |   |   | A |   |   | C |   |   |   |   | F |   |   |   | A |   |   |
F# Major:
|||   |   | F#|   |   |   | A#|   |   | C#|   |   |   |   | F#|   |   |   | A#|   |
|||   |   | C#|   |   |   |   | F#|   |   |   | A#|   |   | C#|   |   |   |   | F#|
|||   |   |   | A#|   |   | C#|   |   |   |   | F#|   |   |   | A#|   |   | C#|   |
|||   |   |   |   | F#|   |   |   | A#|   |   | C#|   |   |   |   | F#|   |   |   |
|||   | A#|   |   | C#|   |   |   |   | F#|   |   |   | A#|   |   | C#|   |   |   |
|||   |   | F#|   |   |   | A#|   |   | C#|   |   |   |   | F#|   |   |   | A#|   |
G Major:
|||   |   |   | G |   |   |   | B |   |   | D |   |   |   |   | G |   |   |   | B |
||| B |   |   | D |   |   |   |   | G |   |   |   | B |   |   | D |   |   |   |   |
||| G |   |   |   | B |   |   | D |   |   |   |   | G |   |   |   | B |   |   | D |
||| D |   |   |   |   | G |   |   |   | B |   |   | D |   |   |   |   | G |   |   |
|||   |   | B |   |   | D |   |   |   |   | G |   |   |   | B |   |   | D |   |   |
|||   |   |   | G |   |   |   | B |   |   | D |   |   |   |   | G |   |   |   | B |
G# Major:
|||   |   |   |   | G#|   |   |   | C |   |   | D#|   |   |   |   | G#|   |   |   |
|||   | C |   |   | D#|   |   |   |   | G#|   |   |   | C |   |   | D#|   |   |   |
|||   | G#|   |   |   | C |   |   | D#|   |   |   |   | G#|   |   |   | C |   |   |
|||   | D#|   |   |   |   | G#|   |   |   | C |   |   | D#|   |   |   |   | G#|   |
|||   |   |   | C |   |   | D#|   |   |   |   | G#|   |   |   | C |   |   | D#|   |
|||   |   |   |   | G#|   |   |   | C |   |   | D#|   |   |   |   | G#|   |   |   |

Minor chords on the fretboard

A Major:
||| E |   |   |   |   | A |   |   | C |   |   |   | E |   |   |   |   | A |   |   |
|||   | C |   |   |   | E |   |   |   |   | A |   |   | C |   |   |   | E |   |   |
|||   |   | A |   |   | C |   |   |   | E |   |   |   |   | A |   |   | C |   |   |
|||   |   | E |   |   |   |   | A |   |   | C |   |   |   | E |   |   |   |   | A |
||| A |   |   | C |   |   |   | E |   |   |   |   | A |   |   | C |   |   |   | E |
||| E |   |   |   |   | A |   |   | C |   |   |   | E |   |   |   |   | A |   |   |
A# Major:
|||   | F |   |   |   |   | A#|   |   | C#|   |   |   | F |   |   |   |   | A#|   |
|||   |   | C#|   |   |   | F |   |   |   |   | A#|   |   | C#|   |   |   | F |   |
|||   |   |   | A#|   |   | C#|   |   |   | F |   |   |   |   | A#|   |   | C#|   |
|||   |   |   | F |   |   |   |   | A#|   |   | C#|   |   |   | F |   |   |   |   |
|||   | A#|   |   | C#|   |   |   | F |   |   |   |   | A#|   |   | C#|   |   |   |
|||   | F |   |   |   |   | A#|   |   | C#|   |   |   | F |   |   |   |   | A#|   |
B Major:
|||   |   | F#|   |   |   |   | B |   |   | D |   |   |   | F#|   |   |   |   | B |
||| B |   |   | D |   |   |   | F#|   |   |   |   | B |   |   | D |   |   |   | F#|
|||   |   |   |   | B |   |   | D |   |   |   | F#|   |   |   |   | B |   |   | D |
||| D |   |   |   | F#|   |   |   |   | B |   |   | D |   |   |   | F#|   |   |   |
|||   |   | B |   |   | D |   |   |   | F#|   |   |   |   | B |   |   | D |   |   |
|||   |   | F#|   |   |   |   | B |   |   | D |   |   |   | F#|   |   |   |   | B |
C Major:
|||   |   |   | G |   |   |   |   | C |   |   | D#|   |   |   | G |   |   |   |   |
|||   | C |   |   | D#|   |   |   | G |   |   |   |   | C |   |   | D#|   |   |   |
||| G |   |   |   |   | C |   |   | D#|   |   |   | G |   |   |   |   | C |   |   |
|||   | D#|   |   |   | G |   |   |   |   | C |   |   | D#|   |   |   | G |   |   |
|||   |   |   | C |   |   | D#|   |   |   | G |   |   |   |   | C |   |   | D#|   |
|||   |   |   | G |   |   |   |   | C |   |   | D#|   |   |   | G |   |   |   |   |
C# Major:
||| E |   |   |   | G#|   |   |   |   | C#|   |   | E |   |   |   | G#|   |   |   |
|||   |   | C#|   |   | E |   |   |   | G#|   |   |   |   | C#|   |   | E |   |   |
|||   | G#|   |   |   |   | C#|   |   | E |   |   |   | G#|   |   |   |   | C#|   |
|||   |   | E |   |   |   | G#|   |   |   |   | C#|   |   | E |   |   |   | G#|   |
|||   |   |   |   | C#|   |   | E |   |   |   | G#|   |   |   |   | C#|   |   | E |
||| E |   |   |   | G#|   |   |   |   | C#|   |   | E |   |   |   | G#|   |   |   |
D Major:
|||   | F |   |   |   | A |   |   |   |   | D |   |   | F |   |   |   | A |   |   |
|||   |   |   | D |   |   | F |   |   |   | A |   |   |   |   | D |   |   | F |   |
|||   |   | A |   |   |   |   | D |   |   | F |   |   |   | A |   |   |   |   | D |
||| D |   |   | F |   |   |   | A |   |   |   |   | D |   |   | F |   |   |   | A |
||| A |   |   |   |   | D |   |   | F |   |   |   | A |   |   |   |   | D |   |   |
|||   | F |   |   |   | A |   |   |   |   | D |   |   | F |   |   |   | A |   |   |
D# Major:
|||   |   | F#|   |   |   | A#|   |   |   |   | D#|   |   | F#|   |   |   | A#|   |
|||   |   |   |   | D#|   |   | F#|   |   |   | A#|   |   |   |   | D#|   |   | F#|
|||   |   |   | A#|   |   |   |   | D#|   |   | F#|   |   |   | A#|   |   |   |   |
|||   | D#|   |   | F#|   |   |   | A#|   |   |   |   | D#|   |   | F#|   |   |   |
|||   | A#|   |   |   |   | D#|   |   | F#|   |   |   | A#|   |   |   |   | D#|   |
|||   |   | F#|   |   |   | A#|   |   |   |   | D#|   |   | F#|   |   |   | A#|   |
E Major:
||| E |   |   | G |   |   |   | B |   |   |   |   | E |   |   | G |   |   |   | B |
||| B |   |   |   |   | E |   |   | G |   |   |   | B |   |   |   |   | E |   |   |
||| G |   |   |   | B |   |   |   |   | E |   |   | G |   |   |   | B |   |   |   |
|||   |   | E |   |   | G |   |   |   | B |   |   |   |   | E |   |   | G |   |   |
|||   |   | B |   |   |   |   | E |   |   | G |   |   |   | B |   |   |   |   | E |
||| E |   |   | G |   |   |   | B |   |   |   |   | E |   |   | G |   |   |   | B |
F Major:
|||   | F |   |   | G#|   |   |   | C |   |   |   |   | F |   |   | G#|   |   |   |
|||   | C |   |   |   |   | F |   |   | G#|   |   |   | C |   |   |   |   | F |   |
|||   | G#|   |   |   | C |   |   |   |   | F |   |   | G#|   |   |   | C |   |   |
|||   |   |   | F |   |   | G#|   |   |   | C |   |   |   |   | F |   |   | G#|   |
|||   |   |   | C |   |   |   |   | F |   |   | G#|   |   |   | C |   |   |   |   |
|||   | F |   |   | G#|   |   |   | C |   |   |   |   | F |   |   | G#|   |   |   |
F# Major:
|||   |   | F#|   |   | A |   |   |   | C#|   |   |   |   | F#|   |   | A |   |   |
|||   |   | C#|   |   |   |   | F#|   |   | A |   |   |   | C#|   |   |   |   | F#|
|||   |   | A |   |   |   | C#|   |   |   |   | F#|   |   | A |   |   |   | C#|   |
|||   |   |   |   | F#|   |   | A |   |   |   | C#|   |   |   |   | F#|   |   | A |
||| A |   |   |   | C#|   |   |   |   | F#|   |   | A |   |   |   | C#|   |   |   |
|||   |   | F#|   |   | A |   |   |   | C#|   |   |   |   | F#|   |   | A |   |   |
G Major:
|||   |   |   | G |   |   | A#|   |   |   | D |   |   |   |   | G |   |   | A#|   |
|||   |   |   | D |   |   |   |   | G |   |   | A#|   |   |   | D |   |   |   |   |
||| G |   |   | A#|   |   |   | D |   |   |   |   | G |   |   | A#|   |   |   | D |
||| D |   |   |   |   | G |   |   | A#|   |   |   | D |   |   |   |   | G |   |   |
|||   | A#|   |   |   | D |   |   |   |   | G |   |   | A#|   |   |   | D |   |   |
|||   |   |   | G |   |   | A#|   |   |   | D |   |   |   |   | G |   |   | A#|   |
G# Major:
|||   |   |   |   | G#|   |   | B |   |   |   | D#|   |   |   |   | G#|   |   | B |
||| B |   |   |   | D#|   |   |   |   | G#|   |   | B |   |   |   | D#|   |   |   |
|||   | G#|   |   | B |   |   |   | D#|   |   |   |   | G#|   |   | B |   |   |   |
|||   | D#|   |   |   |   | G#|   |   | B |   |   |   | D#|   |   |   |   | G#|   |
|||   |   | B |   |   |   | D#|   |   |   |   | G#|   |   | B |   |   |   | D#|   |
|||   |   |   |   | G#|   |   | B |   |   |   | D#|   |   |   |   | G#|   |   | B |


G Major: G A B C D E F#

    0   1   2   3   4   5   6   7   8   9   10  11  12  13  14  15  16
||| E |   | F#| G |   | A |   | B | C |   | D |   | E |   | F#| G |   | A |   | B |
||| B | C |   | D |   | E |   | F#| G |   | A |   | B | C |   | D |   | E |   | F#|
||| G |   | A |   | B | C |   | D |   | E |   | F#| G |   | A |   | B | C |   | D |
||| D |   | E |   | F#| G |   | A |   | B | C |   | D |   | E |   | F#| G |   | A |
||| A |   | B | C |   | D |   | E |   | F#| G |   | A |   | B | C |   | D |   | E |
||| E |   | F#| G |   | A |   | B | C |   | D |   | E |   | F#| G |   | A |   | B |
           xxxxxxxxxxxxxxx
            Ionian key G => G(3)
                   xxxxxxxxxxxxxxxxxxx
                    Dorian key G => A(5)
                               xxxxxxxxxxxxxxx
                                Phyrgian key G => B(7)
                               xxxxxxxxxxxxxxx
                                Lydian key G => C(8)
                                       xxxxxxxxxxxxxxxxxxx
                                        Mixolydian key G => D(10)
                                               xxxxxxxxxxxxxxxxxxx
                                                Aeolian key G => E(12)
           xxxxxxxxxxxxxxx                                 xxxxxxxxxxxxxxx
                                                            Locrian key G => F#(14)



Mode name       Notes (all natural)
ionian mode     C, D, E, F, G, A, B, C
dorian mode     D, E, F, G, A, B, C, D
phrygian mode   E, F, G, A, B, C, D, E
lydian mode     F, G, A, B, C, D, E, F
mixolydian mode G, A, B, C, D, E, F, G
aeolian mode    A, B, C, D, E, F, G, A
locrian mode    B, C, D, E, F, G, A, B

e.g. G ionian mode(normal G major): G, A, B, C, D, E, F#, G.   g-ionian-mode g-major-scale
e.g. G phrygian mode: G, Ab, Bb, C, D, Eb, F, G.   g-phrygian-mode

e.g. A7 is A mixolydian: A, B, C#, D, E, F#, G, A    Root,3rd,5th,7th: A C# E G    on guitar: 002020 = EAEGC#E  (Rx1 3x1 5x3 7x1)  7th note is played (duhrr A7)

A  Major:  A   B   C#  D   E   F#  G#  A             Root,3rd,5th,7th: A C# E G#   on guitar: 002220 = EAEAC#E  (Rx2 3x1 5x3)
 major = ionian mode

A  Minor:  A   B   C   D   E   F   G   A             Root,3rd,5th,7th: A C E G     on guitar: 002200 = EAEACE   (Rx2 3x1 5x3)
 natural minor = aeolian mode

Friday, 22 July 2016

rough rpm (and dpkg-query) quickref

HOWTO rpm quickref, -ql list files in packages, -qf show rpm source of files



Syntax Debian/Ubuntu/.. Description Example(s)
rpm -ivh [--force] {rpm-file(s)}
yum install {package-name} [more packages ...]
apt-get install {pac... Install the package rpm -ivh ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -Uvh {rpm-file} dpkg -Gi package(s).deb Upgrade package rpm -Uvh ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -Uvh --test ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -ev {package} dpkg -r package Erase/remove/ an installed package rpm -ev wireshark
rpm -ev --nodeps {package} Erase/remove/ an installed package without checking for dependencies rpm -ev --nodeps wireshark
rpm -ev --noscripts {package} Erase/remove/ an installed package without running script
## sometimes needed when the pre/post install/uninstall script has error
rpm -ev --noscripts `rpm -qg OMN`
rpm -qa
rpm -qa "*pattern*"
 dpkg-query -S {file-pattern} Display list all installed packages rpm -qa
rpm -qa | less
rpm -ql {package} dpkg -L package List files in package rpm -ql wireshark
rpm -qi {package} dpkg -s package Display installed information along with package version and short description rpm -qi wireshark
rpm -qf {/path/to/file}  dpkg-query -S {file-pattern} Find out what package a file belongs to i.e. find what package owns the file rpm -qf /apps/omn/bin
dpkg-query -S $(which bono)
rpm -q p {rpm-file}
rpm -qi p {rpm-file}
rpm -ql p {rpm-file}

dpkg -I package.deb
dpkg-query -L {package}
List version of rpm file.
List files packaged in rpm file.
List detailed info in rpm file.
rpm -ql wireshark
rpm -qlp ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -ql -p ~/Downloads/wireshark-1.99.0-1.i686.rpm
dpkg-query -L bono
rpm --rebuilddb Sometimes necessary if problems, rpm db has become corrupt.
rpm -qa --last Display list of all recently installed RPMs rpm -qa --last
rpm -qa --last | less
rpm -q --requires package
rpm -qR {package}
rpm -qR -p {.rpm-file}
rpm -q --whatrequires package
dpkg -s package | grep ^Depends
dpkg --purge --dry-run package
Find out what dependencies a rpm package or file has.
List packages dependant on this package. 
rpm -qpR ~/Downloads/wireshark-1.99.0-1.i686.rpm
rpm -qR wireshark
rpm -qg {group} dpkg-query -g {g}
dpkg-query -G {g}
List all packages in group rpm -qg "System Environment/Libraries"
rpm -qg "Applications/Internet"
rpmquery -l -p {rpm-file} // rpmquery -l {package} List files packaged in rpm file. Same as rpm -ql.



sudo rpm --import http://pkg.jenkins-ci.org/redhat/jenkins-ci.org.key




yum install `cat /tmp/rpm.list`



$ rpm --help
Usage: rpm [OPTION...]

Query/Verify package selection options:
  -a, --all                         query/verify all packages
  -f, --file                        query/verify package(s) owning file
  -g, --group                       query/verify package(s) in group
  -p, --package                     query/verify a package file
      --pkgid                       query/verify package(s) with package identifier
      --hdrid                       query/verify package(s) with header identifier
      --triggeredby                 query the package(s) triggered by the package
      --whatrequires                query/verify the package(s) which require a dependency
      --whatprovides                query/verify the package(s) which provide a dependency
      --nomanifest                  do not process non-package files as manifests

Query options (with -q or --query):
  -c, --configfiles                 list all configuration files
  -d, --docfiles                    list all documentation files
  -L, --licensefiles                list all license files
      --dump                        dump basic file information
  -l, --list                        list files in package
      --queryformat=QUERYFORMAT     use the following query format
  -s, --state                       display the states of the listed files

Verify options (with -V or --verify):
      --nofiledigest                don't verify digest of files
      --nofiles                     don't verify files in package
      --nodeps                      don't verify package dependencies
      --noscript                    don't execute verify script(s)

Install/Upgrade/Erase options:
      --allfiles                    install all files, even configurations which might otherwise be skipped
      --allmatches                  remove all packages which match (normally an error is generated if specified
                                    multiple packages)
      --badreloc                    relocate files in non-relocatable package
  -e, --erase=+            erase (uninstall) package
      --excludedocs                 do not install documentation
      --excludepath=          skip files with leading component
      --force                       short hand for --replacepkgs --replacefiles
  -F, --freshen=+      upgrade package(s) if already installed
  -h, --hash                        print hash marks as package installs (good with -v)
      --ignorearch                  don't verify package architecture
      --ignoreos                    don't verify package operating system
      --ignoresize                  don't check disk space before installing
  -i, --install                     install package(s)
      --justdb                      update the database, but do not modify the filesystem
      --nodeps                      do not verify package dependencies
      --nofiledigest                don't verify digest of files
      --nocontexts                  don't install file security contexts
      --noorder                     do not reorder package installation to satisfy dependencies
      --noscripts                   do not execute package scriptlet(s)
      --notriggers                  do not execute any scriptlet(s) triggered by this package
      --nocollections               do not perform any collection actions
      --oldpackage                  upgrade to an old version of the package (--force on upgrades does this automatically)
      --percent                     print percentages as package installs
      --prefix=



                relocate the package to , if relocatable
      --relocate==        relocate files from path to
      --replacefiles                ignore file conflicts between packages
      --replacepkgs                 reinstall if the package is already present
      --test                        don't install, but tell if it would work or not
  -U, --upgrade=+      upgrade package(s)

Common options for all rpm modes and executables:
  -D, --define='MACRO EXPR'         define MACRO with value EXPR
      --undefine=MACRO              undefine MACRO
  -E, --eval='EXPR'                 print macro expansion of EXPR
      --macros=           read instead of default file(s)
      --nodigest                    don't verify package digest(s)
      --nosignature                 don't verify package signature(s)
      --rcfile=           read instead of default file(s)
  -r, --root=ROOT                   use ROOT as top level directory (default: "/")
      --dbpath=DIRECTORY            use database in DIRECTORY
      --querytags                   display known query tags
      --showrc                      display final rpmrc and macro configuration
      --quiet                       provide less detailed output
  -v, --verbose                     provide more detailed output
      --version                     print the version of rpm being used

Options implemented via popt alias/exec:
      --scripts                     list install/erase scriptlets from package(s)
      --setperms                    set permissions of files in a package
      --setugids                    set user/group ownership of files in a package
      --conflicts                   list capabilities this package conflicts with
      --obsoletes                   list other packages removed by installing this package
      --provides                    list capabilities that this package provides
      --requires                    list capabilities required by package(s)
      --info                        list descriptive information from package(s)
      --changelog                   list change logs for this package
      --xml                         list metadata in xml
      --triggers                    list trigger scriptlets from package(s)
      --last                        list package(s) by install time, most recent first
      --dupes                       list duplicated packages
      --filesbypkg                  list all files from each package
      --fileclass                   list file names with classes
      --filecolor                   list file names with colors
      --fscontext                   list file names with security context from file system
      --fileprovide                 list file names with provides
      --filerequire                 list file names with requires
      --filecaps                    list file names with POSIX1.e capabilities

Help options:
  -?, --help                        Show this help message
      --usage                       Display brief usage message
error: can't create transaction lock on /var/lib/rpm/.rpm.lock (Interrupted system call)
warning: waiting for transaction lock on /var/lib/rpm/.rpm.lock
$ for p in $(rpm -qa); do rpm -qi $p; done |less
Name        : wireshark
Version     : 1.99.0
Release     : 1
Architecture: i686
Install Date: Fri 20 Jun 2014 13:09:02 IST
Group       : Applications/Internet
Size        : 132408893
License     : GPL+
Signature   : (none)
Source RPM  : wireshark-1.99.0-1.src.rpm
Build Date  : Fri 20 Jun 2014 11:34:04 IST
Build Host  : nebraska.ie.openmindnetworks.com
Relocations : (not relocatable)
Packager    : Gerald Combs
URL         : http://www.wireshark.org/
Summary     : Network protocol analyzer
Description :
Wireshark is a free network protocol analyzer for Unix and Windows. It
allows you to examine data from a live network or from a capture file
on disk. You can interactively browse the capture data, viewing summary
and detail information for each packet. Wireshark has several powerful
features, including a rich display filter language and the ability to
view the reconstructed stream of a TCP session.

This package contains command-line utilities, plugins, and documentation for
Wireshark. A GTK+ and a Qt graphical user interface are packaged separately.


Name        : wireshark-gnome
Version     : 1.10.6
Release     : 1.fc19
Architecture: i686
Install Date: Fri 09 May 2014 10:20:48 IST
Group       : Applications/Internet
Size        : 2608072
License     : GPL+
Signature   : RSA/SHA256, Sun 09 Mar 2014 17:36:55 GMT, Key ID 07477e65fb4b18e6
Source RPM  : wireshark-1.10.6-1.fc19.src.rpm
Build Date  : Sat 08 Mar 2014 18:01:27 GMT
Build Host  : buildvm-10.phx2.fedoraproject.org
Relocations : (not relocatable)
Packager    : Fedora Project
Vendor      : Fedora Project
URL         : http://www.wireshark.org/
Summary     : Gnome desktop integration for wireshark
Description :
Contains wireshark for Gnome 2 and desktop integration file


$ for p in $(rpm -qa); do rpm -qi $p; done |grep Group |sort |uniq
compression standard from the Joint Photographic Experts Group (JPEG).
font that was released to the TeX Users Group under a liberal license.
generously donated to the TeX Users' Group when Y&Y closed its
Group       : Amusements/Games
Group       : Amusements/Graphics
Group       : Applications/Archiving
Group       : Applications/Communications
Group       : Applications/Databases
Group       : Applications/Editors
Group       : Applications/Emulators
Group       : Applications/Engineering
Group       : Applications/File
Group       : Applications/Internet
Group       : Applications/Multimedia
Group       : Applications/Productivity
Group       : Applications/Publishing
Group       : Applications/System
Group       : Applications/Text
Group       : Development/Debuggers
Group       : Development/Documentation
Group       : Development/Java
Group       : Development/Languages
Group       : Development/Libraries
Group       : Development/Libraries/Java
Group       : Development/System
Group       : Development/Tools
Group       : Development/Tools/Building
Group       : Documentation
Group       : OMN
Group       : Productivity/Networking/Email/Utilities
Group       : Public Keys
Group       : System/Boot
Group       : System Environment/Base
Group       : System Environment/Daemons
Group       : System Environment/Kernel
Group       : System Environment/Libraries
Group       : System Environment/Shells
Group       : System/Libraries
Group       : Text Editors/Integrated Development Environments (IDE)
Group       : Text Processing/Markup/XML
Group       : Unspecified
Group       : User Interface/Desktops
Group       : User Interface/X
Group       : User Interface/X Hardware Support
Group       : Utilities
Summary     : NFSv4 User and Group ID Mapping Library
the GraphicsMagick Group to significantly improve the quality and performance
the Internet. It is designed by the IETF Codec Working Group and incorporates
TrouSerS is an implementation of the Trusted Computing Group's Software Stack
Users Group NTG.
Yahoo!, Jabber, Bonjour, Gadu-Gadu, ICQ, IRC, Novell Groupwise, QQ,


Another quickref rpm and dpkg:
http://www.pixelbeat.org/docs/packaging.html