Skip to content

Instantly share code, notes, and snippets.

@Agnishom
Agnishom / uniqPaths.py
Created June 23, 2017 05:32
Logging System Calls along Unique Execution Paths
import angr
import strace
import subprocess
def getSysCalls(command):
p = angr.Project(command)
pg = p.factory.path_group()
while len(pg.active) > 0:
deadNow = len(pg.deadended)
pg.step()
  • All You Need Is Lambda

    • Not recommended for a first introduction to functional programming. Most people wouldn't have an idea on what this really is.
    • But it is not a bad idea to convince people that "Computation by rewriting" really works
      • Maybe worthwhile to give examples of other esoteric turing complete systems
  • The following chapters are rather essential:

    • Hello, Haskell!
    • Basic Datatypes
    • Types
  • Typeclasses
@Agnishom
Agnishom / csDirectives.md
Last active August 5, 2017 16:33
What makes good CS problems?

Broad categories of CS directives.

(incomplete list)

Algorithms

  • How do you reach from config to config using rules?
    • How many steps do you need?
    • Given config, rules and objective. How can you minimize/maximize objective?
    • Can you possibly reach from config to config`?
@Agnishom
Agnishom / problem1.md
Created July 27, 2017 11:10
Creating Problems

a[1], a[2], a[3], \cdots is an arithmetic progression. b[1], b[2], \cdots is also an arithmetic progression, such that b[i] \in \mathbb{N} for every [i]. Is a[b[1]], a[b[2]], \cdots an arithmetic progression as well?

  • What are we doing here?
    • Composing Sequences
      • How many sequences?
        • Two
      • Can we compose more sequences?
        • Yes, but let's try if we can do just two for now.
        • Also, more than two sequences look complicated.
  • Which two sequences should we compose?
@Agnishom
Agnishom / footnote01.md
Last active November 23, 2017 03:50
Haskell Footnotes
  • We viewed computation just as the process of rewriting. Is this notion powerful enough? Can we use such a model to compute whatever we like?

    • It turns out that we can. Functional programming is based on an abstraction called the Lambda Calculus
    • To have a sense of the multitude of the strange systems that are really just as powerful as traditional computers, see Esoteric Languages. BrainF and FRACTRAN are particularly interesting. Rule 110 could be an honorable mention
    • Having said that, Haskell could be a pleasant and practical language to program in.
  • In class, we defined plus in terms of succ.

    • Can you define mult standing for multiplication, in terms of plus
      • Install the Haskell interpreter on your device and check if your program works. Alternately, use the repl.it environment online.
  • C

@Agnishom
Agnishom / proof.txt
Last active October 10, 2017 14:59
Possible Proof of Non Recursively Enumerablity of Universality
Diag = {M | M does not accept M}
HP = {(M, x) | M accepts x}
Co-Univ = {M | there exists w such that M does not accept w}
Claim: HP <= Diag <= Co-Univ
Reduction from HP to Diag
Say HP has input (M, x)
Design Turing Machine N such that:
@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
@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 / 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 / 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 #-}