Skip to content

Instantly share code, notes, and snippets.

Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
<!DOCTYPE html>
<html lang="en" class="client-js">
<head>
<meta charset="utf-8">
<title>Propensity</title>
<link rel="stylesheet" type="text/css" href="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraph.css" />
<script type="text/javascript" src="http://jsxgraph.uni-bayreuth.de/distrib/jsxgraphcore.js"></script>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.2/MathJax.js?config=TeX-MML-AM_CHTML"></script>
</head>
<body>
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomtung
tomtung / .gvimrc
Last active December 30, 2015 03:35
.vimrc
set transparency=1
set background=dark
colorscheme base16-ocean
set guifont=Menlo:h14
import itertools,sys
class WinterAndPresents:
def getNumber(self, apple, orange):
"""This is an O(N) solution to SRM 601 Div 1 Problem 250.
The derivation is as follows.
Let :math:`a_i` and :math:`o_i` be the number of apples and oranges in bag :math:`i`, respectively.
Let :math:`x_m` denote the largest possible value of :math:`x`.
Given any :math:`x`, the number of different presents :math:`n(x)` can be written as:
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tomtung
tomtung / CreateInstances.scala
Created February 2, 2013 22:35
This is an example script translated from wekaexamples.core.CreateInstances, which generates an weka.core.Instances object with different attribute types, and prints it out in ARFF format.
import java.util
import weka.core.{DenseInstance, Attribute, Instances}
import scala.collection.convert.wrapAll._
// 1. set up attributes
val atts = {
// numeric
val att1 = new Attribute("att1")
// nominal
val att2 = new Attribute("att2", (1 to 5).map("val" + _))
@tomtung
tomtung / learn-vocabulary.scala
Created December 9, 2012 07:50
Unsupervised Chinese Vocabulary Extraction
#!/usr/bin/env scalas
!#
/***
libraryDependencies ++= Seq(
"org.apache.commons" % "commons-lang3" % "3.1",
"com.github.scopt" %% "scopt" % "2.1.0"
)
resolvers += "sonatype-public" at "https://oss.sonatype.org/content/groups/public"