sudo rmmod pcspkrUpdate: It is better to do,
sudo modprobe -r pcspkr
sudo rmmod pcspkrsudo modprobe -r pcspkr
png2eps can be used. To make png2eps work you would need to install the following: $ sudo aptitude install pngcheck libtiff4 libtiff-tools netpbm $ wget http://www.henlich.de/media/png2eps/png2eps $ chmod a+x png2eps $ ./png2eps myimage.png > myimage.eps \documentclass[a4paper,10pt]{article}
\usepackage{graphics}
\usepackage{graphicx}
\begin{figure}
\caption{some figure}
\begin{center}
\includegraphics[bb=0 0 438 476]{myimage.eps}
\end{center}
\end{figure}sudo aptitude install pidgin pidgin-themes pidgin-facebookchat pidgin-musictracker
.tex file and end up seeing an error ".bbl could not be located", after you open the .dvi file generated, you will notice that the reference section is missing. This is because in the first run LaTeX created the .aux file which needs to be fed to Bibtex which will generate the .bbl file. #1 $ latex source.tex
#2 $ bibtex source.aux (generated in Step #1)
#3 $ latex source.texsrc: aptitude show sqlite) $ sudo aptitude install sqlite3$ latex A.tex sudo aptitude install texlive-full kile kbibtex lyx gcc -shared -Wl,-soname,your_soname -o library_name file_list library_lista.c and b.cgcc -fPIC -g -c -Wall a.c
gcc -fPIC -g -c -Wall b.c
gcc -shared -Wl,-soname,libmystuff.so.1 \
-o libmystuff.so.1.0.1 a.o b.o -lc libmystuff.so and libmystuff.so.1 from libmystuff.so.1.0.1 and don't forget to add the libraries to the standard path /usr/local/lib OR add the path to LD_LIBRARY_PATH before executing.git clone git://gitorious.org/sched_deadline/linux-deadline.git .*
*.lds
*.o
*.o.*
*.a
*.s
*.ko
*.so
*.so.dbg
*.mod.c
*.i
*.lst
*.symtypes
*.order
*.elf
*.bin
*.gz
*.lzma
*.patch
*.gcno
tags
TAGS
bzImage
vmlinux
System.map
Module.markers
Module.symvers
!.gitignore
!.mailmap
patches-*
patches
series
exclude-list
filefortag
filelist
cscope.*
ncscope.*
GPATH
GRTAGS
GSYMS
GTAGS
*.orig
*~ diff --exclude-from /path/to/exclude-list -urNd linux-2.6.24-hunterwala linux-2.6.24 > patch_file include/asm
include/asm-*/asm-offsets.h
include/config
include/linux/autoconf.h
include/linux/compile.h
include/linux/version.h
include/linux/utsrelease.h
include/linux/bounds.h
include/generated-N passed to diff would treat these as new files and include them in the patch. :(.gitignore]
fscanf (fptr, "%*s"); ^^^fscanf (fptr, "%s", buffer);.bashrc file.echo "Welcome to" `hostname` "("`ifconfig eth0 | grep "inet addr:" | awk -F: '{print($2)}' | sed "s/ /:/g" | awk -F: '{print($1)}' `")" #!/bin/sh
#
# (c) Hunterwala
if [ $(/usr/bin/id -u) -ne 0 ]; then
echo "run this script with sudo"
exit 2
fi
if [ -z $1 ]; then
echo "kernel version not found"
echo "usage: ./install_kernel [kernel_version]"
exit 2
else
VERSION=$1
echo "using $VERSION"
fi
if [ ! -d /lib/modules/$VERSION ]; then
echo "kernel modules not installed"
echo "run make install_modules from the kernel directory"
exit 2
fi
BOOTDIR=/boot
echo "Installing kernel ........................"
cp $PWD/.config $BOOTDIR/config-$VERSION
cp $PWD/System.map $BOOTDIR/System.map-$VERSION
cp $PWD/arch/i386/boot/bzImage $BOOTDIR/vmlinuz-$VERSION
echo "done"
echo "Creating initrd image ...................."
update-initramfs -c -k $VERSION
echo "done"
echo "Updating grub ............................"
update-grub
echo "done"
echo "Linux kernel $VERSION successfully installed"
echo "Please restart and select $VERSION in grub menu"%% sudo aptitude install vlcMedia->Open Network, enter the URL and you are good to go. /usr/bin/vlc "URL" /usr/share/icons/hicolor/scalable#!/bin/sh
# While working in console mode (without gdm) this script
# tells you the remaining charge of your laptop battery
#
# Run it along with watch on a separate tty
# $ watch -n 10 ./batmon
#
# (c) Hunterwala, 2009
#
# TODO: check for error levels and buzz using pcspkr mod
# when the charge level decreases beyond that level.
PROC_PATH="/proc/acpi/battery/BAT0"
org_cap=`cat $PROC_PATH/info | grep "last full capacity" | sed "s/ //g" | awk -F: '{print($2)}' | sed "s/mAh//g"`
rem_cap=`cat $PROC_PATH/state | grep "remaining capacity" | sed "s/ //g" | awk -F: '{print($2)}'| sed "s/mAh//g"`
message=`cat $PROC_PATH/state | grep "charging state" | sed "s/ //g" | awk -F: '{print($2)}'| sed "s/mAh//g"`
diff=$(echo "($org_cap-$rem_cap)" | bc)
total_per=$(echo "100-($diff*100/$org_cap)" | bc)
echo "Battery is" $message ":" $total_per"%"batmon.shchmod a+x batmon.sh watch -n 10 ./batmon.shunsigned long long arg1, arg2;
arg1 = arg1/arg2;Unknown symbol __udivdi3unsigned long long arg1, arg2;
unsigned long temp = arg1;
do_div(temp, arg2);
arg1 = temp;
$ sudo aptitude install rpm rpm2cpio. (RPM and initramfs use the CPIO archiver)$ rpm2cpio < some-package.rpm | cpio -i --make-directories --verbose$ sudo aptitude install alien.rpm to .deb$ sudo alien --to-deb --scripts --verbose some-package.rpm rpm2cpio, so make sure you have installed rpm.--scripts : If the .rpm has scripts then you need to include those.deb file. sudo dpkg -i some-package.deb.deb and installing using dpkg is that you can manage the install\uninstall\reinstall and version using apt\aptitude.
dpkg-reconfigure xserver-xorg and it would redo the X11 configuration.$ xrandr $ xrandr --output VGA --auto --above LVDS
c-set-style {chose the mode}
C-x h
C-M \ .emacs file:(server-start)emacsclient -n filenamealias cemacs='emacsclient -n'
alias emacs='emacs &'
~$ sudo aptitude install build-essential ddd insight kdbg kdevelop eclipse eclipse-cdt eclipse-jdt kompare kate bless kile lyx cscope global octave kmplot vim emacs virtualbox-ose pdfedit scribus inkscape checkgmail kompozer manpages manpages-posix easytag gtkpod vlc libncurses5 libncurses5-dev dialog curl sun-java6-jre sun-java6-jdk wireshark qt4-dev-tools qt4-assistant qt4-designer qdevelop monodevelop umbrello git git-core gitk git-gui graphviz doxygen doxygen-gui.deb for~$ sudo apt-get update; sudo apt-get upgrade
if [[ $(/usr/bin/id -u) -ne 0 ]]; then
echo "Not running as root"
exit
fi
curl -u username:password -d status="the message" http://twitter.com/statuses/update.xml.bashrc file.# function to tweet
tweet() {
flag=0
if [[ -z "$1" && -z "$2" ]]; then
echo "Usage: tweet password \"message\""
echo "Make sure the message is within quotes"
flag=1;
fi
if [ ${flag} == "0" ]; then
echo "Sending message...."
curl -u username:$1 -d status="$2" http://twitter.com/statuses/update.xml
fi
} $tweet password "The message goes here"
[Source]
~/.vimrc file" Set tab width
set tabstop=4
set softtabstop=4
set shiftwidth=4
set smarttab
set smartindent
set expandtab
set cursorline
" Show line numbers and cursor position
set ruler
set number
" Disable default splash screen
set shortmess+=I
set guioptions-=T
" Show tabs and trailing white spaces
set list listchars=tab:-»,trail:·,extends:»
" Don't generate backup files
set nobackup
" Set default color scheme to something
colorscheme something~/.vim/colors and put the color scheme inside.oprofile is very helpful in getting a trace out of the kernel especially to know the %age usage of methods from the kernel and the application. Helps in debugging some weird problems.oprofile in the kernel, it is good to build it part of the kernel rather than a kernel module, so make sure in the menuconfig option it is a [*] rather than [m].sudo apt-get install oprofile oprofile-gui$ sudo opcontrol --init vmlinux file so that it can pick the symbols from there$ sudo opcontrol --vmlinux=/path/to/kernel/image# sudo opcontrol --callgraph=#depth$ sudo opcontrol --status$ sudo opcontrol --reset$ sudo opcontrol --start$ ./mystupidapp $ sudo opcontrol --stop$ sudo opcontrol --dump$ sudo opreport -l (and various options if you want) $ sudo opcontrol --reset$ sudo opcontrol --deinit.bashrc file. Really helps!alias opc='sudo opcontrol'
alias opcdeinit='opc --deinit'
alias opcdump='opc --dump'
alias opcinit='opc --init'
alias opcreset='opc --reset'
alias opcstart='opc --start'
alias opcstatus='opc --status'
alias opcstop='opc --stop'
alias opr='sudo opreport -l'
alias oprcall='opr -c'vim is that the parenthesis matching is so damn easy - use % .emacs file
(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))))) Zile and mg and two light-weight options for emacs (sudo apt-get install mg zile )vim[Esc first] :e[Esc first] :wq[Esc first]:w[Esc first]:!q[Esc first] k or Up arrow[Esc first] j or Down arrow[Esc first] h or Left arrow[Esc first] l or right arrow[Esc first] ^[Esc first] $cntrl+bcntrl+fxG[Esc first] u[Esc First] Shift+r[Esc First] x[Esc First] dw[Esc First] dd[Esc first] / nShift+n[Esc first]:help$ vimtutor$ gtags GPATH, GRTAGS, GSYMS, GTAGS M-x gtags-mode RET M-x gtags-make-complete-list M-x gtags-find-tag function_name. M-. M-x gtags-pop-stack. M-* M-x gtags-find-symbol m_myVar M-x gtags-find-with-grep "gtags rules" global -u -v M-x gtags-visit-rootdir and point it to the folder that has the TAGS![M]-W and [C]-Y one can copy and paste inside emacs but it only works for the emacs buffers. In order to enable system wide copy\paste (through the clipboard) with other applications set the following in the .emacs file(setq x-select-enable-clipboard t) META-X set-variable RET x-select-enable-clipboard RET t_ _ _ _OR
| | | |_ _ _ __ | |_ ___ _ ____ ____ _| | __ _
| |_| | | | | '_ \| __/ _ \ '__\ \ /\ / / _` | |/ _` |
| _ | |_| | | | | || __/ | \ V V / (_| | | (_| |
|_| |_|\__,_|_| |_|\__\___|_| \_/\_/ \__,_|_|\__,_|
_ _ __ __ _ _ ____ ____ ____ _ _ __ __ __Make you own and embed it in your source code :)
( )_( )( )( )( \( )(_ _)( ___)( _ \( \/\/ ) /__\ ( ) /__\
) _ ( )(__)( ) ( )( )__) ) / ) ( /(__)\ )(__ /(__)\
(_) (_)(______)(_)\_) (__) (____)(_)\_)(__/\__)(__)(__)(____)(__)(__)
nmap and do a ping sweep: sudo nmap -n -sP 192.168.1.0/24 | grep "00:11:22:33:44"-n tells nmap not to never do reverse DNS resolution on the active IP address it finds. Makes scanning faster-sP Only perform a ping scan (host discovery) and prints the results, go no further.aptitude rather than apt-get because it is easy to purge and clean the dependency chain that it creates. gnome-terminal --geometry 152x55cut and uniq turned out to be quite handy and can be used along with sedcat /proc/cpuinfo | grep "model name" | uniq | cut -d: -f2model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHz
model name : Intel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHzIntel(R) Core(TM)2 Duo CPU E8500 @ 3.16GHzawkcat /proc/cpuinfo | grep "model name" | uniq | awk -F: '{print($2)}'C = Control
M = Meta = Alt|EscC-x C-f "find" file i.e. open/create a file in buffer
C-x C-s save the file
C-x C-w write the text to an alternate name
C-x C-v find alternate file
C-x i insert file at cursor position
C-x b create/switch buffers
C-x C-b show buffer list
C-x k kill buffer
C-z suspend emacs
C-X C-c close down emacsC-f forward char
C-b backward char
C-p previous line
C-n next line
M-f forward one word
M-b backward one word
C-a beginning of line
C-e end of line
C-v one page up
M-v scroll down one page
M-< beginning of text
M-> end of text M-n repeat the following command n times
C-u repeat the following command 4 times
C-u n repeat n times
C-d delete a char
M-d delete word
M-Del delete word backwards
C-k kill line
C-Space Set beginning mark (for region marking for example)
C-W "kill" (delete) the marked region region
M-W copy the marked region
C-y "yank" (paste) the copied/killed region/line
M-y yank earlier text (cycle through kill buffer)
C-x C-x exchange cursor and mark
C-t transpose two chars
M-t transpose two words
C-x C-t transpose lines
M-u make letters uppercase in word from cursor position to end
M-c simply make first letter in word uppercase
M-l opposite to M-uC-g quit the running/entered command
C-x u undo previous action
M-x revert-buffer RETURN (insert like this) undo all changes since last save
M-x recover-file RETURN Recover text from an autosave-file
M-x recover-session RETURN if you edited several filesC-h c which command does this keystroke invoke
C-h k which command does this keystroke invoke and what does it do?
C-h l what were my last 100 typed keys
C-h w what key-combo does this command have?
C-h f what does this function do
C-h v what's this variable and what is it's value
C-h b show all keycommands for this buffer
C-h t start the emacs tutorial
C-h i start the info reader
C-h C-k start up info reader and go to a certain key-combo point
C-h F show the emacs FAQ
C-h p show infos about the Elisp package on this machineC-s Search forward
C-r search backward
C-g return to where search started (if you are still in search mode)
M-% query replace
Space or y replace this occurrence
Del or n don't replace
. only replace this and exit (replace)
, replace and pause (resume with Space or y)
! replace all following occurrences
^ back to previous match
RETURN or q quit replace ^ beginning of line
$ end of line
. single char
.* group or null of chars
\< beginning of a word
\> end of a word
[] every char inside the backets (for example [a-z] means every small letter)
M C-s RETURN search for regular expression forward
M C-r RETURN search for regular expression backward
M C-s incremental search
C-s repeat incremental search
M C-r incremental search backwards
C-r repeat backwards
M-x query-replace-regexp search and replaceC-x 2 split window vertically
C-x o change to other window
C-x 0 delete window
C-x 1 close all windows except the one the cursors in
C-x ^ enlarge window
M-x shrink-window command says it ;-)
M C-v scroll other window
C-x 4 f find file in other window
C-x 4 o change to other window
C-x 4 0 kill buffer and window
C-x 5 2 make new frame
C-x 5 f find file in other frame
C-x 5 o change to other frame
C-x 5 0 close this frameC-x r m set a bookmark at current cursor pos
C-x r b jump to bookmark
M-x bookmark-rename says it
M-x bookmark-delete "
M-x bookmark-save "
C-x r l list bookmarks
d mark bookmark for deletion
r rename bookmark
s save all listed bookmarks
f show bookmark the cursor is over
m mark bookmarks to be shown in multiple window
v show marked bookmarks (or the one the cursor is over)
t toggle listing of the corresponding paths
w " path to this file
x delete marked bookmarks
Del ?
q quit bookmark list
M-x bookmark-write write all bookmarks in given file
M-x bookmark-load load bookmark from given fileM-x shell starts shell modus
C-c C-c same as C-c under unix (stop running job)
C-d delete char forward
C-c C-d Send EOF
C-c C-z suspend job (C-z under unix)
M-p show previous commandsC-x d start up dired
C (large C) copy
d mark for erase
D delete right away
e or f open file or directory
g reread directory structure from file
G change group permissions (chgrp)
k delete line from listing on screen (don't actually delete)
m mark with *
n move to next line
o open file in other window and go there
C-o open file in other window but don't change there
P print file
q quit dired
Q do query-replace in marked files
R rename file
u remove mark
v view file content
x delete files marked with D
z compress file
M-Del remove all marks (whatever kind)
~ mark backup files (name~ files) for deletion
# mark auto-save files (#name#) for deletion
*/ mark directory with * (C-u * removes that mark again)
= compare this file with marked file
M-= compare this file with it's backup file
! apply shell command to this file
M-} change to the next file marked with * od D
M-{ " previous "
% d mark files described through regular expression for deletion
% m " (with *)
+ create directory
> changed to next dir
< change to previous dir
s toggle between sorting by name or date
M-x speedbar starts up a separate window with a directory viewM-x telnet starts up telnet-modus
C-d either delete char or send EOF
C-c C-c stop running job (similar to C-c under unix)
C-c C-d send EOF
C-c C-o clear output of last command
C-c C-z suspend execution of command
C-c C-u kill line backwards
M-p recall previous commandM-s center line
M-S center paragraph
M-x center-region name saysC-x ( start macro definition
C-x ) end of macro definition
C-x e execute last definied macro
M-n C-x e execute last defined macro n times
M-x name-last-kbd-macro give name to macro (for saving)
M-x insert-keyboard-macro save named macro into file
M-x load-file load macro
M-x macroname execute macronameM C-\ indent region between cursor and mark
M-m move to first (non-space) char in this line
M-^ attach this line to previous
M-; formatize and indent commentM-a beginning of statement
M-e end of statement
M C-a beginning of function
M C-e end of function
C-c RETURN Set cursor to beginning of function and mark at the end
C-c C-q indent the whole function according to indention style
C-c C-a toggle modus in which after electric signs (like {}:';./*) emacs does the indention
C-c C-d toggle auto hungry mode in which emacs deletes groups of spaces with one del-press
C-c C-u go to beginning of this preprocessor statement
C-c C-c comment out marked area
M-x outline-minor-mode collapses function definitions in a file to a mere {...}
M-x show-subtree If you are in one of the collapsed functions, this un-collapses it M-. (Thats Meta dot) If you are in a function call, this will take you to it's definition
M-x tags-search ENTER Searches through all you etaged
M-, (Meta comma) jumps to the next occurence for tags-search
M-x tags-query-replace yum. This lets you replace some text in all the tagged filesM-x gdb starts up gdm in an extra windowC-x v d show all registered files in this dir
C-x v = show diff between versions
C-x v u remove all changes since last checkin
C-x v ~ show certain version in different window
C-x v l print log
C-x v i mark file for version control add
C-x v h insert version control header into file
C-x v r check out named snapshot
C-x v s create named snapshot
C-x v a create changelog file in gnu-style sudo mount -t iso9660 -o loop /path/to/the/iso /folder/to/mount/into ISOFS: Unable to identify CD-ROM format., do a file /path/to/the/iso and confirm that the file that you think is an ISO, actually is.
sudo aptitude install openssh-server ssh username@ipaddress:port ssh username@ipaddress:portcd local_folder
scp username@ipaddress:port:/home/username/path/to/folder_file . scp /path/to/local/folder_file username@ipaddress:port:/home/username/path nautilus --no-dektop --browser
Location Bar: sftp://username@ipaddress:port/home/usernameroot folder as well, but is not a good practice to screw around in that area
-+-ifconfig, get the IP address associated to the ppp0 (p-t-p), specify your local router gateway and the interface you are connected through (wireless or wired) and fire the script! #!bin/sh
# Check for command line
if [ -z "$1" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
if [ -z "$2" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
if [ -z "$3" ]; then
echo "usage: ./vpn.sh [p-t-p] [GW] [Interface]"
exit
fi
VPN_REMOTE_IP=$1
ALLTARGET="198.82.0.0/16" # All class C addresses
GATEWAY=$2
INTERFACE=$3 #eth0 or eth1
# change!
route add -host $VPN_REMOTE_IP gw $GATEWAY dev $INTERFACE
route add -net $ALLTARGET dev ppp0% ssh -X username@hostname
% matlab &/etc/ssh/ssh_config and also remove the #ForwardAgent yes (default no)
ForwardX11 yes (default is no)
StrictHostKeyChecking no (default is ask) ssh username@hostname% vncviewer hostname:display% ssh -C -L 5901/localhost/5901 username@hostname
% vncviewer localhost:5901vncserver is running on the remote node and also that you have set your vncpasswd. The "display" is the number that you get after starting the vncserver % export MATLAB_JAVA=/usr/lib/java/blah-blah/jre
% matlab & env MATLAB_JAVA="/usr/lib/jvm/java-6-sun/jre" xterm "/home/piyush/matlab-2007b/bin/matlab"
[control]+[spacebar]. Then move down the cursor to which you need to copy\cut. OR, [control]+[spacebar]+[spacebar] and page down to the desired block in one shot![alt]+[w], OR Cut using [control]+[w][control]+[y]initrd is a RAM disk file image of the kernel used at the time of boot. On Ubuntu it is created using mkinitramfs or update-initramfs commands when a new kernel is installed. This image is a gunzip\cpio archive./home/node/temp. Let's say it is initrd-2.6.24-generic cat initrd-2.6.24-generic | gunzip | cpio -ivdm bzcat initrd-2.6.24-generic | cpio -ivdm L/arch/x86/kernel/syscall_table_32.S .long sys_new_system_call L/linux/include/asm-x86/unistd_32.h #define __NR_new_system_call XXX #define __NR_syscalls XXYL/include/linux/syscalls.h asmlinkage long new_system_call (whatever params you want to pass) core-y += /kernel /blah /blah /blah /mysyscall asmlinkage long new_system_call (whatever params you want to pass)
{
// whatever you want to do
} obj-y := mysyscall.o /* header.h */
#include < linux/unistd.h >
#define __NR_new_system_call XXX
/* if you system call returns int and takes no parameter
* use this macro
*/
_syscall0(int,new_system_call)
/* Otherwise, depending on the number of parameters
* being passed use the _syscallN macro, N being the no
* of params, like
_syscall1(int, new_system_call, int) /* test client */
#include "header.h"
int main (void)
{
printf ("System call returned %d \n", new_system_call());
return 1;
}_syscallXX macros were removed from header files supplied to user space. Instead we need to use syscall() function. printf ("System call returned %d \n", syscall (__NR_new_system_call, params_if_any)); /* header.h */
#include < linux/unistd.h >
#include < sys/syscall.h >
#define __NR_new_system_call XXX
long new_system_call (params_if_any)
{
return syscall (__NR_new_system_call, params_if_any);
}