idoru.be/notes

Manuals, writings and idea's from an techie.

Category: howto

How can I force format read only usb drive in OSX

Check disk device with Disk Utility, then sudo diskutil unmountdisk force diskXXX sudo dd if=/dev/zero of=/dev/diskXXX bs=1024 count=1024

Howto start the native OSX tftp deamon

sudo launchctl load -F /System/Library/LaunchDaemons/tftp.plist sudo launchctl start com.apple.tftpd files will be served from /private/tftpboot sudo launchctl stop com.apple.tftpd

What’s a CPU Year?

GFlops, G-hours, and CPU hours 1 Flops, GFlops, and TFlops 2 G-hours 3 CPU Hours and CPU Years 4 Credits Flops, GFlops, and TFlops FLOPS is a standard measure of computing power — “Floating Point Operations Per Second”. A GigaFlop (or Gflop) is a billion FLOPS. A TeraFlps (or TFlop) is a trillion FLOPS. So […]

How To reïnstall ALL packages in Ubuntu server

dpkg –get-selections \* | awk ‘{print $1}’ | xargs -l1 aptitude reinstall

Installing HomeBrew on MacOSX

/usr/bin/ruby -e “$(/usr/bin/curl -fsSL https://raw.github.com/mxcl/homebrew/master/Library/Contributions/install_homebrew.rb)” brew doctor

Show all hidden folders in MacOSX

defaults write com.apple.Finder AppleShowAllFiles YES Relaunch Finder reset to normal: defaults write com.apple.Finder AppleShowAllFiles NO

error reporting in any PHP script

PHP Tip – error_reporting(-1) at the top of your script during dev to turn on all warnings, notices, etc in all versions of PHP

Add Legacy Codec Support to Quicktime X

in Terminal: +qtdefaults write LegacyCodecsEnabled yes+

Avoiding “Assertion `insz <= dlsz'" errors when wgetting large files

Some wget installs have this nasty issue, for a quick fix, just use curl -C – -O http://yourfile

How To Create an Empty file in MacOSX

$ mkfile 10g /path/to/my/tengigfile

How to switch JAVA on your ubuntu server

sudo update-alternatives –config java

How to check your ubuntu version

lsb_release -a

fetchmail LaunchDaemon for macosx

$ vi /Library/LaunchDaemons/local.fetchmail.plist <?xml version=”1.0″ encoding=”UTF-8″?> <!DOCTYPE plist PUBLIC “-//Apple//DTD PLIST 1.0//EN” “http://www.apple.com/DTDs/PropertyList-1.0.dtd”> <plist version=”1.0″> <dict> <key>KeepAlive</key> <false/> <key>Label</key> <string>local.fetchmail</string> <key>Program</key> <string>/usr/bin/fetchmail</string> <key>ProgramArguments</key> <array> <string>/usr/bin/fetchmail</string> <string>–fetchmailrc=/Users/<snip>/.fetchmailrc</string> <string>–pidfile=/Users/<snip>/.fetchmail.pid</string> <string>–daemon=1800</string> <string>–nodetach</string> </array> <key>QueueDirectories</key> <array/> <key>RunAtLoad</key> <true/> <key>UserName</key> <string><snip></string> <key>WatchPaths</key> <array/> <key>WorkingDirectory</key> <string>/Users/<snip>/.fetchmail</string> </dict> </plist> $ mkdir /Users/<snip>/.fetchmail $ sudo launchctl load -w /Library/LaunchDaemons/local.fetchmail.plist $ tail -f /var/log/system.log

fetchmail gmail via IMAP to macosx for backup

first, enable IMAP in gmail. $ vi .fetchmailrc if you have a mta running: poll imap.gmail.com protocol IMAP user ‘<snip>‘ there with password ‘<snip>’ is ‘<snip>‘ here options ssl keep sslcertck sslcertpath “/Users/<snip>/.ssl/certs” folder ‘[Gmail]/All Mail’ if not, deliver via procmail to /var/mail…: poll imap.gmail.com protocol IMAP user ‘<snip>‘ there with password ‘<snip>’ is ‘<snip>‘ […]

fetchmail gmail via POP3 to macosx for backup

first, enable POP for all mail in gmail. $ vi .fetchmailrc if you have a mta running: poll pop.gmail.com with proto POP3 and options no dns user ‘<snip>’ there with password ‘<snip>’ is ‘<snip>’ here options ssl keep sslcertck sslcertpath “/Users/<snip>/.ssl/certs” if not, deliver via procmail to /var/mail…: poll pop.gmail.com with proto POP3 and options […]

Make MacOSX a central syslog server (tested on Lion)

$ pushd /System/Library/LaunchDaemons $ sudo plutil -convert xml1 /System/Library/LaunchDaemons/com.apple.syslogd.plist $ sudo vim /System/Library/LaunchDaemons/com.apple.syslogd.plist => add to “Sockets”: NetworkListener SockServiceName syslog SockType dgram $ sudo plutil -convert binary1 /System/Library/LaunchDaemons/com.apple.syslogd.plist $ sudo launchctl unload /System/Library/LaunchDaemons/com.apple.syslogd.plist $ sudo launchctl load /System/Library/LaunchDaemons/com.apple.syslogd.plist

download flash movies with Safari

If you’re using Safari, there’s an easy way to download flash videos. Open the page with the movie and press Command-Option-A, which shows the Activity window. If you’re also loading other sites, you’ll see a list of them: scroll until you find the YouTube page and click on the arrow to show details about what […]

Remove old Developer Tools after installing Developer Tools 4 on macosx

sudo /Developer-3.2.6/Library/uninstall-devtools –mode=all

Cleaning old kernels in Ubuntu

The safe way: sudo aptitude -F ‘%p’ search linux-{image,headers,restricted}-2.6~i | grep -v `uname -r | sed -r ‘s/-[a-z0-9A-Z]+$//’ or, if you’re feeling lucky: sudo aptitude -F ‘%p’ search linux-{image,headers,restricted}-2.6~i | grep -v `uname -r | sed -r ‘s/-[a-z0-9A-Z]+$//’` | xargs sudo aptitude purge -y

How to configure Rendezvous/Bonjour/ZeroConf in OpenBSD with avahi deamon

Since the howl package is no longer available, but the excellent avahi is, here’s how to install and configure it: (with an older OpenBSD system, you might want to check out: http://doink.org/index.php?option=com_content&task=view&id=52&Itemid=1) 1. run a pkg_info on avahi: Information for ftp://ftp.openbsd.org/pub/OpenBSD/4.8/packages/i386/avahi-0.6.27.tgz Comment: framework for Multicast DNS Service Discovery Description: Avahi is a free, standards-compliant implementation […]

is my cpu 64bit capable?

run: $ grep flags /proc/cpuinfo if you see a lm flag, this means Long mode cpu = 64 bit CPU

Command Line Airport commands on MacOSX

$ /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport Supported arguments: -c[] –channel=[] Set arbitrary channel on the card -z –disassociate Disassociate from any network -I –getinfo Print current wireless status, e.g. signal info, BSSID, port type etc. -s[] –scan=[] Perform a wireless broadcast scan. Will perform a directed scan if the optional is provided -x –xml Print info as XML -P […]

Using purge to free inactive memory on Mac OS X

A note on MacOSX Memory: Briefly, free memory is available to be used right now; wired memory is basically system memory for the kernel and other stuff; active memory is memory being used right now; and inactive memory stores info from recently quit applications. The idea with inactive memory is that if you quit and […]

How to submit a Final Cut Studio Compressor Job via Command line

e.g. /Applications/Compressor.app/Contents/MacOS/Compressor -clustername “This Computer” -batchname “Test Batch” -jobpath “/Volumes/.mov” -settingpath “/Users/administrator/Library/Application Support/Compressor/Formats/QuickTime/Uncompressed 10-bit .setting” -destinationpath “/Volumes.mov” just change settingpath & destinationpath…

How to setup Passwordless SSH

1. Local: ssh-keygen scp ~/.ssh/*.pub username@remote: ssh username@remote 2. Remote mkdir .ssh cat ~/*.pub >> ~/.ssh/authorized_keys rm *.pub chmod 644 ~/.ssh/authorized_keys -or- Script it like this: ssh-keygen scp ~/.ssh/*.pub user@remote:`uname -n`.pub ssh user@remote “cat ~/*.pub >> ~/.ssh/authorized_keys” ssh user@remote “rm ~/*.pub”

building a transparent bridge on OpenBSD

get three network cards, two for the bridge, mine are re0, em0 & em1 (re0 = admin connection to serve sshd) echo ‘dhcp’ > /etc/hostname.re0 echo ‘up’ > /etc/hostname.em0 echo ‘up’ > /etc/hostname.em1 echo  ‘add em0’  > /etc/hostname.bridge0 echo ‘add em1’ >> /etc/hostname.bridge0 echo ‘blocknonip em0’ >> /etc/hostname.bridge0 echo ‘blocknonip em1’ >> /etc/hostname.bridge0 echo ‘up’ […]

How to Change Your Hostname In OpenBSD

How to Change Your Hostname In OpenBSD A quick note on how to change your hostname and IP configuration in OpenBSD. /etc/hosts Vastly more important in BSD than it is in Linux. This is where you specify the IP address of your hostname. Change the hostname here to match your hosts new name. It should […]

How to sort files by filesize in Unix/Linux/BSD/MacOSX

du -ksl * | sort -nr

Fast and reliable way to encode Theora Ogg videos using ffmpeg, libtheora, and liboggz

if this doesn’t work for you: ffmpeg2theora in.mov -o out.ogv or ffmpeg2theora in.mov -v 8 -o out.ogv (To solve the video artefacts) Try the following: from tracey jaquith at archive.org use ffmpeg to turn any video to “rawvideo”. pipe its output to *another* ffmpeg to turn the video to “yuv4mpegpipe”. pipe its output to the […]

How to design an iPhone-friendly Website

from http://www.lightsphere.com/dev/articles/design_for_iphone.html The iPhone can display most websites without modification, however the user often won’t be able to read the text or see anything useful without pinch-zooming on your page. Here’s how to set up an iPhone-friendly version of your website that doesn’t require zooming. 1. Set the viewport width inside the <head> section of […]

How to remove Stair-Stepping artefacts in a Nikon D90 Video File

The Nikon D90 is a fantastic DSLR, but as we speak, it has a huge bug. Here’s the fix for that: from http://www.mattias.nu/plugins/ D90 Rescaler (New Nov 2008) If you’re a D90 user I’m sure you’ve seen the stairstepping of diagonal lines, as well as the flickering aliasing of horizontal lines. No more, thanks to […]

How to select a schema in a Postgresql query

SELECT table_name as name FROM INFORMATION_SCHEMA.tables WHERE table_schema = ‘tablename‘;

How to mount an external LVM partition under Ubuntu 10.10

Install lvm2: $ sudo apt-get install lvm2 Load the necessary module(s): $ sudo modprobe dm-mod Scan your system for LVM volumes: $ sudo vgscan Activate the volume: $ sudo vgchange -ay VolGroup00 Find the logical volume that has your external root file system: $ sudo lvs Create a mount point for that volume: $ sudo […]

How to substitute something by a line break in vi

use the normal substitute commands such as: :%s/oldword/newword/ but use the keyboard shortcut CtrlVCtrlM to create a new-line character

How to burn an iso file on MacOSX via Command Line

hdiutil burn image.iso

How to replace a string in a file with awk on a *nix system

example: cat oldfile | awk ‘{gsub(“;old text string”, “new text string”); print}’ > newfile mv -f newfile oldfile