Author: Gugu Ncube
-
Apache Bench – Doing ab Performance Tests The Right Way
Apache Bench – 5 Minutes for realistic test – 1/10/50/100/200/300/400/500/800/1000 Concurrent Users – latency, error rate, success rate, response time # CORRECT – this does 1000 requests to the URL. No problems here. ab -n 1000 http://my-test-service.com # WRONG – this always does requests to the URL for 60 seconds. ab -t 60 http://my-test-service.com #…
-
PgAdmin UI – Show Long Text – Fix for truncated Texts
How TO Display the Full column Text in PgAdmin Menu: pgAdmin3 -> Preferences -> Query Tool -> Query Editor -> Max. characters per column Questions: Re: In PgAdmin, how can I see all of a long text field? References: https://www.postgresql.org/message-id/AANLkTikUPqgMHGPoanqjN%3DvvbiYk5Ax637bxxvaGw3Dz%40mail.gmail.com
-
uLimit – Finally fixed plus gevent install
ab -n100000 -c1000 -r http://localhost:9004/ # append /etc/security/limits.conf # for a specific user # sudo sh -c ‘printf “‘$USER’ soft nofile 1000000″ >> /etc/security/limits.conf’ # for all users sudo sh -c ‘printf ” * soft nofile 1000000 * hard nofile 1000000 * soft nproc 1000000 * hard nproc 1000000″ >> /etc/security/limits.conf’ # sudo vim /etc/security/limits.conf…
-
Python – Send Email via Google GMail and Python Script
import smtplib from email.mime.text import MIMEText as text def test_sendmail(): to_address ='”PersonA”<a.b@gmail.com>’ body = “This is the email body!” subject=”Hello World” sendmail(to_address, subject, body) def sendmail(to_address, subject, body): from_address='”This Is Me”<a.b@gmail.com>’ smtp_server = ‘smtp.gmail.com’ smtp_port= 587 smtp_user=”a.b@gmail.com” smtp_password=”abcdefgh” #———compose——- msg = text(body) msg[‘Subject’] = subject msg[‘From’] = from_address msg[‘To’] = to_address #———send——- server = smtplib.SMTP(smtp_server,…
-
Play Framework – Activator – Fix for IllegalArgumentException: empty text
In case of calling an Play Server via HTTPS, an strange Exception is thrown as shown below. i.e. https://localhost:9000/ Fix: just use HTTP without the S 🙂 [error] p.c.s.n.PlayDefaultUpstreamHandler – Exception caught in Netty java.lang.IllegalArgumentException: empty text at org.jboss.netty.handler.codec.http.HttpVersion.(HttpVersion.java:89) ~[netty-3.10.4.Final.jar:na] at org.jboss.netty.handler.codec.http.HttpVersion.valueOf(HttpVersion.java:62) ~[netty-3.10.4.Final.jar:na] at org.jboss.netty.handler.codec.http.HttpRequestDecoder.createMessage(HttpRequestDecoder.java:75) ~[netty-3.10.4.Final.jar:na] at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:191) ~[netty-3.10.4.Final.jar:na] at org.jboss.netty.handler.codec.http.HttpMessageDecoder.decode(HttpMessageDecoder.java:102) ~[netty-3.10.4.Final.jar:na] at org.jboss.netty.handler.codec.replay.ReplayingDecoder.callDecode(ReplayingDecoder.java:500) ~[netty-3.10.4.Final.jar:na]…
-
JQuery – Alternatives and Drop-In Replacement of jQuery JavaScript Library
The following small javascript libraries can be used instead of and as drop-in replacements of jQuery. My favorites (based on size and/or functionality) [github file = “/sudar/MissileLauncher/blob/master/MissileLauncher.cpp”] 1. ki.js: https://github.com/dciccale/ki.js 2. minifiedjs: http://minifiedjs.com/ 3. psQuery: https://github.com/pseudosavant/psQuery 4. Zepto.js: Zepto.js 5. riloadr: riloadr References 1. http://microjs.com/
-
Mac – Fix for – ls: illegal option – usage: ls
a@macbook:~/$ ls ls: illegal option — – usage: ls [-ABCFGHLOPRSTUWabcdefghiklmnopqrstuwx1] [file …] Fix: Check the following files for “ls –color” alias ls=’ls -G’ ~/.bashrc, .~/bash_aliases ~/.profile a@macbook:~$ grep -Es “ls\s+–color” ~/.bash* ~/.profile /Users/a/.bash_aliases:#alias ls=’ls –color=auto’ /Users/a/.bashrc: #alias ls=’ls –color=auto’ References 1. https://superuser.com/questions/183876/how-do-i-get-ls-color-auto-to-work-on-mac-os-x 2. http://ninjasingh.blogspot.de/2012/09/ls-illegal-option.html
-
Linux – Top memory usage by process
Here are a couple of commands to help find top memory wasters Process – Sorted by occupied memory(2 column) ps -e -orss=,pid=,args= | sort -nr | head|awk ‘{print $2″\t”$1/1024″\tMB\t”$3;}’ Method 2 cat /proc/meminfo |grep MemTotal echo ‘ ‘ | awk ‘{ system(“cat /proc/meminfo |grep MemTotal”) }’ totalmem=$(cat /proc/meminfo |grep MemTotal | awk ‘{print $2}’); ps…
-
Unix – Finding the Processes blocking a particular port
#sudo netstat -lnptu|grep : #check what is running on port 80 sudo netstat -lnptu|grep :80
-
Unix – CPU and Memory – Monitoring and Analysis
VMSTAT vmstat 1 htop sudo apt-get install -y htop sudo htop atop sudo apt-get install atop -y sudo atop How to Find the Most Memory taking process in Ubuntu Linux Some Times system administrators need to kill the memory eater process. When your system become slower, check the following command and find the memory eater.…