Skip to content

Instantly share code, notes, and snippets.

View varunagrawal's full-sized avatar
🎯
Focusing

Varun Agrawal varunagrawal

🎯
Focusing
View GitHub Profile
@varunagrawal
varunagrawal / wishwasher_nlp.py
Last active August 29, 2015 13:56
NLP Hack for WishWasher
def bday_wish(message):
""" Analyze message to ascertain if it is a birthday wish
Params:
meassage: The message received from FB friend
"""
keywords = ["birthday", "birth", "happy", "bday", "hpy", "hbd", "hb", "happi", "best", "memorable", "awesome", "fantastic", "super", "bappy", "hirthday", "returns", "many", "bless", "god", "belated"]
expansion = {"hbd":["happy", "birthday"], "hb":["happy", "birthday"]}
@varunagrawal
varunagrawal / mpd.conf
Last active August 29, 2015 13:56
Media Player Daemon Conf
# An example configuration file for MPD
# See the mpd.conf man page for a more detailed description of each parameter.
# Files and directories #######################################################
#
# This setting controls the top directory which MPD will search to discover the
# available audio files and add them to the daemon's online database. This
# setting defaults to the XDG directory, otherwise the music directory will be
# be disabled and audio files will only be accepted over ipc socket (using
@varunagrawal
varunagrawal / typedef_function.cpp
Last active August 29, 2015 14:02
Demo of typedef for functions
#include <iostream>
#include <string>
using namespace std;
typedef short SmallNumber;
typedef unsigned int Positive;
typedef double Double;
typedef double (*Add)(double value1, double value2);

Deploying a subfolder to GitHub Pages

Sometimes you want to have a subdirectory on the master branch be the root directory of a repository’s gh-pages branch. This is useful for things like sites developed with Yeoman, or if you have a Jekyll site contained in the master branch alongside the rest of your code.

For the sake of this example, let’s pretend the subfolder containing your site is named dist.

Step 1

Remove the dist directory from the project’s .gitignore file (it’s ignored by default by Yeoman).

@varunagrawal
varunagrawal / mexopts.sh
Last active November 1, 2015 16:39 — forked from yassersouri/mexopts.sh
`~/.matlab/R2015a/mexopts.sh` for Mac OS X 10.10 with homebrew.
#
# mexopts.sh Shell script for configuring MEX-file creation script,
# mex. These options were tested with the specified compiler.
#
# usage: Do not call this file directly; it is sourced by the
# mex shell script. Modify only if you don't like the
# defaults after running mex. No spaces are allowed
# around the '=' in the variable assignment.
#
# Note: For the version of system compiler supported with this release,
@varunagrawal
varunagrawal / virtualenv-auto-activate.sh
Created November 5, 2016 03:41 — forked from robbles/virtualenv-auto-activate.sh
virtualenv-auto-activate with support for zsh and virtualenvwrapper
#!/bin/bash
# virtualenv-auto-activate.sh
#
# Installation:
# Add this line to your .bashrc or .bash-profile:
#
# source /path/to/virtualenv-auto-activate.sh
#
# Go to your project folder, run "virtualenv .venv", so your project folder
# has a .venv folder at the top level, next to your version control directory.
@varunagrawal
varunagrawal / mnist.py
Created February 16, 2017 21:37 — forked from akesling/mnist.py
import os
import struct
import numpy as np
"""
Loosely inspired by http://abel.ee.ucla.edu/cvxopt/_downloads/mnist.py
which is GPL licensed.
"""
def read(dataset = "training", path = "."):
@varunagrawal
varunagrawal / .block
Last active March 1, 2017 22:42
Word Cloud from Text Corpus
license: gpl-3.0
@varunagrawal
varunagrawal / center_geo.py
Created February 19, 2017 02:44 — forked from amites/center_geo.py
Center Geolocations
from math import cos, sin, atan2, sqrt
def center_geolocation(geolocations):
"""
Provide a relatively accurate center lat, lon returned as a list pair, given
a list of list pairs.
ex: in: geolocations = ((lat1,lon1), (lat2,lon2),)
out: (center_lat, center_lon)
"""
x = 0
@varunagrawal
varunagrawal / install-opencv2.sh
Last active March 22, 2017 19:06
Install OpenCV2
# install dependencies
sudo apt-get update
sudo apt-get install -y build-essential
sudo apt-get install -y cmake
sudo apt-get install -y libgtk2.0-dev
sudo apt-get install -y pkg-config
sudo apt-get install -y libavcodec-dev libavformat-dev libswscale-dev
sudo apt-get install -y libjpeg-dev libpng12-dev libtiff5-dev libjasper-dev
sudo apt-get -qq install libopencv-dev build-essential checkinstall cmake pkg-config yasm libjpeg-dev libjasper-dev libavcodec-dev libavformat-dev libswscale-dev libdc1394-22-dev libxine2 libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev libv4l-dev python-dev python-numpy libtbb-dev libqt4-dev libgtk2.0-dev libmp3lame-dev libopencore-amrnb-dev libopencore-amrwb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils