Note: May need to rekey “smart quotes” after copy/paste

Transferring system

crossover needs 32 bit version of libsm

 

Wacom stuff

Intuos 5:

button 2

button 3

button 8

button 9

button 4 anti-clockwise

button 5 clockwise

button 1 centre button

button 10

button 11

button 12

button 13

pen:

button 2

button 3

Bamboo fun:

buttons on left side are button 3, button 8, button 9, button 1

buttons on pen are button 2, button 3

xsetwacom config page

Stop focus stealing on firefox:

Set browser.tabs.loadDivertedInBackground to ‘true’ in about:config

Using Truecrypt on eee

help = ./truecrypt -h

mount volume ./truecrypt –mount /dev/sd?

umount volume ./truecrypt -d /dev/sd?

create encrypted volume ./truecrypt -c /dev/sd?

Rsync exclude

using –exclude is a dark art

apparently try no spaces, double quotes:

–exclude=”DirectoryName/”

if there are any unusual characters (like ‘-‘ and ‘_’) replace them with a wildcard

Reading an mbox file

mail -f ?.mbox

Download all cases from Austlii search

first wget the page with the results then

wget -F -i <name of downloaded file>

Then: clean up filenames

rename .51 .51.html *s51

rename \ s51 s51 *\ s51*

rename \?query .query *\?query*

Then convert each to text:

for i in $(ls *html); do html2text -o ${i%.*}.txt $i; done

Then grep the text files for whatever’s relevant.

Burn ISO Stupid Frickin K3b

cdrecord -v -eject -immed -dao speed=48 dev=2,1,0 blah.iso

Download OOo programming documentation for offline viewing

wget -l 3 –convert-links -r -np http://wiki.services.openoffice.org/wiki/Documentation/BASIC_Guide

Connecting to another machine through Konqueror, mc

use: fish://user@hostname in the location bar

Convert Hard to Soft Paragraph Marks

# from http://sed.sourceforge.net/sedfaq.txt

# delete leading and trailing spaces

s/^[ ^t]*//;s/[ ^]*$//

# sed script to change all paragraphs to long lines
/./{H; $!d;}             # Put each paragraph into hold space
x;                       # Swap hold space and pattern space
s/^\(\n\)\(..*\)$/\2\1/; # Move leading \n to end of PatSpace
s/\n\(.\)/ \1/g;         # Replace all other \n with 1 space
# Uncomment the following line to remove excess blank lines:
# /./!d;
#---end of sed script---

(from http://sed.sourceforge.net/sedfaq.txt)

Strip out Non Printing characters (ASCII)

tr -cd [:print:][:space:] < infile >outfile

Find Files in a directory, print in form yy-mm-dd filename, sorted by modification date

find [path] -name ‘[regex]’ -printf ‘%Ty-%Tm-%Td: %h%f\n’ | sort -k 1

Find won’t find by modification date. Can find by modification date using ls with the regex being the date (eg 08-05-21)

ls -lR [path] | grep [regex] | sort -k 6 | grep [regex]

Sort sorts by date, the second grep highlights the date. Need to figure out how to strip the first 3 fields though…  [see below re awk]

Download a heap of links from a website, without clicking “save link as” on each

drag and drop each link to Kate (using a clipboard tool might also work?)

save file

open kate console

wget -r -i <filename>

(can also use -nd and -P . (no directories and …something))

lynx also has options to just dump a list of links from a page that can then be wget ted

Kill Processes by Name

pgrep

pkill

Open Firefox with Multiple Tabs

firefox <url1> <url2> <url3> etc

also: firefox -remote “openurl(<url>,new-tab)”  (steals focus, raises tab – Set browser.tabs.loadDivertedInBackground to ‘true’ in about:config to stop focus stealing)

Wget search page from Google

include –user-agent=”” in the wget command (or substitute another user agent string)

Regular Expressions in Kate

use the regular expression editor – <blah>*<blah> doesn’t work.  It has to be <blah>.*<blah>

Strip out fields

use <command> | awk ‘{print $x $y}’  [where x,y etc are field numbers]

<command> | cut -d” ” -f[fieldnumber]-  is probably easier though

Files in Path, with name matching pattern contain regex

find [path] -iname [regex] | xargs grep -l [grep regex]

-L for non-matching then use > to output grep -L and grep -l to text files and wc -l to count matching/non-matching

Files in path, just listing name of file

find [path] -print0 -iname [regex] | xargs -l1 -0 basename

List of unique extensions of files in path

find [path] | xargs -l1 basename | awk -F . ‘{if (NF>1) {print $NF}}’ | sort | uniq

less good solutions:

find [path] | awk -F . ‘{print $NF}’ | sort | uniq

can also use ‘{if (NF>1) {print $NF}}’ (which doesn’t report files which have no extension)

For each unique file extension for files in path count number of files with that extension, print tab delimited

for extension in $(find [path] | xargs -l1 basename | awk -F . ‘{if (NF>1) {print $NF}}’ | sort | uniq); do
numberoffiles=$(find [path] -iname ‘*.’$extension | wc -l)
echo “$extension”$’\t'”$numberoffiles”
done

Convert jpgs to pdf

convert -page A4 *.jpg outfile.pdf

Inflexible PDFs

Using kpdf to print a pdf to kprinter -> pdf can make pdfs smaller in size and more flexible to deal with.

Join Pdfs

gs -dBATCH -dNOPAUSE -q -sDEVICE=pdfwrite -sOutputFile=finished.pdf file1.pdf file2.pdf

Might also try pdftk and joinpdf

pdftotext

for i in $(ls *pdf); do pdftotext -nopgbrk $i  ; done

Find files containing pattern, get name of those files

find [path] -iname ‘*.c’ | xargs grep -c [pattern] | grep \:0 | awk -F: ‘{ print $1 }’

The inverted commas are important in awk! -F: says use the colon as the field separator.

Play movies from kde menu

need to use gmplayer because, for some reason, mplayer by itself doesn’t work

Automating responses to programs

expect

Display a Dialogue box

either

dialog (man dialog) eg: dialog –msgbox hi 10 10

or

kdialog eg: kdialog –msgbox “This is a message box”

Convert multiple files to theora

for i in `ls *.dv` ; do ffmpeg2theora $i; done

but remember stupid smart quotes don’t copy correctly so these are back quotes (above the tab key)

Print Pages from Sites with Rubbish layout

use print to pdf file from FF – seems to strip rubbish out and lays out the page properly (no disappearing text in the printout)

MS Word – Wildcard search and replace

First, click “use wildcards”

then go for it.  In replace, “/1” is the first argument found.  See also google search.

Capitalised Words in a text file

grep -o '[[:upper:]][[:alpha:]]*' [text file]

Two Adjacent Capitalised words in a text file

grep -o  '\b[[:upper:]]\w*[[:space:]][[:upper:]]\w*' [file] | sort |uniq

have tried grouping this and repeating it, but grep won’t have a bar of it.  However, this seems to be able to be extended (tediously) to 3 or more adjacent capitalised words.

Video Capture

make sure it’s plugged in properly

ReadyNAS Duo

If a client is listed in read and read/write for a share it is only given read permissions

What time does the hardware clock say it is?

/sbin/hwclock --show

KVM Switch Cycling

Scroll lock - scroll lock -up/down

KDE Keyboard Shortcuts

alt-F12 mouse emulation
alt-F1 popup launch menu

Dump Man page to stdout

man -E ascii -t [alias]

Setting up time controls in PAM

edit common-account in /etc/pam.d to include the line:

account required        pam_time.so

Then add the specific time controls in /etc/security/time.conf

Verify md5sum etc of installed packages:

rpm -qa > pkglist.txt
rpmverify `cat pkglist.txt`

Regex Searching in OpenOffice

 OOo won’t search across para boundaries, so transform by replacing para marks by (eg) PARAPARAG first then search with PARAPARAG as the line break

External: link 1, link 2.

Convert pdf to grayscale on command line:

gs -sOutputFile=output.pdf -sDEVICE=pdfwrite -sColorConversionStrategy=Gray -dProcessColorModel=/DeviceGray -dCompatibilityLevel=1.4 <inputfile>


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




Blog Stats

  • 214,970 hits

OSWALD Newsletter

If you would like to receive OSWALD, a weekly open source news digest please send an email to oswald (with the subject "subscribe") at opensourcelaw.biz

%d bloggers like this: