Skip to content

Instantly share code, notes, and snippets.


Vivek Parihar vparihar01

View GitHub Profile
vparihar01 /
Created Jan 23, 2019
tail all logs for forever + apache + nginx
alias logall="forever logs | tail -n 1 | awk '{print $NF}' | sed 's/\x1B\[[0-9;]\+[A-Za-z]//g' | xargs sudo tail -f /var/log/nginx/error.log /var/log/nginx/access.log /var/log/nginx/search.log"
vparihar01 /
Created Nov 26, 2018 — forked from thomasst/
Migrate Redis data on Amazon ElastiCache
Copies all keys from the source Redis host to the destination Redis host.
Useful to migrate Redis instances where commands like SLAVEOF and MIGRATE are
restricted (e.g. on Amazon ElastiCache).
The script scans through the keyspace of the given database number and uses
a pipeline of DUMP and RESTORE commands to migrate the keys.
Requires Redis 2.8.0 or higher.
vparihar01 / perfromance.txt
Created Aug 13, 2018
The Logic on performance of app
View perfromance.txt
The Logic
In theory, you are correct. However, there are a few flaws with this rationale:
From what you stated, it's unclear if you actually tested / profiled your app. In other words, do you actually know that the network transfers from the app to the API are the slowest component? Because that is intuitive, it is easy to assume that it is. However, when discussing performance, you should never assume. At my employer, I am the performance lead. When I first joined, people kept talking about CDN's, replication, etc. based on intuition about what the bottlenecks must be. Turns out, our biggest performance problems were poorly performing database queries.
You are saying that because databases are good at retrieving data, that the database is necessarily running at peak performance, is being used optimally, and there is nothing that can be done to improve it. In other words, databases are designed to be fast, so I should never have to worry about it. Another dangerous line of thinking. That's like saying a ca
vparihar01 /
Created Jul 20, 2018 — forked from nickkraakman/
FFmpeg cheat sheet for 360 video

FFmpeg Cheat Sheet for 360º video

Brought to you by Headjack

FFmpeg is one of the most powerful tools for video transcoding and manipulation, but it's fairly complex and confusing to use. That's why I decided to create this cheat sheet which shows some of the most often used commands.

Let's start with some basics:

  • ffmpeg calls the FFmpeg application in the command line window, could also be the full path to the FFmpeg binary or .exe file
vparihar01 / gist:dbeeb027537559051f92a2f27312701c
Created Apr 19, 2017
simply convert video files (i.e.: MKV to MP4)?
View gist:dbeeb027537559051f92a2f27312701c
ffmpeg -i LostInTranslation.mkv -vcodec copy -acodec copy LostInTranslation.mp4
View aws_cloudfront_conf
View number_to_hex.js
var text = document.getElementById('text');
for (var i = 1; i >= 0; i -= 0.01) {
i = Math.round(i * 100) / 100;
var alpha = Math.round(i * 255);
var hex = (alpha + 0x10000).toString(16).substr(-2).toUpperCase();
var perc = Math.round(i * 100);
text.innerHTML += perc + "% — " + hex + " (" + alpha + ")</br>";
<div id="text"></div>
vparihar01 /
Last active Dec 1, 2015
Linux Performance Analysis commands list.
## This is a quick way to view the load averages, which indicate the number of tasks (processes) wanting to run.
## On Linux systems, these numbers include processes wanting to run on CPU,
## as well as processes blocked in uninterruptible I/O (usually disk I/O).
## This views the last 10 system messages, if there are any. Look for errors that can cause performance issues.
## The example above includes the oom-killer, and TCP dropping a request.
dmesg | tail
## Short for virtual memory stat, vmstat(8) is a commonly available tool
View enable_right_click.js
var elements = document.getElementsByTagName("*");
for(var id = 0; id < elements.length; ++id) { elements[id].oncontextmenu = null; }
vparihar01 /
Last active Nov 11, 2016
Swift 2 + IOS >8.4 tips, tricks and code snippets for various UI's and functionality.

Swift 2 + IOS 8.4 & above Code Samples, tips, tricks for various UI customization

  • [UIViewExtension] - UIView extension for adding view border , corner radius , border color, border width and setting custom border like left,right,top and bottom borders from Storyboard.
  • [UILabelCustomize] - Add the shadow to UILabel. Customize the uilabel, to add the border with color, make it round and translate the inner text to right by X.
  • [UIColorHexToColor] - Convert the hex color into ios colors.
  • [UIbuttonExtension] - Text padding/inset from left to UIButton.
  • [buttonBorder] - IOS Add top , bottom, left and right button to button/text field.
  • [buttonPadding] - Add little text padding/inset from left
  • [StringExtension] - Truncate String in Swift