Skip to content

Instantly share code, notes, and snippets.

public class Timer {
private long startTime = 0;
public void start() {
startTime = System.currentTimeMillis();
}
public long stop() {
return System.currentTimeMillis() - startTime;
@sylvia43
sylvia43 / frequency_estimator.py
Last active September 12, 2015 09:37 — forked from endolith/frequency_estimator.py
Frequency estimation methods in Python
from __future__ import division
from scikits.audiolab import flacread
from numpy.fft import rfft, irfft
from numpy import argmax, sqrt, mean, diff, log
from matplotlib.mlab import find
from scipy.signal import blackmanharris, fftconvolve
from time import time
import sys
from parabolic import parabolic
@sylvia43
sylvia43 / Main.scala
Created December 2, 2015 17:54
Count the number of words in all Word documents in a directory.
import java.io.{File, FileInputStream, FilenameFilter}
import org.apache.poi.xwpf.extractor.XWPFWordExtractor
import org.apache.poi.xwpf.usermodel.XWPFDocument
object Main {
def main (args: Array[String]) {
println(getCountFromFolder("E:\\SchoolWork\\Running Start"))
}
@sylvia43
sylvia43 / input.m
Last active May 9, 2016 17:09
Matrix cipher cracking
EDU>> A=[62 32 45 0 49 33 44 21 0 47 49 26 24 15; 165 84 115 0 124 90 112 55 0 122 132 65 67 54]
EDU>> B=[-5 2; 1 1]
EDU>> A*B
EDU>> B*A
EDU>> A.dim
EDU>> size(A)
EDU>> A(1, 1)
EDU>> A(2, 14) = 45
EDU>> B*A
EDU>> char(B*A+64)
@sylvia43
sylvia43 / capitalize.java
Created May 13, 2016 02:08
Java vs. Scala
public String capitalize(String str) {
String[] words = str.toLowerCase().split(" ");
for (int i = 0; i < words.length; i++) {
words[i] = Character.toUpperCase(words[i].charAt(0)) + words[i].substring(1);
}
return TextUtils.join(" ", words);
}
package me.shreyasr.fbmp
import java.text.{DateFormat, DateFormatSymbols, SimpleDateFormat}
import java.util.{Date, Locale}
import net.ruippeixotog.scalascraper.browser.JsoupBrowser
import net.ruippeixotog.scalascraper.dsl.DSL.Extract._
import net.ruippeixotog.scalascraper.dsl.DSL._
object Parser {
@sylvia43
sylvia43 / naviancesort.user.js
Last active October 12, 2016 16:55
Naviance Sort "Colleges I'm Applying To"
// ==UserScript==
// @name Naviance Sort "Colleges I'm Applying To"
// @namespace http://shreyasr.me/
// @version 1.0
// @description Allow the user to sort Naviance's "Colleges I'm Applying To"
// @author Shreyas
// @match https://connection.naviance.com/family-connection/colleges/application/
// @grant none
// ==/UserScript==