Skip to content

Instantly share code, notes, and snippets.

I may be slow to respond. I don't check notifications often.

Vaibhav Yenamandra vaibhav-y

I may be slow to respond. I don't check notifications often.
Block or report user

Report or block vaibhav-y

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
View 0449-serialize-and-deserialize-bst.cpp
class Codec {
static constexpr size_t DATA_SZ = sizeof(int);
static constexpr size_t FLAG_SZ = sizeof(char);
static constexpr size_t ELEM_SZ = DATA_SZ + FLAG_SZ;
void writeInt(char *buffer, int value) {
memcpy(buffer, (char *)&value, DATA_SZ);
int readInt(const char *buffer) {
View leetcode-105-binary-tree-from-postorder-inorder.h
#include <iterator>
#include <unordered_map>
#include <vector>
#include "TreeNode.h"
namespace p0106 {
class Solution {
typedef std::vector<int>::const_iterator CIT;
typedef std::unordered_map<int, CIT> RootMap;
View dokku report <app> output
-----> uname: Linux umi 4.15.0-46-generic #49-Ubuntu SMP Wed Feb 6 09:33:07 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
-----> memory:
total used free shared buff/cache available
Mem: 985 211 123 1 650 618
Swap: 0 0 0
-----> docker version:
Version: 18.09.5
API version: 1.39
Go version: go1.10.8
View gist:3806ca75a5fa66f88409057f0a49dab9
$ dircolors -c | sed -E 's/ow=([[:digit:]]+);([[:digit:]]+)/ow=\1;97/g' | sed 's/env/ -gx/g'
setenv LS_COLORS 'rs=0:di=01;34:ln=01;36:mh=00:pi=40;33:so=01;35:do=01;35:bd=40;33;01:cd=40;33;01:or=40;31;01:mi=00:su=37;41:sg=30;43:ca=30;41:tw=30;42:ow=34;42:st=37;44:ex=01;32:*.tar=01;31:*.tgz=01;31:*.arc=01;31:*.arj=01;31:*.taz=01;31:*.lha=01;31:*.lz4=01;31:*.lzh=01;31:*.lzma=01;31:*.tlz=01;31:*.txz=01;31:*.tzo=01;31:*.t7z=01;31:*.zip=01;31:*.z=01;31:*.Z=01;31:*.dz=01;31:*.gz=01;31:*.lrz=01;31:*.lz=01;31:*.lzo=01;31:*.xz=01;31:*.zst=01;31:*.tzst=01;31:*.bz2=01;31:*.bz=01;31:*.tbz=01;31:*.tbz2=01;31:*.tz=01;31:*.deb=01;31:*.rpm=01;31:*.jar=01;31:*.war=01;31:*.ear=01;31:*.sar=01;31:*.rar=01;31:*.alz=01;31:*.ace=01;31:*.zoo=01;31:*.cpio=01;31:*.7z=01;31:*.rz=01;31:*.cab=01;31:*.wim=01;31:*.swm=01;31:*.dwm=01;31:*.esd=01;31:*.jpg=01;35:*.jpeg=01;35:*.mjpg=01;35:*.mjpeg=01;35:*.gif=01;35:*.bmp=01;35:*.pbm=01;35:*.pgm=01;35:*.ppm=01;35:*.tga=01;35:*.xbm=01;35:*.xpm=01;35:*.tif=01;35:*.tiff=01;35:*.png=01;35:*.svg=01;3
vaibhav-y / formatter.cpp
Last active Jun 27, 2018
Maybe sane string formatting in C++11?
View formatter.cpp
#include <iostream>
#include <string>
#include <sstream>
using StringCIter_t = std::string::const_iterator;
// This is the base case we don't like, how
inline StringCIter_t real_format(const std::string& fmt, std::stringstream& stream)
throw std::runtime_error("Too few arguments provided to formatter!");
vaibhav-y / InstaWide.css
Last active Aug 3, 2018
Wide theme for instagram. Uses a majority(60-70%) of the screen space for displaying pictures. Work in progress, struggles a little when width ~ 2*height.
View InstaWide.css
@-moz-document domain("") {
* For widening all thumbnails on the profile page.
* - Count per row remains the same,
* - More screen space is utilized with this
* - Also I dont want to click on shit to look at it clearly
* (instagram pre-loads images upto 1080w, so this can be as good as you want it to be)
.v9tJq, /* Profile */
def tailRecursiveQuickSort(A, startIdx, endIdx):
while startIdx < endIdx:
pivotIdx = PARTITION(A, startIdx, endIdx)
tailRecursiveQuickSort(A, startIdx, pivotIdx - 1)
startIdx = pivotIdx + 1
vaibhav-y / tasks.json
Created Mar 17, 2017 — forked from felixfbecker/tasks.json
VS Code Javac & JUnit tasks.json
View tasks.json
Example for quick Java compilation and unit tests in VS Code.
Works well with simple BlueJ projects.
Hit Ctrl+Shift+B to compile currently open file with javac.
Hit Ctrl+Shift+T to test currently open test class.
See red wiggles for compilation errors / failed assertions or click exclamation mark in the status bar.
Uses a few workarounds for individual commands per task and filename without extension.
This is written for Windows but it should be easy to adopt for Linux and Mac.
vaibhav-y / WhatsAppText2Emoji.js
Last active Jul 31, 2016
A Simple script that converts text smileys to emojis
View WhatsAppText2Emoji.js
// ==UserScript==
// @name WhatsApp Text2Emoji
// @namespace
// @require
// @require
// @version 0.2
// @description Simple script that converts text smileys to emojis
// @author Vaibhav Yenamandra
// @match
// @grant none
View new_seed_bench.rb
require 'benchmark'
require 'pcg_random'
def m
def n
You can’t perform that action at this time.