wireless commands
iwlist wlan0 scan
wevent &
iwconfig wlan0 key open xxxxx
iwconfig wlan0 essid xxxx
Tuesday, March 30, 2010
Wednesday, March 17, 2010
Set program output to environment variable in batch file
FOR /F "tokens=*" %A IN ('prog.exe') DO SET ENVVAR=%A
gcc, gdb and make commands
Macro definition
gcc -D DUMMY_DEF -c test_str.c
Makefile arguments
test:
./program $(PROG_ARGS)
make test PROG_ARGS='testfile1.txt'
gdb commands
run args - runs program
frame - examines current frame
up - examines previous frame
gcc -D DUMMY_DEF -c test_str.c
Makefile arguments
test:
./program $(PROG_ARGS)
make test PROG_ARGS='testfile1.txt'
gdb commands
run args - runs program
frame - examines current frame
up - examines previous frame
Wednesday, February 24, 2010
Sunday, January 24, 2010
Mortgage calculator - bash script
This simply outputs the monthly mortgage payment.
Takes five arguments : principle years interest points fees
For instance,
bash mortgage.sh 100000 5 .075 0 0
Outputs
Principle + fees = 100000 , Years = 5 , Months = 60 , interest .006250000000
Points = 0 , 0
2003.794859563881
Takes five arguments : principle years interest points fees
For instance,
bash mortgage.sh 100000 5 .075 0 0
Outputs
Principle + fees = 100000 , Years = 5 , Months = 60 , interest .006250000000
Points = 0 , 0
2003.794859563881
#!/bin/sh
if [[ $# -ne 5 ]]
then
echo "enter 5 args : principle years interest points fees"
exit
fi
prin=$1
((mon=$2 * 12 ))
inter=`echo "scale=12;$3/12" | bc`
pts=`echo "scale=12; $prin * $4" | bc`
fee=$5
prin=`echo "scale=12;$prin + $fee" | bc`
echo "Principle + fees = $prin , Years = $2 , Months = $mon , interest $inter"
echo "Points = $4 , $pts"
prin=`echo "scale=12; $prin - $pts" | bc`
echo `echo "scale=12;($prin*$inter)*((1+$inter)^$mon)/(((1+$inter)^$mon)-1)"|bc`
echo "the monthly payment : $new_prin"
Sunday, January 17, 2010
start menu pin list location
> If I pin a shortcut to the startmenu, where does XP store this
> information?
With a shortcut in this folder...
C:\Documents and Settings\All Users\Start Menu
The above folder would be the easiest.
Also here...
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Explorer\MenuOrder\Start Menu2\Programs
Value Name: Order
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\
Explorer\StartPage
Value Name: Favorites
Value Name: FavoritesResolve
All of those are REG_BINARY values and hard to read them.
Monday, January 11, 2010
Bash - Gaussian Elimination Op count example
#!/bin/sh
if [[ $# -ne 2 ]]
then
exit
fi
echo " m $1 by n $2 matrix"
n=$2
m=$1
mult=0
add=0
c=0
for ((i=1;i < m;i++))
do
echo "row = i = $i"
for ((j=i;j < m;j++))
do
((mult=mult + (n-i+1)))
((add=add + (n-i+1)))
done
((c=c+(m-i)*(n-i+1)))
done
echo "additions = $add"
echo "mults = $mult"
echo "summation = $c"
Subscribe to:
Posts (Atom)