Skip to content

Instantly share code, notes, and snippets.

View danish-rehman's full-sized avatar

danish-rehman

View GitHub Profile
@danish-rehman
danish-rehman / cmd_beautify
Created January 9, 2015 02:20
Command line beautification
YELLOW="\[\033[0;33m\]"
CLEAR="\[\033[0;0m\]"
PS1="\$(date +%H:%M) \w$YELLOW \$(parse_git_branch)$CLEAR \$ "
@danish-rehman
danish-rehman / git_cmd
Last active August 29, 2015 14:13
Git command
#Diff with master
>> git diff master — filename
# Checkout submodule
>> git submodule update
# Undo last commit
>> git reset —soft HEAD~1
# Add remote repo
@danish-rehman
danish-rehman / curl_cmd
Created January 9, 2015 02:58
Curl command
# Basic get request
>> curl -v http://www.test.com
# Get request with a header
>> curl -v http://www.test.com?debug=1 -H "Cookie: Key=Value;”
@danish-rehman
danish-rehman / tcp_send_recv
Created January 9, 2015 07:12
Set send and Recieve TCP window
# (Maximum TCP Sender Window)
>> /proc/sys/net/ipv4/tcp_wmem
4096 16384 4194304
(Maximum TCP Receive Window)
>> /proc/sys/net/ipv4/tcp_rmem
4096 87380 6291456
@danish-rehman
danish-rehman / view_window
Created January 9, 2015 07:22
See the values of TCP window
# current receiver window size
>> sysctl -n net.ipv4.tcp_rmem
4096 87380 2063584 (2Mb)
# current sender window size
>> sysctl -n net.ipv4.tcp_wmem
4096 87380 2063584 (2Mb)
# maximum segment size
>> sysctl -n net.ipv4.tcp_app_win
@danish-rehman
danish-rehman / change_window_size
Created January 9, 2015 07:37
Change TCP window size
# Current receiver window size (12Mb)
>> sudo su
>> echo 'net.ipv4.tcp_rmem= 4096 87380 12582912' >> /etc/sysctl.conf
>> sysctl -p
# Current sender window size (12Mb)
>> sudo su
>> echo 'net.ipv4.tcp_rmem= 4096 87380 12582912' >> /etc/sysctl.conf
>> sysctl -p
@danish-rehman
danish-rehman / change_window_socket
Created January 9, 2015 08:15
Change TCP window size from socket
# SO_SNDBUF
# Cannot exceed maximum size available in kernel config
# Kernel config: /proc/sys/net/core/rmem_max
212992
# SO_RCVBUF
# Cannot exceed maximum size available in kernel config
# kernel config: /proc/sys/net/core/wmem_max
212992
@danish-rehman
danish-rehman / fin_timeout
Created January 9, 2015 17:44
TCP fin timeout
>> cat /proc/sys/net/ipv4/tcp_fin_timeout
60 seconds
# To change the value
>> echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout
@danish-rehman
danish-rehman / tcp_keepalive_interval
Created January 9, 2015 17:47
TCP_KEEPALIVE_INTERVAL
>> echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl
@danish-rehman
danish-rehman / tcp_keepalive_probes
Created January 9, 2015 17:49
TCP_KEEPALIVE_PROBES
>> echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes