This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constexpr static int i = 0; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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!"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@-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 */ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
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. | |
*/ | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'benchmark' | |
require 'pcg_random' | |
def m | |
Random.new_seed | |
end | |
def n | |
PCGRandom.new_seed | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
NewerOlder