Skip to content

Instantly share code, notes, and snippets.

Sushain Cherivirala sushain97

Block or report user

Report or block sushain97

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View fenwick.ijs
NB. Implementation TODO: customizing assoc. fn?, custom OOB error?
coclass 'FenwickTree'
lsb =. #.@(#:*.#:@-) NB. TODO: Can I get rid of the repeated #.?
add =: 4 : 0 NB. i add v
idxs =. }:(<.&(#arr))@(+lsb@>:)^:a:x
arr =: (y+idxs{arr)idxs}arr
)
create =: 3 : 'arr =: y $ 0' NB. N TODO: Can this be tacit?
range =: 3 : 0 NB. range i j TODO: Can I accept only #2 list?
'i j' =. y
View throwback.sh
#!/bin/sh
wget https://upload.wikimedia.org/wikipedia/commons/3/33/Dial_up_modem_noises.ogg -O dial_up.ogg --no-clobber --quiet
online=true
while true
do
now_online=false
if ping -c 1 google.com >> /dev/null 2>&1; then
now_online=true
View source-browser.html
<!DOCTYPE html>
<html lang="en">
<head>
<title>Apertium Source Browser</title>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link rel="shortcut icon" href="https://www.apertium.org/img/favicon.ico">
<link href="//maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css" rel="stylesheet" integrity="sha384-wvfXpqpZZVQGK6TAh5PVlGOfQNHSoD2xbE+QkPxCAFlNEevoEH3Sl0sibVcOQVnN" crossorigin="anonymous">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css" integrity="sha384-PsH8R72JQ3SOdhVi3uxftmaW6Vc51MKb0q5P2rRUpPvrszuE4W1povHYgTpBfshb" crossorigin="anonymous">
View alexa_top_sites.py
#!/usr/bin/env python3
import argparse
import hmac
import hashlib
import datetime
import urllib.parse
import collections
import operator
import base64
View min_hitting_set.py
def min_hitting_set(students):
def help(students, tests):
students = sorted(list(filter(lambda s: s and not (s & tests), students)), key=set.__len__)
if students:
student, *students = students
return min(map(lambda t: help(students, set([t]) | tests), student), key=set.__len__)
return tests
return help(students, set())
@sushain97
sushain97 / Dockerfile
Last active Apr 27, 2018
apertium-docker
View Dockerfile
FROM debian:jessie-slim
LABEL maintainer sushain@skc.name
ENV LANG C.UTF-8
RUN apt-get -qq update && apt-get -qq install apt-utils wget
ADD https://apertium.projectjj.com/apt/install-nightly.sh .
RUN bash install-nightly.sh
RUN apt-get -qq update && apt-get -qq install \
View moss.sh
rm -rf /tmp/handins/*; mkdir -p /tmp/handins; cd /afs/cs.cmu.edu/academic/class/15150-s17/autolab/homework3/handin; for tarfile in *.tar; do tar -xf "$tarfile" -C /tmp/handins "code/hw03.sml" 2> /dev/null; mv /tmp/handins/code/hw03.sml "/tmp/handins/$tarfile.sml"; done; rm -r /tmp/handins/code;
python3 ~/private/filter.py /tmp/handins
~/private/moss -l ml -b ~/private/15150-TA/asgn/hw/03/src/dist/hw03.sml /tmp/handins/* && rm -rf /tmp/handins/*
cd /afs/cs.cmu.edu/academic/class/15150-s17/autolab/homework3/handin; rm -rf /tmp/handins/*; mkdir -p /tmp/handins; for tarfile in *.tar; do tar -xf "$tarfile" -C /tmp/handins hw03.pdf 2> /dev/null; pdftotext -q /tmp/handins/hw03.pdf "/tmp/handins/$tarfile.txt"; rm /tmp/handins/hw03.pdf; done;
python3 ~/private/filter.py /tmp/handins
cd ~/private/15150-TA/asgn/hw/03/writeup/ && make && pdftotext bin/hw03-handout.pdf ~/private/hw03-handout.txt
~/private/moss -l ascii -b ~/private/hw03-handout.txt /tmp/handins/* && rm -rf /tmp/handins/*
rm -rf /tmp/handins/*; mkdir -p
View filter.py
import sys
import os
import collections
import itertools
import pprint
filenames = list(os.listdir(sys.argv[1]))
# filenames = list(filter(lambda x: any(map(lambda y: x.startswith('%s@' % y), andrew_ids)), filenames))
grouped_filenames = collections.defaultdict(list)
for filename in filenames:
View fsl-professors.html
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta http-equiv="Content-type" content="text/html;charset=UTF-8">
<meta name="author" content="Sushain K. Cherivirala (www.skc.name)">
<title>CMU Senate: Faculty Student Lunch Professors</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.3.5/tabletop.js"></script>
View keybase.md

Keybase proof

I hereby claim:

  • I am sushain97 on github.
  • I am sushain (https://keybase.io/sushain) on keybase.
  • I have a public key ASAa5PVbF3RDg8gQxUEQk92URQeLFGyANKd3bZ0RndWAhgo

To claim this, I am signing this object:

You can’t perform that action at this time.