Categories

Technical Notes

To write an image file to boot media with dd, carry out the following steps:

1. Locate the image file.
2. Attach or insert the media.
3. Your system may automatically detect and open the media. If that happens, close or unmount the media before continuing.
4. Open a terminal window.
5. In the terminal window, type the following command:
dd if=diskboot.img of=/dev/<device>
(Replace <device> with the name of the correct device file for the media.)

When redirect doesn’t work in PHP/Apache:

header('http://garamchai.frivologs.com/');
exit;

the above doesn’t work, but the following does:

header('Refresh: 0; http://garamchai.frivologs.com/');
exit;

The above tested to work in FF. Doesn’t in IE. To exclude IE from the above redirect, check:

if (strpos(strtolower($_SERVER[HTTP_USER_AGENT]), "msie") === FALSE) {

Changing exif data for all images in current directory

for f in `ls *.JPG`
do
sed 's/4MP-9J9/Yashica/' < $f > /tmp/$f
mv /tmp/$f $f
done

The string length of replacing string must be the exact same length as the one being replaced. Otherwise, the file could get corrupted.

Changing filenames of images in current directory After editing (read: deleting) images, the filenames are not in a sequence. To give these images a sequence:

n=1
for f in `ls *.JPG`
do
mv $f pic_$n.JPG
n=`expr $n + 1`
done

will give a sequence to filenames starting from 1.

My little .emacs file:

(display-time)
(line-number-mode 1)
(setq next-line-add-newlines nil) ; Emacs will add lines to the bottom of your
; buffer as you scroll down further using
; next line. XEmacs doesn't do this. I don't
; either.
;; C-c C-g to goto line number
(global-set-key "\C-x\C-g" `goto-line)


;; do not echo passwords in shell
(add-hook `comint-output-filter-functions
`comint-watch-for-password-prompt)


;; do not echo ^M characters
(add-hook 'comint-output-filter-functions
'comint-strip-ctrl-m)


;; Use the following line to tell Emacs to never use tab characters
;; for indentation:
(setq-default indent-tabs-mode nil)


;; In order to correctly view files with non-standard tab width settings,
;; it is possible to set the variable tab-width, like this: (tab-width is set to two spaces)
(setq-default tab-width 2)
;; this setting, however, is screwing up the formatting in SQL*Plus. Hence, comment it and "M-x load-file"
;; when using with SQL*Plus window


;; Set the default fill column to 80
(setq-default fill-column 80)


;; display the column number
(setq-default column-number-mode t)


(setq-default auto-fill-mode t)




;; added 07/08/2003
;; for the edit area
(set-background-color "gray37")
(set-foreground-color "cornsilk4") ;; the scrollbar color
(set-cursor-color "white")


;; set this backgroud to be same as edit area background
(set-face-background 'default "gray37")
(set-face-foreground 'default "black")




;; for highlighted area
(set-face-background 'region "gray")
(set-face-foreground 'region "black")


;; modeline
;;(set-face-background 'modeline "dim gray")
(set-face-background 'modeline "Tan")
(set-face-foreground 'modeline "black")


;; match-paren (like in vi)
(global-set-key "%" 'match-paren)


(defun match-paren (arg)
"Go to the matching paren if on a paren; otherwise insert %."
(interactive "p")
(cond ((looking-at "\\s\(") (forward-list 1) (backward-char 1))
((looking-at "\\s\)") (forward-char 1) (backward-list 1))
(t (self-insert-command (or arg 1)))))