2011/12/01

Disable window border on gnome-terminal

Thank you to whomever posted this first.

This could be done for all windows, or any window really if the rule is written properly. In ccsm, in the Window Decorations menu under Effects, change the "any"  field for decoration windows to:

!(class=Gnome-terminal)

In theory, you should also be able to write it as follows when launching gnome-terminal with the proper options, but I couldn't get it to work in practice. For example, gnome-terminal --title=tmux_terminal as the original post suggested. I couldn't get --name to set either.

!(title=tmux_terminal)

2011/11/15

zsh-lovers


One of the great things included with the zsh-lovers package is the zftp (mini?) program.


 $ autoload -U zfinit
 $ zfinit
 $ zfparams www.example.invalid myuserid mypassword
 $ zfls
 $ zfcd exampleDirectory
 $ zfget exampleFile
 $ zfput localExampleFile
 $ zfclose


Type zf and hit tab to see a bunch more commands that are available.

2011/10/09

Working with Canon CR2 files

Canon image files come with a .CR2 extension. This is new to me. To import these into gimp, install gimp-ufraw (Unidentified Flying Raw, built on DCRaw). 


I've only used it once, but it looks like it adds a entire import function to gimp that, once you select the .CR2 file to import, or any other raw camera image file it supports (seems to be a huge list here), you get a tiny little program with way more options than I imagiend would be necessary. Very cool.

2011/09/23

Installing OTF fonts

Thanks to Jerome Jaglale for this one:

Install the fontforge package. Invoke fontforge using a script like this:

#!/usr/bin/fontforge
Print("Opening "+$1);
Open($1);
Print("Saving "+$1:r+".ttf");
Generate($1:r+".ttf");
Quit(0);

Invocation:

fontforge -script otf2ttf.sh font.otf

Install the resulting .ttf file as normal.

Sudo without a password

Append the following to the end of the sudoers file to disable prompting for your password when invoking sudo.

kinji   ALL=(ALL) NOPASSWD: ALL

2011/09/22

Mac OS "login loop" after resetting password

This isn't an Ubuntu issue. But Mac's are a close [distant?] cousin of Ubuntu, in my opinion, due to their freebsd origins.

I needed to reset the password for my CEO's MacBook Pro running Mac OS 10.5. I did so but encountered a login loop at the login window once putting in the new (and correct) password. I would just end up back at the login screen after ten or fifteen seconds. Deleting the following files in these directories solved the issue:

  • /Library/Preferences:
    • com.apple.loginwindow.plist
    • com.apple.windowserver.plist (was supposed to be there but wasn't)
  • /Library/Caches/*
  • /System/Library/Extensions.mkext
  • /System/Library/Caches/*
The Apple Support Communities discussion suggesting this is here. I was lucky and had another computer to ssh into the Mac from and do this without booting back into singleuser mode again. Once these files were removed I was immediately able to login, no problems.

While tailing the system.log during my ssh session, a lot of crashreport crap came up while trying to log in to the [corrupted?] account. The line I focused on follows, I'll include the entire log sample at the end of this post if anyone is actually interested. 
Sep 22 13:41:47 mac0023df830af2 loginwindow[266]: ERROR | -[Login1 setupEnvironment] | Unable to unlock the keychain, SecKeychainLogin returned -2147413984
And to reset a user account's password in OS X or create a new account (Thank you, Google! I forget exactly where I found these instructions, I definitely cannot take credit for documenting this the first time and now can't find it, maybe someone can send or comment a link to the original if you know where it is, I only have my notes from the time I copied it down):

Reset 10.5 Leopard & 10.6 Snow Leopard password
  1. Hold down Command + S to boot into singleuser mode.
  2. fsck -fy (optional, but not a bad idea)
  3. mount -uw /
  4. launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist
  5. ls /Users (if you don't know the exact username)
  6. dscl . -passwd /Users/{username} {password}
  7. reboot
Reset 10.4 Tiget password (way easier!)
  1. Hold down Command + S to boot into singleuser mode.
  2. sh /etc/rc
  3. passwd user
  4. reboot
Creating a new user account from singleuser mode
  1. Hold down Command + S to boot into singleuser mode.
  2. fsck -fy (optional, but not a bad idea)
  3. mount -uw /
  4. rm /var/db/.AppleSetupDone
  5. shutdown -h now (reboot, maybe?)

The entire output from system.log after trying to login to the broken account:



Sep 22 13:41:46 mac0023df830af2 authorizationhost[275]: MechanismInvoke 0x1272d0 retainCount 2
Sep 22 13:41:46 mac0023df830af2 SecurityAgent[276]: MechanismInvoke 0x101670 retainCount 1
Sep 22 13:41:46 mac0023df830af2 SecurityAgent[276]: NSSecureTextFieldCell detected a field editor ((null)) that is not a NSTextView subclass designed to work with the cell. Ignoring...
Sep 22 13:41:47 mac0023df830af2 loginwindow[266]: Login Window - Returned from Security Agent
Sep 22 13:41:47 mac0023df830af2 SecurityAgent[276]: MechanismDestroy 0x101670 retainCount 1
Sep 22 13:41:47 mac0023df830af2 authorizationhost[275]: MechanismDestroy 0x1272d0 retainCount 2
Sep 22 13:41:47 mac0023df830af2 loginwindow[266]: USER_PROCESS: 266 console
Sep 22 13:41:47 mac0023df830af2 loginwindow[266]: ERROR | -[Login1 setupEnvironment] | Unable to unlock the keychain, SecKeychainLogin returned -2147413984
Sep 22 13:41:47 mac0023df830af2 com.apple.launchd[1] (com.apple.UserEventAgent-LoginWindow[272]): Exited: Terminated
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: OSXvnc-server received signal: 15
Sep 22 13:41:47 mac0023df830af2 com.apple.launchd[1] (com.apple.ScreenSharing.server[271]): Exited: Terminated
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: Unloading Tiger Extensions
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: Unloading Jaguar Extensions
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: Disabling Bonjour Service - dssmacbookpro.nt_wan
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: Removing Observers
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[270]: RFB Shudown Complete
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Arguments: -rfbport 5900 -desktop dssmacbookpro.nt_wan -rfbauth /Library/Application Support/VineServer/.vinevncauth -donotloadproxy -SystemServer 1 -restartonuserswitch N -UnicodeKeyboard 0 -keyboardLoading N -pressModsForKeys N -EventTap 3 -swapButtons -rendezvous Y 
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Main Bundle: /Library/Application Support/VineServer
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Loading Bundle /Library/Application Support/VineServer/Resources/TigerBundle.bundle
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Loading Bundle /Library/Application Support/VineServer/Resources/JaguarBundle.bundle
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Running in Little Endian
Sep 22 13:41:47 mac0023df830af2 OSXvnc-server[307]: Pasteboard Inaccessible - Pasteboard sharing disabled
Sep 22 13:41:47 mac0023df830af2 ReportCrash[317]: Too many crashes in rapid succession! No crash report being written for pid 313
Sep 22 13:41:47 mac0023df830af2 com.apple.launchd[303] (com.apple.Spotlight[313]): Exited abnormally: Segmentation fault
Sep 22 13:41:47 mac0023df830af2 com.apple.launchd[303] (com.apple.Spotlight): Throttling respawn: Will start in 10 seconds
Sep 22 13:41:47 mac0023df830af2 ReportCrash[317]: Too many crashes in rapid succession! No crash report being written for pid 309
Sep 22 13:41:48 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)
Sep 22 13:41:48 mac0023df830af2 ReportCrash[318]: Formulating crash report for process lsregister[315]
Sep 22 13:41:47 mac0023df830af2 com.apple.launchd[303] (com.apple.pbs[309]): Exited abnormally: Segmentation fault
Sep 22 13:41:48 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/lsregister_2011-09-22-134147_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:41:52 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)
Sep 22 13:41:52 mac0023df830af2 ReportCrash[317]: Too many crashes in rapid succession! No crash report being written for pid 314
Sep 22 13:41:52 mac0023df830af2 com.apple.launchd[303] (com.apple.UserEventAgent-Aqua[314]): Exited abnormally: Segmentation fault
Sep 22 13:41:52 mac0023df830af2 com.apple.launchd[303] (com.apple.UserEventAgent-Aqua): Throttling respawn: Will start in 5 seconds
Sep 22 13:41:55 mac0023df830af2 ReportCrash[319]: Formulating crash report for process ReportCrash[317]
Sep 22 13:41:55 mac0023df830af2 ReportCrash[319]: Saved crashreport to /Users/stevesorensen/Library/Logs/CrashReporter/ReportCrash_2011-09-22-134154_Steve-Sorensens-MacBook-Pro.crash using uid: 501 gid: 20, euid: 501 egid: 20
Sep 22 13:41:55 mac0023df830af2 com.apple.launchd[303] (com.apple.ReportCrash[317]): Exited abnormally: Segmentation fault
Sep 22 13:41:56 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)
Sep 22 13:41:59 mac0023df830af2 ReportCrash[319]: Formulating crash report for process ReportCrash[321]
Sep 22 13:41:59 mac0023df830af2 ReportCrash[318]: Too many crashes in rapid succession! No crash report being written for pid 320
Sep 22 13:41:59 mac0023df830af2 ReportCrash[319]: Saved crashreport to /Users/stevesorensen/Library/Logs/CrashReporter/ReportCrash_2011-09-22-134159_Steve-Sorensens-MacBook-Pro.crash using uid: 501 gid: 20, euid: 501 egid: 20
Sep 22 13:42:00 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)
Sep 22 13:42:02 mac0023df830af2 ReportCrash[318]: Formulating crash report for process FlipShareAutoRun[306]
Sep 22 13:42:02 mac0023df830af2 ReportCrash[318]: Formulating crash report for process AppleVNCServer[311]
Sep 22 13:42:02 mac0023df830af2 ReportCrash[318]: Formulating crash report for process OSXvnc-server[307]
Sep 22 13:42:03 mac0023df830af2 ReportCrash[318]: Formulating crash report for process AirPort Base Station Agent[308]
Sep 22 13:42:03 mac0023df830af2 ReportCrash[318]: Formulating crash report for process loginwindow[266]
Sep 22 13:41:59 mac0023df830af2 com.apple.launchd[303] (com.apple.Spotlight[320]): Exited abnormally: Segmentation fault
Sep 22 13:41:59 mac0023df830af2 com.apple.launchd[303] (com.apple.Spotlight): Throttling respawn: Will start in 9 seconds
Sep 22 13:41:59 mac0023df830af2 com.apple.launchd[303] (com.apple.ReportCrash[321]): Exited abnormally: Segmentation fault
Sep 22 13:42:03 mac0023df830af2 com.apple.launchd[303] (com.flipvideo.FlipShareAutoRun[306]): Exited abnormally: Segmentation fault
Sep 22 13:42:03 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/FlipShareAutoRun_2011-09-22-134155_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:03 mac0023df830af2 com.apple.launchd[303] (com.apple.ReportCrash): Throttling respawn: Will start in 5 seconds
Sep 22 13:42:03 mac0023df830af2 com.apple.launchd[303] (com.apple.ScreenSharing.server[311]): Exited abnormally: Segmentation fault
Sep 22 13:42:04 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (VineServer[307]): Exited abnormally: Segmentation fault
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Arguments: -rfbport 5900 -desktop dssmacbookpro.nt_wan -rfbauth /Library/Application Support/VineServer/.vinevncauth -donotloadproxy -SystemServer 1 -restartonuserswitch N -UnicodeKeyboard 0 -keyboardLoading N -pressModsForKeys N -EventTap 3 -swapButtons -rendezvous Y 
Sep 22 13:42:04 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/AppleVNCServer_2011-09-22-134155_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Main Bundle: /Library/Application Support/VineServer
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Loading Bundle /Library/Application Support/VineServer/Resources/TigerBundle.bundle
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Loading Bundle /Library/Application Support/VineServer/Resources/JaguarBundle.bundle
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.AirPortBaseStationAgent[308]): Exited abnormally: Segmentation fault
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Running in Little Endian
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[1] (com.apple.loginwindow[266]): Exited abnormally: Segmentation fault
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.pboard[316]): Exited: Terminated
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: OSXvnc-server received signal: 15
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Unloading Tiger Extensions
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Unloading Jaguar Extensions
Sep 22 13:42:04 mac0023df830af2 ReportCrash[318]: Too many crashes in rapid succession! No crash report being written for pid 324
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.ServerScanner[312]): Exited: Terminated
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.AirPortBaseStationAgent[326]): Exited: Terminated
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.ReportCrash.SafetyNet[319]): Exited: Terminated
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: Removing Observers
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[325]: RFB Shudown Complete
Sep 22 13:42:04 mac0023df830af2 /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow[327]: Login Window Application Started -- Threaded auth
Sep 22 13:42:04 mac0023df830af2 com.apple.launchd[303] (com.apple.ScreenSharing.server[324]): Exited abnormally: Segmentation fault
Sep 22 13:42:04 mac0023df830af2 ManagedClient[274]: CGSShutdownServerConnections: Detaching application from window server
Sep 22 13:42:04 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/OSXvnc-server_2011-09-22-134155_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:04 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/AirPort Base Station Agent_2011-09-22-134155_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:04 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/loginwindow_2011-09-22-134155_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[331]: Arguments: -rfbport 5900 -desktop dssmacbookpro.nt_wan -rfbauth /Library/Application Support/VineServer/.vinevncauth -donotloadproxy -SystemServer 1 -restartonuserswitch N -UnicodeKeyboard 0 -keyboardLoading N -pressModsForKeys N -EventTap 3 -swapButtons -rendezvous Y 
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[331]: Main Bundle: /Library/Application Support/VineServer
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[331]: Loading Bundle /Library/Application Support/VineServer/Resources/TigerBundle.bundle
Sep 22 13:42:04 mac0023df830af2 OSXvnc-server[331]: Loading Bundle /Library/Application Support/VineServer/Resources/JaguarBundle.bundle
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Running in Little Endian
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Pasteboard Inaccessible - Pasteboard sharing disabled
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Waiting for clients
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Using Private Event Source
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: 3891612: (connectAndCheck) Untrusted apps are not allowed to connect to or launch Window Server before login.
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Window Server is not available.
Sep 22 13:42:05: --- last message repeated 1 time ---
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: CGSCreateEventSourceState: cannot resolve shmem.
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: No Event Source -- Using 10.3 API
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Using Dynamic Event Tap -- HID for console user
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Registering Bonjour Service(_rfb._tcp.) - dssmacbookpro.nt_wan
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: IPv6: Failed to Bind Socket: Port 5900 may be in use by another VNC
Sep 22 13:42:05 mac0023df830af2 OSXvnc-server[331]: Started Listener Thread on port 5900
Sep 22 13:42:05 mac0023df830af2 loginwindow[327]: Login Window Started Security Agent
Sep 22 13:42:06 mac0023df830af2 ReportCrash[318]: Formulating crash report for process UserEventAgent[322]
Sep 22 13:42:06 mac0023df830af2 ReportCrash[318]: Formulating crash report for process FlipShareAutoRun[323]
Sep 22 13:42:06 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/UserEventAgent_2011-09-22-134204_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:06 mac0023df830af2 ReportCrash[318]: Saved crashreport to /Library/Logs/CrashReporter/FlipShareAutoRun_2011-09-22-134204_Steve-Sorensens-MacBook-Pro.crash using uid: 0 gid: 0, euid: 0 egid: 0
Sep 22 13:42:06 mac0023df830af2 com.apple.launchd[303] (com.apple.UserEventAgent-Aqua[322]): Exited abnormally: Segmentation fault
Sep 22 13:42:06 mac0023df830af2 com.apple.launchd[303] (com.flipvideo.FlipShareAutoRun[323]): Exited abnormally: Segmentation fault
Sep 22 13:42:08 mac0023df830af2 mds[32]: (Error) Import: importer:0x850000 Importer start failed for 501 (kr:268435459 (ipc/send) invalid destination port)

2011/09/19

Deleting old files with find

There has got to be a way to do this with the built-in -delete option in find. But this is what I used instead to delete files older than 262 days:

find -mtime +262 -exec rm -rf {} +

The mtime option tests for when the file's data was last modified n*24 hours ago. The resulting files end up replacing the {} characters. The + form of the exec options adds each result to the end of the invocation of rm, instead of invoking rm once for each result. I think. It's easier to remember and type than -exec rm -rf {} \;.

See the newer option for finding files newer than the given file. But giving a negative integer argument to mtime may be sufficient.

2011/09/01

Wiping data


dd - Convert and copy a file. I think of it as program to read and write zeros and ones on the lowest level possible. Filling with zeros should be faster than filling with random data. For specific (secure) file destruction, see shred. I know much more awesome things can be done with dd but this is probably all I will ever use.

WIPE DRIVE - After this, optionally run again using /dev/zero
dd if=/dev/urandom of=/dev/sdb bs=1M
WIPE MBR - I haven't tested this myself, perhaps useful with messed up MBR?
dd if=/dev/zero of=/dev/sdb bs=446 count=1

2011/08/27

Postfix

postfix - Straight from http://www.postfix.org/: What is Postfix? It is Wietse Venema's mail server that started life at IBM research as an alternative to the widely-used Sendmail program. In other words, better than sendmail. I still can't remember why I have a bad taste in my mouth from sendmail. To use the transport map, dont' forget to add transport_maps = hash:/etc/postfix/transport to the main.cf file. Remember, kids: 1) update transport; 2) postmap transport; 3) postfix reload.

CHECK QUEUE

postqueue -p
READ MESSAGE
postcat -q QueueID
DELETE MESSAGE
postsuper -d QueueID
MAP TRANSPORT
postmap /etc/postfix/transport (after specifying, e.g.: "gmail.com :[209.85.229.27]")

2011/07/11

Window Shade

Maybe it's because I started my computing life as a Mac OS user but I still like having the ability to "roll up" windows like the old window shade action from the old days before OS X as well as have the ability to minimize in the Windows fashion. That's what I love about linux: you can choose the best of both worlds.

To enable the roll-up / window shade action with the mouse wheel:

    gconf-editor: navigate to /apps/gwd/, select the key mouse_wheel_action and change it to "shade".

Thanks to Rick Vause for this tip.

2011/01/15

Flush DNS

I haven't tested this one yet, but apparently there is a DNS cleaner script:

/etc/init.d/dns-clean start | stop | restart | force-reload

According to one site I read issuing the start command is all that is needed. And, for whatever reason, it states it should never be run while ppp is up.

Man


man Manuals. Built-in documentation for programs. From man -a intro: "Under Linux there are GUIs (graphical user interfaces), where you can point and click and drag, and hopefully get work done without first reading lots of documentation. The traditional Unix environment is a CLI (command line interface), where you type commands to tell the computer what to do. That is faster and more powerful, but requires finding out what the commands are."


SEARCH
man -f name
ADVANCED SEARCH - Results from descriptions and manual pages
man -k regexp
ALL - Queue matching  pages from all sections
man -a name
PDF - Send PS output to a PDF file
man -t name | ps2pdf manPage.pdf


Of course, there's also the wonderful online versions at manpages.ubuntu.com.