Skip to content

Instantly share code, notes, and snippets.

View Rachitlohani's full-sized avatar
🔵
at work

Rachit Lohani Rachitlohani

🔵
at work
View GitHub Profile
@Rachitlohani
Rachitlohani / bash command
Created March 16, 2014 04:58
get public IP from command line
##get public ip from command line
wget http://checkip.dyndns.org/ -O - -o /dev/null | cut -d: -f2 | cut -d\< -f1
@Rachitlohani
Rachitlohani / good reads
Created March 16, 2014 05:13
good reads
good site : http://www.easywayserver.com
kernel tweak : https://www.kernel.org/doc/Documentation/sysctl/vm.txt
Everything under sysclt : https://www.kernel.org/doc/Documentation/sysctl/
executed as this will change the way I can optimize:
FROM clause
WHERE clause
GROUP BY clause
HAVING clause
SELECT clause
ORDER BY clause
This order holds some very
@Rachitlohani
Rachitlohani / Project : Logstsash
Last active August 29, 2015 13:57
s3 logstash kibana project
URL : http://blog.import.io/tech-blog/analysing-elb-elastic-load-balancer-logs-with-logstash-and-kibana
s3cmd ls --recursive s3://mys3.com/bucket1/ | awk '{print $4}' | grep '.gz' | xargs -I@ s3cmd get @ - | zgrep 'request' | wc -l
@Rachitlohani
Rachitlohani / system calls
Created August 9, 2014 00:22
linux basic sys calls
memset() : This function fills the first n bytes of the memory area pointed to by s with the constant byte c.
fopen() : This function opens the file whose name is the string pointed to by its first argument and associates a stream with it.
getcwd() : This function return a null-terminated string containing an absolute pathname that is the current working directory of the calling process
getuid() : This function returns the real user ID of the calling process
snprintf() : This function produces output according to a format and writes the output to a buffer.
fwrite() : This function is used to write data to a stream
fflush() : This function forces a write of all user space buffered data on to a particular stream
fclose() : This function flushes the associated stream and closes the underlying file descriptor.
system() : This function executes a command
@Rachitlohani
Rachitlohani / DD
Last active August 29, 2015 14:06
All you want to know about DD
Here's a quick list of cool examples for the dd tool:
Create a backup
dd if=/dev/sda of=/opt/backup_sda.img
Restore a backup
dd if=/opt/backup_sda.img of=/dev/sda
Clone a hard disk
dd if=/dev/sdb of=/dev/sdc
Things to care about
OS configs :
ulimit : unlimited
increase the max_file handle : cat /proc/sys/fs/file-max
remove reserve block count (currently - 1%)
noatime
[root@ip-192-10-16-125 ~]# cat /proc/sys/net/core/somaxconn
@Rachitlohani
Rachitlohani / sysctl
Last active October 20, 2022 06:49
network
#def 60
net.ipv4.tcp_fin_timeout=20
#def 9
net.ipv4.tcp_keepalive_probes=5
#def 32768
net.ipv4.tcp_max_orphans=32768
#def 10240
net.core.optmem_max=20480
#def 110592
net.core.rmem_default=16777216
The order is (from first to last):
Brace expansion
Tilde expansion
The following expansions happen at the same time, in a left-to-right fashion on the commandline (see below)
Parameter expansion
Arithmetic expansion
Command substitution
Word splitting
Pathname expansion