Showing posts with label tool. Show all posts
Showing posts with label tool. Show all posts

2011/08/29

How to get device vender ID

To get the vendor ID of a USB device on Linux "lsusb" will tell you what's what:

steve@media:~/android-sdk-linux/tools$ lsusb
Bus 002 Device 003: ID 045e:0040 Microsoft Corp. Wheel Mouse Optical
Bus 002 Device 002: ID 046d:c315 Logitech, Inc. Classic New Touch Keyboard
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 011: ID 18d1:4e12
Bus 001 Device 006: ID 04b8:011f Seiko Epson Corp. Perfection 1670
Bus 001 Device 003: ID 1058:1003 Western Digital Technologies, Inc.
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

2011/06/27

Useful Online Tools

Get string's binary in different kind of encoding
http://str2bin.appspot.com/


Beautifully format your code (C, C++, Java ...) with HTML tags, make it easier to share code on the HTML page
http://www.blogtrog.com/


JavaScript Compiler
http://closure-compiler.appspot.com/

2011/06/09

Linux Command Examples

Delete a folder recursively
find . -type d -name .svn -exec rm -rf {} \;

Kernel Debug Message
dmesg -wH

Zip and unzip
tar czvf xxx.tgz folder/
tar xvzf file-1.0.tar.gz
tar xvjf file-1.0.tar.bz2
tar xvf file-1.0.tar

Get the log to a file
./some_exe 2>&1 | tee fileName.log

How to find a file by name
find /etc -name "ho*t" -print
updatedb
locate filenamefin

How to grep a string from a folder
grep -R "string string" *

Check the return value of the command
echo $?c

How to patch diff
diff -rupN original/ new/ > some.diff
patch -p0 --dry-run < some.diff
patch -p0 < some.diff
patch -p0 -R < some.diff

Version Control
create branch
svn copy http://svn.example.com/repos/calc/trunk  http://svn.example.com/repos/calc/branches/my-calc-branch  -m "Creating a private branch of /calc/trunk."

delete .svn
rm -rf `find . -type d -name .svn`

delete cvs
find . -name 'CVS' -type d -exec rm -rf {} \;

Device Access
sudo dd of=/dev/zero if=/dev/mtd0 skip=1 bs=512 count=1

2011/06/06

Read Memory Usage from Status of Proc

VmPeak: 8368 kB (peak usage of virtual memory)
VmSize: 7344 kB (usage of virtual memory)
VmLck: 0 kB (locked memory)
VmHWM: 2336 kB (peak usage of hardware memory)
VmRSS: 2336 kB (usage of hardware memory)
VmData: 3052 kB (heap)
VmStk: 88 kB (stack)
VmExe: 16 kB (text section)
VmLib: 4080 kB (shared library)
VmPTE: 56 kB (page table entry size)

Explanation comes from:
http://d.hatena.ne.jp/naoya/20080727/1217119867
http://www.kernel.org/doc/man-pages/online/pages/man5/proc.5.html
http://www.linuxquestions.org/questions/programming-9/vmsize-regarding-proc-pid-status-432227/

Post Code on Blogger

Simplest way to post code to blogger for me: <pre style="background: #f0f0f0; border: 1px dashed #CCCCCC; color: black;overflow-x:...