Skip to content

Instantly share code, notes, and snippets.

View AbhiAgarwal's full-sized avatar
:shipit:
heeeey

Abhi Agarwal AbhiAgarwal

:shipit:
heeeey
View GitHub Profile
package main
import (
"github.com/sfreiberg/gotwilio"
"github.com/hoisie/web"
"strconv"
"io"
"bytes"
)
var phys = require('phys');
console.log(phys.mechanics.momentum(2, 3));
console.log(phys.information.mechanics.momentum());
<script src="http://www.physjs.com/js/phys.min.js"></script>
<script>
console.log(phys.basic.changein(2, 3));
console.log(phys.mechanics.momentum(2, 3));
</script>
// Gets Weather from the ForecastIO API and saves the JSON file
var set_weather = function() {
jquery.getJSON('https://api.forecast.io/forecast/'+ apiKeys.forecastIO + '/' + person.latitude + ',' + person.longitude, function(data) {
fs.writeJson('./files/weather' + datetime + '.json', data, function(err){
if(err){ console.log(err);}
weather.time = datetime;
weather.summary = data.currently.summary;
weather.temperature = String(convert_fahrenheitTocelsius(String(data.currently.temperature)));
weather.file = true;
});
var queryAPI = function() {
$.ajax({
// URL of the API you want to access
url: 'https://housing.nyu.edu/api/nyuapirooms/RoomSpaceDescription/AH-002E1-1',
// When the data comes back
success: function(data) {
// Go through all the data
for(var eachval in data) {
// and print all of it out
console.log(data[eachval]["HallName"]);
'''
Finds all the circles within your eye
'''
import cv2
import cv2.cv as cv
import numpy as np
image = cv2.imread('eye-image.jpg')
cv2.imshow('main_image', image)
@AbhiAgarwal
AbhiAgarwal / download_google_image.py
Created June 19, 2014 03:33
Gets a certain image from google and saves it into current or named directory
import urllib2
import simplejson
import urllib
import errno
import os
# Fixed
globalSearchURL = "http://ajax.googleapis.com/ajax/services/search/images?v=1.0&q=%s&start=%s"
fetch = urllib2.build_opener()
// run using g++-mp-4.7 -fopenmp -std=c++11 openmp_example.cpp -o openmp_example
// on my mac. Not sure about everyone elses, but my g++ version doesn't have openp
// so I have to use that one
#include <iostream>
using namespace std;
#include <omp.h>
int main(int argc, char *argv[])
#!/usr/bin/env python
import sys
import os.path
if __name__ == "__main__":
if len(sys.argv) != 2:
print "usage: create_csv <base_path>"
sys.exit(1)
import numpy as np
import sklearn
from sklearn.tree import *
from sklearn.datasets import *
iris = load_iris()
X = iris.data
y = iris.target