Skip to content

Instantly share code, notes, and snippets.

View msridhar's full-sized avatar

Manu Sridharan msridhar

View GitHub Profile
@msridhar
msridhar / TestPasses.java
Created May 17, 2018 23:30
Dummy Error Prone check that does extra AST traversals
package testpasses;
import com.google.auto.service.AutoService;
import com.google.errorprone.BugPattern;
import com.google.errorprone.ErrorProneFlags;
import com.google.errorprone.VisitorState;
import com.google.errorprone.bugpatterns.BugChecker;
import com.google.errorprone.matchers.Description;
import com.sun.source.tree.CompilationUnitTree;
import com.sun.source.util.TreeScanner;
@msridhar
msridhar / nullaway-build.gradle
Last active May 31, 2021 23:47
self-contained build.gradle for using NullAway on an Android app
buildscript {
repositories {
jcenter()
maven {
url "https://plugins.gradle.org/m2/"
}
// for android gradle plugin 3
google()
}
dependencies {
> mkdir ~/Documents/brew-20160402
> sudo mv /usr/local ~/Documents/brew-20160402
Password:
> /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
==> This script will install:
/usr/local/bin/brew
/usr/local/Library/...
/usr/local/share/man/man1/brew.1
Press RETURN to continue or any other key to abort
@msridhar
msridhar / gist:cb47fb3b3672692dc65190d59e8437ad
Created April 2, 2016 18:47
output of brew config and brew doctor
> brew config
HOMEBREW_VERSION: 0.9.8
ORIGIN: https://github.com/Homebrew/homebrew
HEAD: ef70efa204c929b01ba0e7a4da843c70ed455313
Last commit: 63 minutes ago
Core tap ORIGIN: https://github.com/Homebrew/homebrew-core
Core tap HEAD: d149df8cb2ccea42c6bc5bcbfdcd3c688ccdf79c
Core tap last commit: 64 minutes ago
HOMEBREW_PREFIX: /usr/local
HOMEBREW_REPOSITORY: /usr/local
@msridhar
msridhar / profile.txt
Created November 23, 2013 19:11
Profile info for esnstrument.js on pdf.js
Statistical profiling result from v8.log, (34593 ticks, 737 unaccounted, 0 excluded).
[Unknown]:
ticks total nonlib name
737 2.1%
[Shared libraries]:
ticks total nonlib name
19116 55.3% 0.0% /opt/local/bin/node
908 2.6% 0.0% /usr/lib/system/libsystem_c.dylib
@msridhar
msridhar / cpth.sh
Created August 24, 2013 23:34
Aliases for a command cpth that, given a relative path to a file, gets the absolute path and copies it to the Mac clipboard
alias realpath="python -c \"import os,sys; print os.path.realpath(sys.argv[1])\""
alias mypbcopy="tr -d '\n' | pbcopy"
function cpth {
realpath $1 | mypbcopy
}
class A {
A f;
void m() {
this.f = this;
}
}
main() {
A x = new A(); // a1
A y = new A(); // a2
boolean p = ???;
class A {
Object id(Object x) {
return x;
}
}
main() {
A a = new A(); // a1
Object x = new Object(); // o1
Object y = new Object(); // o2
Object z = a.id(x); // z -> o1
@msridhar
msridhar / mergetex.pl
Created March 23, 2012 21:18
perl script for merging .tex files and BibTeX output into single .tex file
#!/usr/bin/perl
# mergetex.pl
#
# Script for merging tex files into a single monolithic file. This
# script should make it easy to generate an ArXiV-friendly single
# .tex file from a paper that is broken into subfiles using LaTeX's
# \input{} command.
#
# USAGE:
@msridhar
msridhar / imdb_season_ratings.js
Created February 25, 2012 23:29
Compute Average IMDB Rating for TV Show Season using node.js
var jsdom = require('jsdom');
var re = /(\d+)\.(\d+)/;
jsdom.env({
// IMDB show URL + '/eprate' (Simpsons URL below)
html: 'http://www.imdb.com/title/tt0096697/eprate',
scripts: ['http://code.jquery.com/jquery-1.7.1.min.js'],
done: function (errors, window) {
var $ = window.$;