Cheat Sheet on programming and scripting languages
All in one
http://www.cheat-sheets.org/
http://refcardz.dzone.com/
1. Apache
http://www.petefreitag.com/cheatsheets/apache/
Apache Ant
http://refcardz.dzone.com/refcardz/getting-started-apache-ant?oid=hom24765
Apache Cassandra
http://refcardz.dzone.com/refcardz/apache-cassandra
Apahce Hadoop
http://refcardz.dzone.com/refcardz/getting-started-apache-hadoop
2. awk
http://www.catonmat.net/download/awk.cheat.sheet.pdf
3. sed
http://www.catonmat.net/download/sed.stream.editor.cheat.sheet.pdf
4. ed
http://www.catonmat.net/download/ed.text.editor.cheat.sheet.pdf
5. C
http://www.digilife.be/quickreferences/QRC/C%20Reference%20Card%20%28ANSI%29%202.2.pdf
On Linux to link with Linux header files
5.1 with ctags
First run ctags
Modify ~/.vimrc file
set tags=linux/tags
5.2 without ctags
shift + k to go to man page
go to header file and then press gf to go header file
ctrl + o to come back from header file to original code.
6. Core C# and .Net
http://www.digilife.be/quickreferences/QRC/C%20Reference%20Card%20%28ANSI%29%202.2.pdf
http://www.cheat-sheets.org/saved-copy/NETFX4-Poster.pdf
7. C# and VB.Net
http://aspalliance.com/625
8. String Formatting in C#
http://blog.stevex.net/string-formatting-in-csharp/
9. C++
http://cs.fit.edu/~mmahoney/cse2050/how2cpp.html
http://www.dreamincode.net/downloads/ref_sheets/cpp_reference_sheet.pdf
10. STL
http://www.digilife.be/quickreferences/QRC/STL%20Quick%20Reference%201.29.pdf
11. Eclipse Keyboard shortcut
http://eclipse-tools.sourceforge.net/shortcuts.html
12. C++ V/s Java
http://www4.ncsu.edu/~kaltofen/courses/Languages/JavaExamples/cpp_vs_java/
13. JavaScript
http://www.javascript.su/
https://www.addedbytes.com/cheat-sheets/javascript-cheat-sheet/
http://www.cheat-sheets.org/saved-copy/javascript_cheat_sheet.png
14. HTML Special Characters
http://www.webmonkey.com/2010/02/special_characters/
15. HTML
http://www.webmonkey.com/2010/02/html_cheatsheet/
http://www.cheat-sheets.org/saved-copy/html-cheat-sheet.png
16. Prototype JavaScript Library
http://www.snook.ca/files/prototype_1.5.0_snookca.pdf
17. RStudio
http://www.rstudio.com/resources/cheatsheets/
18. Calculus
http://tutorial.math.lamar.edu/pdf/Calculus_Cheat_Sheet_All.pdf
19. CSS
http://www.petefreitag.com/cheatsheets/css/
20. Debian Linux
http://www.cheat-sheets.org/saved-copy/refcard-en-a4.pdf
21. Django
http://www.cheat-sheets.org/saved-copy/django_reference_sheet.pdf
22. Locator
XPATH, CSS, DOM, Selenium
http://www.cheat-sheets.org/saved-copy/Locators_table_1_0_2.pdf
23. Firebug
http://refcardz.dzone.com/refcardz/getting-started-firebug-15
24. Git
http://www.cheat-sheets.org/saved-copy/git-cheat-sheet.svg
25. Haskell
http://www.cheat-sheets.org/saved-copy/Haskell.CheatSheet.pdf
26. Java
http://www.cheat-sheets.org/saved-copy/java_quickref.pdf
27. JQuery
http://www.cheat-sheets.org/saved-copy/jQuery-1.5-Visual-Cheat-Sheet.pdf
28. Mathematica
http://www.cheat-sheets.org/saved-copy/mathematica-cheat-sheet.pdf
29. Matlab
http://www.cheat-sheets.org/saved-copy/matlab_quickref.pdf
30. MySQL
http://www.cheat-sheets.org/saved-copy/mysql_cheat_sheet.png
31. Design Pattern
http://refcardz.dzone.com/refcardz/design-patterns
32. OpenStack
http://refcardz.dzone.com/refcardz/getting-started-openstack-most
33. Nmap
http://www.cheat-sheets.org/saved-copy/Nmap5.cheatsheet.eng.v1.pdf
34. Oracle / SQL
http://www.cheat-sheets.org/saved-copy/oracle_sql_reference.pdf
http://www.sql.su/
SQLLite
http://www.cheat-sheets.org/own/sqlite/Syntax.Diagrams.For.SQLite.html
35. Python
http://www.cheat-sheets.org/saved-copy/PQRC-2.4-A4-latest.pdf
36. Scala
http://www.cheat-sheets.org/saved-copy/Scala_Cheatsheet.pdf
37. Wordpress
http://www.cheat-sheets.org/saved-copy/wpcs.png
38. XML
http://www.cheat-sheets.org/saved-copy/XMLquickref.pdf
39. Shell Script
http://www.cheat-sheets.org/saved-copy/shellscripcheatsheet.pdf
40. Linux, Unix, Ubuntu
http://www.cheat-sheets.org/saved-copy/ubunturef.pdf
http://www.cheat-sheets.org/saved-copy/unix_command_quickref.pdf
http://www.pixelbeat.org/cmdline.html
http://jd40c.com/linux.html
Linux Tips and Tricks
@reboot /home/xyz/myscript.sh
Do remember to enable crond on boot.
Here is a command that will let you know about the available shells on your Linux distribution:
#chsh -l
To change your login shell, use the following command:
# chsh
lsusb – Lists all USB devices. Use -v for verbose output.
lsmod – Lists the status of modules in the Linux kernel.
lsattr – Lists file attributes on a second extended Linux file system.
lsof – Lists the file descriptors opened by all the processes. A very useful command when a process fails to close any file descriptors.
ls -lSr Show files by size, biggest last
pushd . Put current dir on stack so you can popd back to it
1. To view the content of a tar file, issue the following command:
#tar -tvf /path/to/file.tar
2. To view the content of an rpm file, use the command given below:
#rpm -qlp /path/to/file.rpm
$ uname -a
Kernel version and system architecture
Built in variables:
$1-$N Stores the arguments (variables) that were passed to the shell program from the command line.
$? Stores the exit value of the last command that was executed.
$0 Stores the first word of the entered command (the name of the shell program).
$* Stores all the arguments that were entered on the command line ($1 $2 ...).
"$@" Stores all the arguments that were entered on the command line, individually quoted ("$1" "$2" ...).
UDPnmap -sU -O
As all of us know, if you make changes in a file using VIM editor, the changes are permanent and you cannot get the old version back after you save and quit the editor.
But VIM v7.3 allows you to get the old version back even after quitting the editor.
Here is a tip that shows you how to configure VIM to remember changes.
To enable Undo, execute the following commands in VIM just before starting to edit the file.
:set undofile
:set undodir=/tmp
This is to be done every time you start editing a file. In case you need the configuration to be there for all files that you open in VIM, create a file called '.exrc' or '.vimrc' in $HOME directory. In my case, it is /myhome.
Open the just created file and add the following commands:
# vi /myhome/.exrc
set undofile
set undodir=/tmp
Save and close the file.
:wq
From now onwards, the Undo history is maintained in the background for all files that you edit with VIM.
Iperf is a tool that measures the bandwidth and the quality of a network link. It can be installed very easily on any Linux system. One host must be set as the client and the other one as the server. Make sure that iperf is installed on both systems. If it is not installed, then use your package manager to install it before trying this tip.
Now run iperf on one of the Linux systems as the server, as shown below:
linux-erv3:/home/test/Desktop # iperf -s
------------------------------------------------------------
Server listening on TCP port 5001
TCP window size: 85.3 KByte (default)
------------------------------------------------------------
Go to the second Linux system and run iperf -c as the client:
linux-6bg3:~ # iperf -c 192.168.1.100
------------------------------------------------------------
Client connecting to 192.168.1.100, TCP port 5001
TCP window size: 16.0 KByte (default)
------------------------------------------------------------
[ 3] local 192.168.1.109 port 39572 connected with 192.168.1.100 port 5001
^C[ ID] Interval Transfer Bandwidth
[ 3] 0.0- 6.3 sec 6.38 MBytes 8.51 Mbits/sec
By default, the iperf client connects to the iperf server on the TCP port 5001 and the bandwidth displayed by iperf is the bandwidth from the client to the server. In the above example, it is 8.51 Mbits/sec between two Linux test systems connected over a wireless network.
netstat -i
To display the kernel routing table:
netstat -rn
To display all open network sockets:
netstat -uta
To display network statistics:
netstat -s
BASH Script
Convert images to ascii art
$ asciiview Tux.png -driver curses
To download a web page(s):
#wget -m -r -l5
Show information about mounted volumes:
#df -h
Networking
ethtool eth0 Show status of ethernet interface eth0
ethtool --change eth0 autoneg off speed 100 duplex full Manually set ethernet interface speed
iw dev wlan0 link Show link status of wireless interface wlan0
iw dev wlan0 set bitrates legacy-2.4 1 Manually set wireless interface speed
• iw dev wlan0 scan List wireless networks in range
• ip link show List network interfaces
ip link set dev eth0 name wan Rename interface eth0 to wan
ip link set dev eth0 up Bring interface eth0 up (or down)
• ip addr show List addresses for interfaces
ip addr add 1.2.3.4/24 brd + dev eth0 Add (or del) ip and mask (255.255.255.0)
• ip route show List routing table
ip route add default via 1.2.3.254 Set default gateway to 1.2.3.254
• ss -tupl List internet services on a system
• ss -tup List active connections to/from system
• host pixelbeat.org Lookup DNS ip address for name or vice versa
• hostname -i Lookup local ip address (equivalent to host `hostname`)
• whois pixelbeat.org Lookup whois info for hostname or ip address
Text Manipulation
sed 's/string1/string2/g' Replace string1 with string2
sed 's/\(.*\)1/\12/g' Modify anystring1 to anystring2
sed '/^ *#/d; /^ *$/d' Remove comments and blank lines
sed ':a; /\\$/N; s/\\\n//; ta' Concatenate lines with trailing \
sed 's/[ \t]*$//' Remove trailing spaces from lines
sed 's/\([`"$\]\)/\\\1/g' Escape shell metacharacters active within double quotes
• seq 10 | sed "s/^/ /; s/ *\(.\{7,\}\)/\1/" Right align numbers
• seq 10 | sed p | paste - - Duplicate a column
sed -n '1000{p;q}' Print 1000th line
sed -n '10,20p;20q' Print lines 10 to 20
sed -n 's/.*
sed -i 42d ~/.ssh/known_hosts Delete a particular line
sort -t. -k1,1n -k2,2n -k3,3n -k4,4n Sort IPV4 ip addresses
• echo 'Test' | tr '[:lower:]' '[:upper:]' Case conversion
• tr -dc '[:print:]' < /dev/urandom Filter non printable characters
• tr -s '[:blank:]' '\t'
• history | wc -l Count lines
• seq 10 | paste -s -d ' '
Debugging
• strace -c ls >/dev/null Summarise/profile system calls made by command
• strace -f -e open ls >/dev/null List system calls made by command
• strace -f -e trace=write -e write=1,2 ls >/dev/null Monitor what's written to stdout and stderr
• ltrace -f -e getenv ls >/dev/null List library calls made by command
• tcpdump not port 22 Show network traffic except ssh. See also tcpdump_not_me
Ref:
http://www.cheat-sheets.org/saved-copy/ubunturef.pdf
http://www.cheat-sheets.org/saved-copy/unix_command_quickref.pdf
http://www.pixelbeat.org/cmdline.html
http://jd40c.com/linux.html
* Delete line above current line at VIM : dgg
* Delete line above at VIM : jdG