Showing posts with label daily hack. Show all posts
Showing posts with label daily hack. Show all posts

Friday, February 15, 2008

Negate find results

Find files that do not match expression and dostuff on them:
find ./ [expressions] -prune -or [dostuff]
Example:
find ./ -name '.svn' -prune -or -type f -print
finds all non-svn files and prints their paths on stdout

Monday, February 4, 2008

top (unix command) with two samples in logging mode - but only the second matters

i wanted to use the unix top command with GeekTools and found that this wasn't as straight forward as i had expected...

anyways, the following bundle does the trick:
top -o cpu -l 2 -u -S | sed -e '2,/^Processes:/ d'

Saturday, January 26, 2008

Saturday, December 15, 2007

Open in (OS X) Terminal here...

...seems so handy! but doesn't come with the system.
now, obviously the problem has already been encountered before:
http://c-command.com/scripts/finder/open-in-terminal

so i used this to get started (and finished) - result is a Finder.app Workflow:

on run {input, parameters}

   repeat with i in input
     my processItem(i)
   end repeat

   return input
end run

...just accompany this snippet with on processItem(i) and on canChangeDirectoryTo(f), save it as Workflow - done.

Friday, October 5, 2007

Modify iWeb sites to work with Google Analytics

wanted to use Google Analytics together with iWeb & didn't want to use BBEdit, someEdit, someOtherEdit or an Automator action... as i have to sync the iWeb content anyway - why not use a little (python) script to integrate the Google snippet?

use somthing like
find iWeb/ -iname '*.html' -exec ./iWeb.py "</body>" iWeb.analytics {} {} \;
with iWeb.analytics beeing the Google snippet and iWeb.py the follwoing script. after that i use sitecopy --update [SITENAME]...
#!/usr/bin/env python
import sys,os
usage = "usage: %s searchText insertText_file [infile [outfile]]" % os.path.basename(sys.argv[0])

def init():

stext = sys.argv[1]

replaceTextFileIn = open(sys.argv[2],'r')
replaceTextFileContent = replaceTextFileIn.readlines()
replaceTextFileIn.close()

# print replaceTextFileContent

input = sys.stdin
output = sys.stdout
if len(sys.argv) > 3:
input = open(sys.argv[3])

inputContent = input.readlines()
input.close()


if len(sys.argv) > 4:
output = open(sys.argv[4], 'w')

for s in inputContent:
output.write(s.replace(stext, ''.join(replaceTextFileContent) + stext))

output.close()

if __name__ == "__main__":
if len(sys.argv)

the latest version of this script might be available from (something like):
https: / / iiegn.dyndns.org / svn / de.iiegn / _stuff / iWeb.py

references:
  1. http://www.macosxhints.com/article.php?story=20061220033306772
  2. http://www.apple.com/downloads/macosx/automator/addgoogleanalyticsaction.html
  3. http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52250

Sunday, September 30, 2007

debian, ampache, and xspf player

installed ampache (https://ampache.bountysource.com/wiki/Ampache_on_Debian) and after local play was working wanted to try xspf player:

but it seemed like the link for the temporary playlist-id did not transfer correctly - solution was to modify the trunk version of show_xspf_player.inc.php from the svn repository.

<div id="mp3player">
<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="400" height="170" id="xspf_player" align="middle">
<param name="pluginspage" value="http://www.macromedia.com/go/getflashplayer" />
<param name="allowScriptAccess" value="sameDomain" />
<param name="movie" value="/modules/flash/xspf_player.swf?autoplay=true&playlist_url=" />
<param name="quality" value="high" />
<param name="bgcolor" value="#ffffff" />
<param name="type" value="application/x-shockwave-flash" />
<param name="width" value="400" />
<param name="height" value="170" />
<param name="name" value="xspf_player" />
<param name="align" value="middle" />
<embed src="/modules/flash/xspf_player.swf?autoplay=true&playlist_url=" quality="high" bgcolor="#ffffff" width="400" height="170" name="xspf_player" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
</div>

Thursday, September 6, 2007

port install fails with 'checksum mismatch'

wanted to install Coin with
sudo port -v install coin
but only got
---> Verifying checksum(s) for Coin
---> Checksumming Coin-2.4.6.tar.gz
Error: Checksum (md5) mismatch for Coin-2.4.6.tar.gz
Portfile checksum: Coin-2.4.6.tar.gz md5 17f9a941cec7a1b69693d240e4ac308d
Distfile checksum: Coin-2.4.6.tar.gz md5 30efbdb9c761dd9fea7a7f4a0f01a50d
Error: Checksum (sha1) mismatch for Coin-2.4.6.tar.gz
Portfile checksum: Coin-2.4.6.tar.gz sha1 8595fcc9b4669b8c58490637d577f061589dbdbb
Distfile checksum: Coin-2.4.6.tar.gz sha1 662cde2c7fd06e79f95e02aa23325d283d3294a1
checked whether my download was 'broken': downloaded Coin-2.4.6.tar.gz from different sites and - consistently - found one other checksum...

...then changed the checksum in
/opt/local/var/macports/sources/rsync.macports.org/release/ports/graphics/Coin/Portfile
(for other ports the file will be different - but somewhere in that direction...)


references:
  1. http://blog.codefront.net/2007/05/29/imagemagick-port-broken-temporarily/
  2. http://groups.google.com/group/mailing.freebsd.questions/
  3. http://trac.macports.org/projects/macports/ticket/12618 - now, that's only the bug report...

Saturday, September 1, 2007

booting from the network with GRUB

http://en.opensuse.org/SDB:Booting_from_the_Network_with_GRUB

SSH handler for Firefox

linux


add the following lines to user.js (in the profile folder):

user_pref("network.protocol-handler.external.ssh", true);
user_pref("network.protocol-handler.warn-external.ssh", false);
user_pref("network.protocol-handler.expose.ssh", true);
user_pref("network.protocol-handler.app.ssh", \
[noLineBreak] "/PATHTO/NAME_OF_SSHHANDLER_HELPER_SCRIPT");
ssh handler helper script
#!/usr/bin/env bash

xterm -e ssh `echo $1 | sed -e "s/ssh:\/\///"`
#
# don't forget to set the script's exectuable flag
#


windows

execute (or combine) ssh.reg:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh]
@="URL:ssh Protocol"
"URL Protocol"=""

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\DefaultIcon]
@=hex(2):25,00,53,00,79,00,73,00,74,00,65,00,6d,00,52,00,6f,00,6f,00,74,00,25,\
00,5c,00,73,00,79,00,73,00,74,00,65,00,6d,00,33,00,32,00,5c,00,75,00,72,00,\
6c,00,2e,00,64,00,6c,00,6c,00,2c,00,30,00,00,00

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell\open]

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\ssh\shell\open\command]
@="c:\\Program Files\\SSH Communications Security\\ \
[noLineBreak] SSH Secure Shell for Workstations\\Sshhandler.cmd \"%1\""

save ssh.cmd in (e.g.) c:\Program Files\SSH Communications Security\SSH Secure Shell for Workstations\Sshhandler.cmd

@echo off
@FOR /F "tokens=2,3 delims=/@" %%a IN ("%~1") DO \
"c:\Program Files\SSH Secure Shell for Workstations\SSH Secure Shell for Workstations\ \
[noLineBreak] SshClient.exe" -u "%%a" -h "%%b"

rem ...DO start SshClient.exe - without quotes - works better;
rem but how does the path go into there without quotes...?

in case it doesn't work add the following lines to user.js:

user_pref("network.protocol-handler.external.ssh", true);
user_pref("network.protocol-handler.warn-external.ssh", false);
user_pref("network.protocol-handler.expose.ssh", true);

i happily give credit for this - and particularly the windows integration - to martisch_AT_uos.de (www.waldwolf.net)

Thursday, August 23, 2007

how Thunderbird (on OS X) knows about Address Book.app

it seems like the story has been going on for a while. have a look on
https://bugzilla.mozilla.org/show_bug.cgi?id=203927 for details.

what is working for me:
  1. download http://files.mistermartin75.net/thunderbird-2.0.0.6.en-US.mac.dmg

  2. edit prefs.js and add:
    user_pref("ldap_2.servers.osx.description", "OS X");
    user_pref("ldap_2.servers.osx.dirType", 3);
    user_pref("ldap_2.servers.osx.uri", "moz-abOSXdirectory:///");

  3. if it doesn't work try to delete some of the "ldap_2.server"-entries that seem as if they could interfere...