Determine RAID Controller Type and Model on Linux

First you need to install lshw and lspci: apt-get install lshw pciutilsapt-get install lshw pciutils Then type this command to get RAID controller details: lspci | grep -i raidlspci | grep -i raid It should display the RAID controller type and model, i.e: 04:00.0 RAID bus controller: Hewlett-Packard Company Smart Array Gen8 Controllers (rev 01)04:00.0 […]

Copy Files on Google Storage Buckets

You need to use gutils cp command: https://cloud.google.com/storage/docs/gsutil/commands/cp Example command to copy all .txt files to my-bucket: gsutil cp *.txt gs://my-bucketgsutil cp *.txt gs://my-bucket Example command to copy all .txt files to my-bucket/Folder/: *** Folder will be created if not existent *** gsutil cp *.txt gs://my-bucket/Folder/gsutil cp *.txt gs://my-bucket/Folder/

Install Megaclisas-status on Debian for LSI MegaRAID SAS

You can find the megaclisas-status Debian packages at this URL: http://hwraid.le-vert.net/wiki/DebianPackages http://hwraid.le-vert.net/debian/pool-jessie/ Add this on /etc/apt/sources.list: deb http://mirror.rackspace.com/hwraid.le-vert.net/debian/ jessie maindeb http://mirror.rackspace.com/hwraid.le-vert.net/debian/ jessie main Make sure to install the PGP signature: wget -O – https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | apt-key add -wget -O – https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | apt-key add – Then update apt: apt-get updateapt-get update Now to install megaclisas-status […]

Install Megacli Debian Packages LSI MegaRAID SAS

You can find the megacli Debian packages at this URL: http://hwraid.le-vert.net/wiki/DebianPackages http://hwraid.le-vert.net/debian/pool-jessie/ Add this on /etc/apt/sources.list: deb http://mirror.rackspace.com/hwraid.le-vert.net/debian/ jessie maindeb http://mirror.rackspace.com/hwraid.le-vert.net/debian/ jessie main Make sure to install the PGP signature: wget -O – https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | apt-key add -wget -O – https://hwraid.le-vert.net/debian/hwraid.le-vert.net.gpg.key | apt-key add – Then update apt: apt-get updateapt-get update Now to install megacli […]

Speed Up Linux MDADM RAID Rebuilding And Re-syncing

If the resync speed of your MDADM software RAID is slow, i.e: Personalities : [raid1] md3 : active raid1 sda4[0] sdb4[1] 5239808 blocks super 1.2 [2/2] [UU] resync=DELAYED   md2 : active raid1 sda3[0] sdb3[1] 1926656000 blocks super 1.2 [2/2] [UU] [>………………..] resync = 0.1% (3446528/1926656000) finish=432.6min speed=74078K/sec bitmap: 15/15 pages [60KB], 65536KB chunk   […]

GnuGPG Not enough random bytes available.

If your server gets stuck when you generate a GnuGPG key pair: We need to generate a lot of random bytes. It is a good idea to perform some other action (type on the keyboard, move the mouse, utilize the disks) during the prime generation; this gives the random number generator a better chance to […]

Rate Limit Requests per URL with Nginx

You can rate limit requests per URL with Nginx. So lets say you want to limit requests on /v2/api URL to max 150 per minute independently from the remote IP address, you can do like this: Add this inside http{} block: limit_req_zone $server_name zone=one:100m rate=150r/m;limit_req_zone $server_name zone=one:100m rate=150r/m; Then inside the server{} block add this: […]

Rate Limit Requests per IP with Nginx

You can limit requests per IP per second with Nginx. Add this line inside http{} block to limti 1 request per second per IP: limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s;limit_req_zone $binary_remote_addr zone=one:10m rate=1r/s; Lets say you want to limit requests only on /events/: Add this text inside server{} block: location /events/ { limit_req zone=one nodelay; }location /events/ […]

Best Google Fonts for Your Web Projects

My favorites Google Fonts for web projects are: Lato (10 Styles) Open Sans (10 Styles) Neuton (6 Styles) Montserrat (2 Styles) Source Sans Pro (12 Styles) Raleway (18 Styles) PT Sans (4 Styles) Droid Sans (2 Styles) Quicksand (4 Styles) Nunito Sans (14 Styles)

Java HashCode in PHP and JavaScript

JavaScript function of Java hashCode(): /** * @see http://stackoverflow.com/q/7616461/940217 * @return {number} */ String.prototype.hashCode = function(){ if (Array.prototype.reduce){ return this.split("").reduce(function(a,b){a=((a<<5)-a)+b.charCodeAt(0);return a&a},0); } var hash = 0; if (this.length === 0) return hash; for (var i = 0; i < this.length; i++) { var character = this.charCodeAt(i); hash = ((hash<<5)-hash)+character; hash = hash & hash; // […]