Skip to content

Instantly share code, notes, and snippets.

View sushain97's full-sized avatar

Sushain Cherivirala sushain97

View GitHub Profile

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:

while true; do inotifywait . -r -e MODIFY && make debug -j32; done;
while true; do fswatch -o -r . | make debug -j32; done;
import requests
import time
import pprint
import os
from PIL import Image
'https://developers.facebook.com/tools/explorer/'
access_token = ''
@sushain97
sushain97 / skyward.py
Last active December 29, 2015 07:39
Checks user's Skyward account against given requirements and writes results to encrypted log file
import requests, ssl, sys, pprint, binascii, os, lxml.html
from Crypto.Cipher import DES
from requests.adapters import HTTPAdapter
from requests.packages.urllib3.poolmanager import PoolManager
def checkClass(classData):
rows = ['period', 'class', 'description', 'term', 'teacher', 'cp1', 'pr1', 'cp2', 'pr2', 'ct1', 't1', 'cp3', 'pr3', 'cp4', 'pr4', 'ct2', 't2', 'se1', 's1', 'cp5', 'pr5', 'pr6', 'ct3', 't3', 'cp7', 'pr7', 'cp8', 'pr8', 'ct4', 't4', 'se2', 's2', 'fin']
classRequirements = {
'MA662': 80, #Multivariable Calculus
'MA351': 80, #Calculus BC
private static Pair<List<Integer>,List<Integer>> calculateStats(List<Integer> list)
{
double[] data = new double[list.size()];
for(int i = 0; i < list.size(); i++)
data[i] = list.get(i);
DescriptiveStatistics dStats = new DescriptiveStatistics(data);
List<Integer> summary = new ArrayList<Integer>(5);
summary.add((int) dStats.getMin()); //Minimum
summary.add((int) dStats.getPercentile(25)); //Lower Quartile (Q1)
@sushain97
sushain97 / concepts5-7.py
Last active October 11, 2015 18:01
Given 2n points on a plane. One wants to draw n segments which join pairs of these points such that no two segments share a common vertex. In how many ways this can be done?
>>> l = range(1, 7)
>>> pairs = list(itertools.product(l, repeat=2))
>>> pairs = list(filter(lambda x: x[0] != x[1], pairs))
>>> l = list(itertools.combinations(pairs, 3))
>>> c = set(map(lambda x: frozenset(map(lambda y: frozenset(y), x)), l))
>>> len(set(filter(lambda x: len(set(list(itertools.chain(*list(map(lambda y: list(y), x)))))) is 6, c)))
15
>>> l[:5]
[((1, 2), (1, 3), (1, 4)), ((1, 2), (1, 3), (1, 5)), ((1, 2), (1, 3), (1, 6)), ((1, 2), (1, 3), (2, 1)), ((1, 2), (1, 3), (2, 3))]
>>> list(c)[:5]
sudo apt-get update && sudo apt-get install subversion build-essential pkg-config gawk libxml2 libxml2-dev libxml2-utils xsltproc flex automake libtool libpcre3-dev zlib1g-dev libboost-dev libgoogle-perftools-dev libicu-dev cmake python3 python3-dev python3-lxml python3-requests python3-tornado python3-pip gedit gedit-plugins vlc default-jdk default-jre curl sqlite3 vim chromium-browser xchat curl sqlite3 inotify-tools git && sudo apt-get upgrade
irb(main):040:0> xml = `svn log --xml https://svn.code.sf.net/p/apertium/svn/#{ARGV[0]}/apertium-#{ARGV[1]}`; nil
=> nil
irb(main):041:0> require 'nokogiri'
=> true
irb(main):042:0> doc = Nokogiri::XML(xml); nil
=> nil
irb(main):043:0> authors = Hash.new(0)
=> {}
irb(main):044:0> doc.xpath("//author").each { |author| authors[author.text] += 1 }
=> 0
<!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>Bridge Project Leaderboard</title>
<script type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/tabletop.js/1.3.5/tabletop.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/2.1.4/jquery.min.js"></script>
<script type="text/javascript" src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
#!/usr/bin/env python3
import argparse, os, lxml.etree, lxml.builder, re, collections, mimetypes, bz2, logging, json
def validFile(fname):
if not os.path.isfile(fname):
raise argparse.ArgumentError('File %s does not exist!' % fname)
return fname
numeral_map = tuple(zip(