Skip to content

Instantly share code, notes, and snippets.

View deepaknverma's full-sized avatar
:atom:
Building something new

Deepak Verma deepaknverma

:atom:
Building something new
View GitHub Profile
@deepaknverma
deepaknverma / 10 Tips for Optimizing NGINX and PHP-fpm for High Traffic Sites
Created October 20, 2014 01:22
10 Tips for Optimizing NGINX and PHP-fpm for High Traffic Sites
Please take a look at the original article (http://www.softwareprojects.com/resources/programming/t-optimizing-nginx-and-php-fpm-for-high-traffic-sites-2081.html) as it includes excellent configuration file examples.
1. Switch from TCP to UNIX domain sockets:
When communicating to processes on the same machine UNIX sockets have better performance the TCP because there's less copying and fewer context switches.
2. Adjust Worker Processes:
Set the worker_processes in your nginx.conf file to the number of cores your machine has and increase the number of worker_connections.
3. Setup upstream load balancing:
Multiple upstream backends on the same machine produce higher throughout than a single one.
@deepaknverma
deepaknverma / CountingSort1.js
Created April 27, 2017 06:17
Hacker Rank Solution: Counting Sort 1
This file has been truncated, but you can view the full file.
/*
Sample Output
0 2 0 2 0 0 1 0 1 2 1 0 1 1 0 0 2 0 1 0 1 2 1 1 1 3 0 2 0 0
2 0 3 3 1 0 0 0 0 2 2 1 1 1 2 0 2 0 1 0 1 0 0 1 0 0 2 1 0 1
1 1 0 1 0 1 0 2 1 3 2 0 0 2 1 2 1 0 2 2 1 2 1 2 1 1 2 2 0 3
2 1 1 0 1 1 1 0 2 2
Explanation
The output states that 0 appears 0 times, 1 appears 2 times,
2 appears 0 times, and so on in the given input array.
*/
@deepaknverma
deepaknverma / VMware essential commands
Last active March 23, 2021 23:05
VMWare CLI essentials
One of the biggest challenges I run into working with ESXi hosts is the lack of a real usable CLI. The remote CLI provided by VMware is clunky at best and makes administration a bit of a pain. I did some poking around and managed to find some interesting CLI commands that work for ESXi.
Most of these have no manual page but will output a help message if run by themselves. I would recommend using extreme caution and using a test host to determine the usefulness in your environment before using them on an important system. Also keep in mind that the examples that I give are not the "only" way the commands can be used.
To power on a virtual machine from the command line:
- Lists all vm's running on hypervisor and provides vmid
vim-cmd vmsvc/getallvms
@deepaknverma
deepaknverma / Tail commands
Last active February 26, 2020 14:27
highlight keyword while tail
replace 503 with your keyword
tail -f /var/log/apache2/access.log | perl -pe 's/ 503 /\e[1;31;43m$&\e[0m/g'
sudo bash -c 'tail -f /var/log/apache2/access.log| grep "[0-9] 5[0-9][0-9] \"" | (while read; do date; /usr/local/sbin/profile-php; done)'

Keybase proof

I hereby claim:

  • I am deepaknverma on github.
  • I am deepaknverma (https://keybase.io/deepaknverma) on keybase.
  • I have a public key ASBh7KmGrczvx_SNO36ID8knesNM6MJX4yorNfuC6KhgKAo

To claim this, I am signing this object:

Privacy Policy

Your privacy is important to us. It is Netbeam Technologies' policy to respect your privacy regarding any information we may collect from you through our app, raisingthechild.

We only ask for personal information when we truly need it to provide a service to you. We collect it by fair and lawful means, with your knowledge and consent. We also let you know why we’re collecting it and how it will be used.

We only retain collected information for as long as necessary to provide you with your requested service. What data we store, we’ll protect within commercially acceptable means to prevent loss and theft, as well as unauthorised access, disclosure, copying, use or modification.

We don’t share any personally identifying information publicly or with third-parties, except when required to by law.

Starting with git version 1.7.3 it became possible to pass a strategy option to git rebase command.

The use of -Xtheirs and -Xours appear to be somewhat counterintuitive, so think of it as telling git which branch code to favor when resolving rebase conflicts. For example, when doing

# see current branch
$ git branch
---
* branch-a
...
{
"accountId" : 12345,
"sfId" : "sf0000234562553",
"url": "https://abc.local"
}
@deepaknverma
deepaknverma / BinaryTree.js
Created May 28, 2017 07:41
recursively loop through object keys at root and output tree path from root to leaf
let getPaths = (object) => {
var result = [];
// Can't pass null here
if (object === null) {
return;
}
// Creating local array
if(!currentVal) {
var currentVal = [];
}
@deepaknverma
deepaknverma / fruitdrop.js
Created April 27, 2017 07:16
count fruitedrop
/*
Sample Input 0
7 11
5 15
3 2
-2 2 1
5 -6
Explanation:
The first line contains two space-separated integers denoting the respective values of s and t.