Skip to content

Instantly share code, notes, and snippets.

View envp's full-sized avatar

Vaibhav Yenamandra envp

View GitHub Profile
@envp
envp / foo.h
Last active November 7, 2023 23:02
constexpr static int i = 0;

SARIF Diagnostics in Clang

@envp
envp / rfc-llvm-dev-fdiagnostics-format-sarif.md
Last active March 11, 2021 20:29
RFC to cfe-dev proposing -fdiagnostics-format=sarif to output machine readable diagnostics from clang
class Codec {
private:
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) {
@envp
envp / formatter.cpp
Last active June 27, 2018 04:02
Maybe sane string formatting in C++11?
#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!");
@envp
envp / InstaWide.css
Last active August 3, 2018 00:50
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.
@-moz-document domain("instagram.com") {
/*
* 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 */
@envp
envp / tasks.json
Created March 17, 2017 05:44 — forked from felixfbecker/tasks.json
VS Code Javac & JUnit 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.
*/
{
@envp
envp / WhatsAppText2Emoji.js
Last active July 31, 2016 21:50
A Simple script that converts text smileys to emojis
// ==UserScript==
// @name WhatsApp Text2Emoji
// @namespace http://tampermonkey.net/
// @require http://ajax.googleapis.com/ajax/libs/jquery/2.1.0/jquery.min.js
// @require https://gist.github.com/raw/2625891/waitForKeyElements.js
// @version 0.2
// @description Simple script that converts text smileys to emojis
// @author Vaibhav Yenamandra
// @match https://web.whatsapp.com/
// @grant none
require 'benchmark'
require 'pcg_random'
def m
Random.new_seed
end
def n
PCGRandom.new_seed
end
@envp
envp / run.log
Created March 19, 2016 14:17
It gets slower after running a few times and starts with comparable perf to Random.new_seed
dimsum:~/workspace/benchmarks $ ruby new_seed_bench.rb
Random.new_seed
128612292610189266596556422956211714817
6.2686e-05
PCGRandom.new_seed
12346887968840078306103323986432
6.4614e-05
dimsum:~/workspace/benchmarks $ ruby new_seed_bench.rb
Random.new_seed
218468435883139448544708591128323365688