Skip to content

Instantly share code, notes, and snippets.

@malisetti
malisetti / html-to-text-nltk.go
Created March 15, 2019 04:05
get text representation of html and do entity extraction
package main
import (
"fmt"
"io"
"log"
"net/http"
"os"
"sort"
"strings"
@malisetti
malisetti / lifecolors.go
Last active December 28, 2018 08:32
string -> color
package main
import (
"bytes"
"flag"
"fmt"
"image"
_ "image/jpeg"
_ "image/png"
"io"
"use strict";
const assert = require("assert");
/**
* Consider the leftmost and righmost appearances of some value in an array. We'll say that the "span" is the number of elements between the two inclusive. A single value has a span of 1. Returns the largest span found in the given array. (Efficiency is not a priority.)
maxSpan([1, 2, 1, 1, 3]) → 4
maxSpan([1, 4, 2, 1, 4, 1, 4]) → 6
maxSpan([1, 4, 2, 1, 4, 4, 4]) → 6
"use strict";
const assert = require("assert");
(() => {
const inouts = {
Code: "CCoCodCode",
abc: "aababc",
ab: "aab"
};
"use strict";
const s = "abppplee";
const D = ["able", "ale", "apple", "bale", "kangaroo"];
(() => {
// console.log(inline(s, D[4]));
const letterPositions = toCharMap(s);
D.sort((a, b) => {
@malisetti
malisetti / docdist.go
Created December 14, 2018 12:03
document distance using vector space model
package main
import (
"bufio"
"fmt"
"math"
"strings"
)
// document distance using vector dot product
@malisetti
malisetti / largest-region.go
Last active December 13, 2018 10:32
Find length of the largest region in Boolean Matrix
// https://www.geeksforgeeks.org/find-length-largest-region-boolean-matrix/
package main
import (
"container/ring"
"fmt"
"sort"
"strconv"
"strings"
"sync"
/'
model the End to End UX (in as much details as possible)
for withdrawing cash in an atm.
actors: consumer, ATM, bank
'/
@startuml Consumer UX at an ATM withdrawl
actor Consumer #green
actor ATM #blue
@malisetti
malisetti / crimenews.go
Last active September 28, 2018 10:21
pass it a file of rss feeds
package main
import (
"bufio"
"database/sql"
"fmt"
"log"
"net/http"
"os"
"strconv"
@malisetti
malisetti / csvtojson.go
Last active May 31, 2018 08:51
converts csv to json
package main
import (
"bufio"
"encoding/json"
"fmt"
"io"
"os"
"strings"
)