Skip to content

Instantly share code, notes, and snippets.

@paramaggarwal
paramaggarwal / day1.sql
Last active October 5, 2019 12:33
PostgreSQL Workshop
-- DROP TABLE books;
CREATE TABLE books
(
id SERIAL PRIMARY KEY,
name CHARACTER VARYING NOT NULL
);
CREATE TABLE editions
(
@paramaggarwal
paramaggarwal / swiggy-invoice-download.js
Created April 29, 2019 16:56
Download Swiggy invoices from Orders page
/*
* Make sure to alow popups so that the invoices can be downloaded.
* Run this in the browser console.
* In case the class name for the div changes, inspect and update.
*/
Array
.from(document.getElementsByClassName('_2uT6l'))
.map((el)=>el.innerText.match(/#([0-9]+)/)[1])
.map((num)=>"https://www.swiggy.com/invoice/download/"+num)
@paramaggarwal
paramaggarwal / index.js
Created December 10, 2018 07:18 — forked from austintackaberry/index.js
Final index.js for i18n-example
import React from "react";
import ReactDOM from "react-dom";
import "./index.css";
import App from "./App";
import registerServiceWorker from "./registerServiceWorker";
import { BrowserRouter } from "react-router-dom";
import { IntlProvider, addLocaleData } from "react-intl";
import en from "react-intl/locale-data/en";
import es from "react-intl/locale-data/es";
@paramaggarwal
paramaggarwal / easing.js
Created November 21, 2017 11:29 — forked from gre/easing.js
Simple Easing Functions in Javascript - see https://github.com/gre/bezier-easing
/*
* Easing Functions - inspired from http://gizma.com/easing/
* only considering the t value for the range [0, 1] => [0, 1]
*/
EasingFunctions = {
// no easing, no acceleration
linear: function (t) { return t },
// accelerating from zero velocity
easeInQuad: function (t) { return t*t },
// decelerating to zero velocity
@paramaggarwal
paramaggarwal / razzle.config.js
Created October 26, 2017 15:10
Razzle config with support for SASS (with source maps)
"use strict";
const autoprefixer = require("autoprefixer");
const ExtractTextPlugin = require("extract-text-webpack-plugin");
const Visualizer = require("webpack-visualizer-plugin");
module.exports = {
modify: (baseConfig, { target, dev }, webpack) => {
const appConfig = Object.assign({}, baseConfig);
@paramaggarwal
paramaggarwal / Dockerfile
Last active September 25, 2017 03:17
Docker image with ROS Kinetic and Dataspeed DBZ
FROM osrf/ros:kinetic-desktop-full
MAINTAINER Param Aggarwal (paramaggarwal@gmail.com)
# Install DBZ ADAS Kit
RUN apt-get update
RUN apt-get install -y python3-pip python-wstool
RUN mkdir -p ~/dbw_ws/src && cd ~/dbw_ws && wstool init src
RUN wstool merge -t ~/dbw_ws/src https://bitbucket.org/DataspeedInc/dbw_mkz_ros/raw/default/dbw_mkz.rosinstall
RUN wstool update -t ~/dbw_ws/src
RUN rosdep update && rosdep -y install --from-paths ~/dbw_ws/src --ignore-src
@paramaggarwal
paramaggarwal / hough.md
Created January 26, 2017 11:50
A small guide to Hough Transform

How to build an intuition for the various parameters in Hough Transform?

The rho and theta units are part of the Hough Transform, but the value we give here specifies the imaginary grid that we create in this transformed domain. For example in the threshold parameter, we say that each grid box should have atleast x intersections. So the grid itself is defined by these parameters.

In the hough transform, the x and y coordinates become rho and theta. To be able to define imaginary boxes in this space, I need to give a width and height to them. This will be the rho and theta values in this domain. And then in the next parameter I say, “Hey, now in each of these rectangular imaginary boxes, you should see atleast N number of interections - if so, then it is a line."

It allows us to specify the straightness of a line. As in, should a slightly curved line also be a line? If a line is curving, all the corresponding hough lines won’t intersect perfectly. So by specifying a large imagi

@paramaggarwal
paramaggarwal / RNTRigidShadowView.h
Created January 14, 2016 15:00
React Native Rigid Aspect Ratio Component
#import "RCTShadowView.h"
@interface RNTRigidShadowView : RCTShadowView
/**
* Makes the box rigid, and sizes itself in flex with the
* defined aspect ratio of the CGSize rectangle.
*/
@property (nonatomic, assign) CGSize box;
@paramaggarwal
paramaggarwal / scrape.js
Created April 3, 2015 04:09
Scrape a few products into Elasticsearch
var elasticsearch = require('elasticsearch');
var es = new elasticsearch.Client();
var superagent = require('superagent');
var async = require('async');
var _ = require('underscore');
es.info(function (err, data) {
if (err) {
return console.error(err);
};
@paramaggarwal
paramaggarwal / TableRowItem.js
Created February 4, 2015 05:37
React Native clone's example JS file for rows in the search results.
/** @jsx Rubber.createElement */
var Rubber = require('./rubber');
var TableRowItem = Rubber.createClass({
getInitialState: function() {
return {
name: '',
key: null,
didSelectRow: null