Skip to content

Instantly share code, notes, and snippets.

package week4
trait Lists[T] {
def isEmpty: Boolean
def head: T
def tail: Lists[T]
}
class Cons[T](val head: T, val tail: Lists[T]) extends Lists[T] {
def isEmpty = false
@saj1th
saj1th / gist:5703755
Last active December 18, 2015 01:28
// From Akamai Documenation //
Make sure that your origin server is sending information that indicates the version of the objects so that the
Edge server can send a conditional GET request when those objects expire.
Also make sure that your origin server responds properly to these conditional requests, with a 304 Not Modified,
if the file has not changed since the time specified or if the ETag value specified still matches.

Keybase proof

I hereby claim:

  • I am saj1th on github.
  • I am saj1th (https://keybase.io/saj1th) on keybase.
  • I have a public key whose fingerprint is A559 A1BC AB10 DB7A 0004 5F84 C94F 1629 76EC 676C

To claim this, I am signing this object:

@saj1th
saj1th / README.md
Created November 7, 2016 17:18 — forked from leonardofed/README.md
A curated list of AWS resources to prepare for the AWS Certifications


A curated list of AWS resources to prepare for the AWS Certifications

A curated list of awesome AWS resources you need to prepare for the all 5 AWS Certifications. This gist will include: open source repos, blogs & blogposts, ebooks, PDF, whitepapers, video courses, free lecture, slides, sample test and many other resources.


Index:

func (e Events) Track(w http.ResponseWriter, r *http.Request) {
start := time.Now()
var nuid, event string
// reads the cookie value from request - (function from go standard lib - no backend op here)
nuidCookie, err := r.Cookie(CookieName)
if err != nil {
//setting var
nuid = uuid.New()
} else {

Advanced Functional Programming with Scala - Notes

Copyright © 2017 Fantasyland Institute of Learning. All rights reserved.

1. Mastering Functions

A function is a mapping from one set, called a domain, to another set, called the codomain. A function associates every element in the domain with exactly one element in the codomain. In Scala, both domain and codomain are types.

val square : Int => Int = x => x * x
@saj1th
saj1th / fun-with-functions.md
Created May 31, 2017 09:42 — forked from jdegoes/fun-with-functions.md
Fun with Functions! - Exercises Only

These exercises were part of a LambdaConf Outpost meetup. You may find the instructions here.

  1. Develop a model for boolean values (Bool), which may be either true or false.

    Think: Do you need an if-then-else construct? Why or why not?

    Bonus: Develop a model for eithers (Either), whih can be one thing ("left") or another ("right"), and model a boolean as a partitioning of a set into two disjoint sets.

  2. Develop a model for optional values (Maybe / Option), which are containers that are either empty ("nothing" / "none") or hold a single value ("just" / "some").

@saj1th
saj1th / z2ipynb.py
Last active February 20, 2019 20:37
Script to convert zeppelin notebooks to ipynb
# Based on https://github.com/rdblue/jupyter-zeppelin
import os, sys
import re
import csv
import json
import html
import nbformat
import codecs
from io import StringIO
def byteFormat(fileSize: Long): String = {
if (fileSize <= 0) return "0 B"
val units: Array[String] = Array("B", "kB", "MB", "GB", "TB", "PB", "EB")
val grp: Int = (Math.log10(fileSize) / Math.log10(1024)).toInt
f"${fileSize / Math.pow(1024, grp)}%3.3f ${units(grp)}"
}
def computeFileStats(path: String): (String, String) = {
val formatter = java.text.NumberFormat.getIntegerInstance
var (bytes, count) = (0L, 0L)
{
"format-version": 1,
"table-uuid": "7b487059-ed1a-4462-bee8-fc2defee430d",
"location": "s3://db-sa-datasets/ice-warehouse/data/icepick",
"last-updated-ms": 1617666074935,
"last-column-id": 2,
"schema": {
"type": "struct",
"fields": [
{