Skip to content

Instantly share code, notes, and snippets.

@Agnishom
Agnishom / app.elm
Last active July 4, 2018 11:33
Elm Plan
import AutoGen exposing (..)
import Html exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Http
import Json.Decode as Decode
import Platform.Cmd
main =
@Agnishom
Agnishom / powerset.hs
Last active June 30, 2018 15:01
List Monad as Non-deterministic computation
import Control.Monad.Random
arbitrarySet :: Monad m => m Bool -> [a] -> m [a]
arbitrarySet getBool = flip foldr (return []) $ \x ls -> do
t <- getBool
l <- ls
if t
then return (x:l)
else return l
@Agnishom
Agnishom / diagram.hs
Created June 22, 2018 09:04
Code for creating an circle with spokes
{-# LANGUAGE NoMonomorphismRestriction #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TypeFamilies #-}
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
rules :: Diagram B
rules = foldr1 (<>) hands
where
@Agnishom
Agnishom / Vass.hs
Last active June 20, 2018 09:53
Vector Addition State Systems
module Lib where
import Data.Graph
import Data.Vector
import Data.Map
newtype State = State Int
data Transition = Transition { addV :: [Int],
toState :: State
@Agnishom
Agnishom / books.md
Created June 3, 2018 11:26
Book Recommendations

Analysis Books (top most is most recommended)

  1. Understanding Analysis - Stephen Abott

Download Link

  1. BV Rao's notes on Analysis I

Download Link

@Agnishom
Agnishom / backup.py
Created May 22, 2018 03:07
Confessions Backup
import requests
import json
# replace the access_token with your own. You can get one at https://developers.facebook.com/tools/explorer/?method=GET&path=cmiconfessionz%2Ffeed&version=v3.0
starturl = "https://graph.facebook.com/v3.0/cmiconfessionz/feed?access_token="
cururl = starturl
confessionData = []
@Agnishom
Agnishom / Main.hs
Last active May 11, 2018 12:02
CRUD App
{-# OPTIONS_GHC -Wall #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE FunctionalDependencies #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RankNTypes #-}
@Agnishom
Agnishom / Assignment3.java
Created March 31, 2018 18:12
Java Assignment
public static void main(String[] args)
{
int l = 3;
Conveyor conveyor = new Conveyor();
Thread nonHazardous[] = new Thread[l];
Thread hazardous[] = new Thread[l];
//populate
for (int i = 0; i < l; i++){
nonHazardous[i] = new Thread(new Item(conveyor, i*10, 3000, false));
@Agnishom
Agnishom / episode1.md
Last active January 10, 2018 04:12
Periodical Haskell Materials for Gregg

Episode 1

Objective: To understand the basic philosophy of Haskell, to know the distinction between functional programming and other paradigms of programming, setting up the haskell interpreter, getting acquinted to the basic syntax, basic understanding of the type system, currying

The Haskell Philosophy

Read any one of these (but not necessarily all three)

  • Prelude (CIS 194: Introduction to Haskell (Fall 2016))
  • Read the sections:
@Agnishom
Agnishom / isPrime.hs
Created October 13, 2017 08:28
Strange Efficiency Issues
-- Just an utility function to calculate [root(x)]
intSqrt :: Integer -> Integer
intSqrt n = acc 1 n n
where
acc a b n
| a == (b-1) = a
| m*m > n = acc a m n
| m*m <= n = acc m b n
where