Linux Tips: Difference between revisions
No edit summary |
|||
Line 31: | Line 31: | ||
</pre> | </pre> | ||
== Backup ccnorthjersey.org == | == Backup [[http://www.ccnorthjersey.org ccnorthjersey.org]] == | ||
<pre> | <pre> | ||
$ rsync -avz -e ssh ccnorthj@ccnorthjersey.org:/home/ccnorthj /cygdrive/c/Backup/ccnorthjersey.org | $ rsync -avz -e ssh ccnorthj@ccnorthjersey.org:/home/ccnorthj /cygdrive/c/Backup/ccnorthjersey.org |
Revision as of 12:56, 12 September 2007
Damn Small Linux on Dell Latitude D620
I installed DSL onto a USB drive, and tried to boot linux off the drive. The kernel would always panic, regardless of the cheat codes I tried. Next, I tried burning DSL to a CD-ROM. Booting the CD-ROM with the 'dsl acpi=off' switch got me to the desktop. I was able to mount the HD, but not see the USB drive. After trying all sorts of things to mount the USB drive, I decided to try turning off USB emulation in the BIOS. This worked and I was able to copy the files from the NTFS partition to my 1 GB FAT USB stick.
tr
I like to use 'tr' to create long constant names in Java. When CheckStyle complains that '2004' is a magic number, I like to replace it with something more interesting than 'YEAR_2004'. I haven't found a way to do this inside of IntelliJ but having a Bash shell open makes this easy.
$ echo "International Year to Commemorate the Struggle against Slavery and its Abolition" | tr '\ -' '__' | tr [:lower:] [:upper:] INTERNATIONAL_YEAR_TO_COMMEMORATE_THE_STRUGGLE_AGAINST_SLAVERY_AND_ITS_ABOLITION
Script to colorize source code using vim
Create a .tar.gz archive
tar -pczf name_of_your_archive.tar.gz /path/to/directory
Unzip and extract an archive
gzip -drv ruby-1.8.3.tar.gz tar -xf ruby-1.8.3.tar
Copy files from work to this website
rsync -avz -e ssh --rsync-path=/usr/bin/rsync /u/eggebr/tmp/ttf-bitstream-vera-1.10/ egge@theeggeadventure.com:/home/egge/fonts rsync -avz -e ssh --rsync-path=/usr/bin/rsync /u/eggebr/.vimrc egge@theeggeadventure.com:/home/egge/
Backup [ccnorthjersey.org]
$ rsync -avz -e ssh ccnorthj@ccnorthjersey.org:/home/ccnorthj /cygdrive/c/Backup/ccnorthjersey.org
Backup theeggeadventure.com
$ rsync -avz -e ssh egge@theeggeadventure.com:/home/egge /cygdrive/c/Backup/theeggeadventure.com
Get a stack trace from a running Python process
This will print the stack, and then the process will exit. I'm not sure how to get the stack without killing the process.
kill -SIGINT 28350
My bash prompt
Note - it's important to that the non-printing characters are enclosed in "\[" and "\[" so bash can do line wraps properly.
export PS1="\[\e[32m\]\h\[\e[0m\]@\[\e[34m\]\W$\[\e[0m\] "
Use sed to remove ANSI colors
echo -e '\e[31mfoo\e[0m' | sed 's/^[\[[0-9]\+m//g'
Note, I couldn't figure out how to make sed accept a \e or \033 for an escape character, so I typed 'Ctrl-V Ctrl-[' in my shell to create an escape character inline.
Redirecting sudo output
Long answer: http://www.dagnall.net/blog/?p=41
Short answer:
sudo -u someuser /bin/bash -c \"command > out.txt\"
Touch all open files in a directory
lsof +D $PWD | awk '{print $9}' | uniq | grep -v NAME | touch
Missing font problem
- Problem: I get this warning when running xemacs on a Linux WS3 host:
Warning: Missing charsets in String to FontSet conversion Warning: Unable to load any usable fontset
I don't have this issue on RH 8.0 hosts or SunOS.
- Fix: The problem is the LANG environment variable.
It's probably set to en_US.UTF-8. Change it to en_US.iso88591, and the warning should go away. Or else find some fonts that are UTF-8 encoded, I suppose.
so you can set your .envrc or just do a
setenv LANG en_US.iso88591
Search & Replace text in a batch of files
for f in `ffind "*.java" | xargs grep -l "foo"`; do sed -e "s/foo/bar/" ${f} > tmp; mv -f tmp ${f} ; done
Verify all the jar's in the classpath exist
# Warn if any jar's are missing echo $CLASSPATH | tr ":" "\n" | xargs cksum > /dev/null