Skip to content

Instantly share code, notes, and snippets.

View jjlumagbas's full-sized avatar

JJ Lumagbas jjlumagbas

View GitHub Profile

Film crit HULK smash: luke cage, netflix and the death of episodic tv

Whatever happened to telling stories within stories?

Film crit HULK Oct. 12, 2016

1. Stories within stories

HULK worries we're witnessing the death of episodic tv.

@jjlumagbas
jjlumagbas / modules.hs
Created October 19, 2016 03:35
module
import qualified Data.List as L hiding (nub)
numUniques :: (Eq a) => [a] -> Int
numUniques = length . nub
@jjlumagbas
jjlumagbas / shapes.hs
Created October 19, 2016 04:08
Shapes module
module Shapes
( Point(..)
, Shape(..)
, surface
, nudge
, baseCircle
, baseRect
) where
data Point = Point Float Float deriving (Show)
@jjlumagbas
jjlumagbas / lists.py
Created October 20, 2016 02:21
Lists and for-loops
# sum
def sum(lst):
"""[Number] -> Number
Returns the sum of all elements of the list
"""
result = 0
for el in lst:
result = result + el
return result
@jjlumagbas
jjlumagbas / lists2.py
Created October 24, 2016 04:35
Examples for map and filter
#
#
# fold
# map
# create a duplicate of the given list
def dup(lst):
result = []
for el in lst:
@jjlumagbas
jjlumagbas / 11-lab-11-lists-map-filter.md
Last active October 24, 2016 04:57
CMSC11 Lab 11 - Practice on map and filter

CMSC11 Lab Exercise 11 – Lists

Create the following functions. Don’t forget the design recipe! I’ll be looking for the following:

  • Signature, purpose, stub
  • Examples
  • Template

Machine Problem 3 - Parsing Poetry Packets

Data on the internet are broken up and passed around in what are called "packets":

Packet - Email Example

On the Internet, the network breaks an e-mail message into parts of a certain size in bytes. These are the packets. Each packet carries the information that will help it get to its destination -- the sender's IP address, the intended receiver's IP address, something that tells the network how many packets this e-mail message has been broken into and the number of this particular packet. - Read the whole article at HowStuffWorks

In this MP, you're going to parse a "network packet capture" (a listing of packets), reassemble corresponding sets of packets into the original "messages" sent, and display the messages in a human-readable format.

@jjlumagbas
jjlumagbas / fold.py
Created October 27, 2016 05:37
Examples of folds in Python
#
# fold
def sum_nums(lst):
sum = 0
for el in lst:
sum = sum + el
return sum
@jjlumagbas
jjlumagbas / prev.py
Created November 3, 2016 02:10
Remembering previous and Range
# given a list, remove successive duplicate elements
def remove_succ_lst(lst):
result = [lst[0]]
prev = lst[0]
for curr in lst:
if ( prev != curr ):
result = result + [curr]
@jjlumagbas
jjlumagbas / ExpressionTree.java
Created November 4, 2016 01:27
Evaluate expression tree
public class ExpressionTree {
public static int eval(MyTreeNode root) {
return 0;
}
}