This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import sys | |
limit = 5 if not len(sys.argv) > 1 else int(sys.argv[1]) | |
found = {} | |
toler = 10 ** -5 | |
energy = 1 | |
while not set(found.keys()) >= set(range(1, limit + 1)): | |
states = [] | |
for nx in range(1, int(energy ** .5) + 1): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
import sys, argparse, urllib.request, urllib.parse, json, logging, random | |
from datetime import datetime | |
dateFormat = '%m-%d-%y' | |
def getAPIResponse(url, apiKey, data={}): | |
params = {'apikey': apiKey} | |
params.update(data) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import random, itertools | |
from fractions import Fraction | |
#Squares | |
a = range(1, 26) + range(20, 26) | |
random.shuffle(a) | |
print('\n'.join(map(lambda x: str(x).rjust(2) + '² = ' + '_' * 15, a))) | |
#Cubes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function addVisitToCalendar(event) { | |
var calendarName = 'sushain@skc.name', //The default calendar name = email address (?) | |
eventLocation = 'College Center', | |
collegeName = 'College Name', | |
startTime = 'Start Time', | |
endTime = 'End Time', | |
description = 'Notes'; | |
var values = event.namedValues; | |
var event = CalendarApp.getCalendarsByName(calendarName)[0].createEvent(values[collegeName], |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while true; do inotifywait . -r -e MODIFY && make debug -j32; done; | |
while true; do fswatch -o -r . | make debug -j32; done; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ./localisation-tools.py cleanup `find . -regextype sed -regex ".*/[a-z]\{3\}\.json" -printf "%f "` && grep "completion" *.json | sort -nrk1.33,1.35 -nrk1.38,1.43 | awk -F '"' 'BEGIN {print "{| class=\"wikitable\"\n|-\n!|code\n!|CBE*\n!|CBC**" } {sub(/\..*$/, "", $1); split($4, s, " "); print "|-\n|| " $1 " || " s[1] " || " s[2]} END { print "|}\n\n *CBE: completion by entries <br>\n **CBC: completion by characters"}' |
OlderNewer