Skip to content

Instantly share code, notes, and snippets.

View vparihar01's full-sized avatar

Vivek Parihar vparihar01

View GitHub Profile
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Sarvagram Dashboard</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
<script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.6/dist/umd/popper.min.js"></script>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.min.js"></script>
@vparihar01
vparihar01 / logall.sh
Created January 23, 2019 12:46
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
vparihar01 / migrate-redis.py
Created November 26, 2018 06:12 — forked from thomasst/migrate-redis.py
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
vparihar01 / perfromance.txt
Created August 13, 2018 08:14
The Logic on performance of app
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
vparihar01 / ffmpeg-cheatsheet.md
Created July 20, 2018 10:30 — forked from nickkraakman/ffmpeg-cheatsheet.md
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
vparihar01 / gist:dbeeb027537559051f92a2f27312701c
Created April 19, 2017 19:31
simply convert video files (i.e.: MKV to MP4)?
ffmpeg -i LostInTranslation.mkv -vcodec copy -acodec copy LostInTranslation.mp4
Access-Control-Allow-Headers
Access-Control-Allow-Methods
Access-Control-Allow-Origin
Access-Control-Max-Age
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 December 1, 2015 21:16
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).
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
var elements = document.getElementsByTagName("*");
for(var id = 0; id < elements.length; ++id) { elements[id].oncontextmenu = null; }