Skip to content

Instantly share code, notes, and snippets.

Vivek Parihar vparihar01

Block or report user

Report or block vparihar01

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@vparihar01
vparihar01 / logall.sh
Created Jan 23, 2019
tail all logs for forever + apache + nginx
View logall.sh
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
vparihar01 / migrate-redis.py
Created Nov 26, 2018 — forked from thomasst/migrate-redis.py
Migrate Redis data on Amazon ElastiCache
View migrate-redis.py
"""
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
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
View InternetReachabilityVerifier.cs
// InternetReachabilityVerifier
//
// Helper class for verifying actual connectivity to Internet.
// Implements various "captive portal detection" methods using Unity.
//
#define DEBUG_ERRORS
#if UNITY_EDITOR
//#define DEBUG_LOGS
#define DEBUG_WARNINGS
@vparihar01
vparihar01 / ffmpeg-cheatsheet.md
Created Jul 20, 2018 — forked from nickkraakman/ffmpeg-cheatsheet.md
FFmpeg cheat sheet for 360 video
View ffmpeg-cheatsheet.md

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
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
Access-Control-Allow-Headers
Access-Control-Allow-Methods
Access-Control-Allow-Origin
Access-Control-Max-Age
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
vparihar01 / performance_commands.sh
Last active Dec 1, 2015
Linux Performance Analysis commands list.
View performance_commands.sh
## 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).
uptime
## 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; }
You can’t perform that action at this time.