Skip to content

Instantly share code, notes, and snippets.

View anujjamwal's full-sized avatar

Anuj Jamwal anujjamwal

  • Google, Stanford
  • United States
View GitHub Profile
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@anujjamwal
anujjamwal / init.el
Last active August 9, 2018 08:10
Emacs c++ setup
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;;;;;;;; VARIABLES
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(set-variable 'ycmd-extra-conf-whitelist '("/Users/anujjamwal/CLionProjects/bazel-compilation-database-0.2.3/.ycm_extra_conf.py"))
(set-variable 'ycmd-global-config "/Users/anujjamwal/CLionProjects/bazel-compilation-database-0.2.3/.ycm_extra_conf.py")
(set-variable 'ycmd-server-command '("/usr/local/bin/python3" "/Users/anujjamwal/Projects/ycmd/ycmd"))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
@anujjamwal
anujjamwal / 0_reuse_code.js
Created July 24, 2016 07:33
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@anujjamwal
anujjamwal / snippets.cson
Created June 29, 2015 09:48
Snippets for Erlang
'.source.erlang':
'Gen Server':
'prefix': 'gen_server'
'body': """
%%%-------------------------------------------------------------------
%%% @author Anuj Jamwal <>
%%% @copyright (C)
%%% @doc
%%%
@anujjamwal
anujjamwal / projects.sh
Created April 4, 2014 05:00
local scripts
PROJECT_DIRECTORIES=()
setup_project_shortcuts ()
{
clear_project_shortcuts
set_cd_shortcut $1
for D in $(find $1 -mindepth 1 -maxdepth 1 -type d)
do
set_cd_shortcut $D
@anujjamwal
anujjamwal / gist:8810673
Last active August 29, 2015 13:56
Coding Problems 2: Coin Denomination Problem
public int denomination(int sum, int coins[]) {
int denominations[] = new int[sum+1];
for(int i = 1; i <= sum; i++) denominations[i] = sum+1;
for(int coin: coins) denominations[coin] = 1;
for(int i = 1; i <= sum; i++) {
for(int j=0; j<coins.length; j++) {
if (i - coins[j] < 0) continue;
denominations[i] = min(denominations[i - coins[j]] + 1, denominations[i]);
@anujjamwal
anujjamwal / gist:8810251
Created February 4, 2014 19:10
Coding Problems 1: Minimal Number of Palindromes on a String
public int minimalPalindromes(String string) {
return minimalPalindromes(string, 0, string.length()-1);
}
private int minimalPalindromes(String string, int start, int end) {
if(isPalindrome(string, start, end)) return 0;
int count = string.length()+1;
for(int k = start; k <= end; k++) {
@anujjamwal
anujjamwal / .gitconfig
Last active December 31, 2015 19:39
Mac Config
[user]
name = Anuj Jamwal
email = anuj@email
[core]
editor = vim
whitespace = fix,-indent-with-non-tab,trailing-space,cr-at-eol
excludesfile = ~/.gitignore
[sendemail]
smtpencryption = tls
smtpserver = smtp.gmail.com
@anujjamwal
anujjamwal / gist:7904798
Created December 11, 2013 03:45
Remove Juniper network connect
1. Drag "Network Connect.app" to Trash.
2. In terminal, run these two commands:
sudo sh /usr/local/juniper/nc/install/uninstall_nc.sh
sudo rm -fr /usr/local/juniper
@anujjamwal
anujjamwal / gist:6327757
Created August 24, 2013 12:10
A small proxy server in node js
var http = require('http');
var uri = require('url');
http.createServer(function(request, response) {
var request_method = request.method,
url = uri.parse(request.url).pathname,
headers = request.headers;
console.log("proxy request "+request_method+" "+ request.url+ " "+headers['host']);
var options = {