Samstag, August 23, 2014

show open iCloud Tabs in shell

I've got the idea from this macstories post. In the attached Python script you find not only the location where the OS keeps the information. But also how to access it.

After I had a look at the man page for plutil I started my own test.
plutil -p ~/Library/SyncedPreferences/com.apple.Safari.plist
This will display the informatio in a JSON looking format.
plutil -convert xml1 -o /tmp/iCloudTabs2.xml  ~/Library/SyncedPreferences/com.apple.Safari.plist
Converts the information to XML. Don't miss the -o or it will overwrite the original file. Instead you could also use -e xml to write to a file with the new extension.

The output contains the device, URL, page title and more. If I find some information on the iPad and want to save, I keep the tap open. The next time at the Mac the URL to download this with curl or wget is already there.

Freitag, August 22, 2014

don't use "Inspect Element" to design filter rules

Never use your browsers Inspect Element to look at the HTML and expect it to be like this in the transmitted file!

I tried to use this to design a filter for Privoxy to remove a . The browser showed me the line as
But even
s///Usig
didn't remove any of the links. And I gave up.

Only after I was working at an other filter and using View Source to look a the HTM code I realised the difference. For Inspect Element the browser will use it's internal representation. And this results not only in the use of end tags, but also a different order of attributes.

A look at the actual source showed that the line in question actually looked like this
Now I was able to design the filter like this
s///Us
to remove the line.

Sonntag, Mai 11, 2014

running linux server headless in VirtualBox

For tests I use a simple arch linux installation with out X installed. This saves quite some RAM. But I had still the Window of the VM, that I was not using. Instead I used multiple ssh logins with different sized terminal windows.

There should be a way to run the VM headless, like the real server. A search brought me to this description on running a VirtualBox headless and using a RDP or SSH connection.

For me this boils down to:

  1. list the available VMs: VBoxManage list vms
  2. start the VM: VBoxManage startvm arch --type headless
  3. connect as usual: ssh user@address
  4. and switch off the VM after a shutdown: VBoxManage controlvm arch poweroff


Samstag, August 18, 2012

copy/move files with find

To copy or move files from different locations in a subtree into a single directory find is your friend.

find . -name "select_*" | while read f; do cp -iv $f ~/destination/${f##.*/}; done

My natural first try with -exec didn't work. I was not able to use parameter expansion of the shell on {} from find. Assigning the -exec parameter {} to a variable and use it with the next command didn't work, because find interpreted the ; as exec end. Escaping the -exec command with "" did result in No such file or directory.

[todo] Play with this in a quite minute.

Montag, November 28, 2011

couchdb port installation trouble

Looking for a simple way to synchronise data from an Android phone I found a suggestion to use couchdb. Simply typing sudo port install couchdb didn't work. All suggestions found via google didn't help.

So I did, what I should have done at the beginning. I read the installing and error messages article on the couchdb wiki.

After this I did:
  • sudo port install erlang -universal

  • sudo port install couchdb-devel
and it worked fine.

[update 12.08.2012] Running sudo port upgrade outdated stopped with

Error: org.macports.configure for port couchdb-devel returned: command execution failed

So I removed couchdb and erlang, as it also was updated and redid the above steps. It failed again. Checking the log file it showed

this file was generated for autoconf 2.61.
You have another version of autoconf. If you want to use that,
you should regenerate the build system entirely.

This was not, what I wanted to do. I tried to install couchdb instead (no -devel) and it worked. Next time I will try to install erlang without -universal

I had to start the couchdb demon multiple times before I was abale to connect. Not sure why.