Skip to content

Instantly share code, notes, and snippets.

View gkthiruvathukal's full-sized avatar

George K. Thiruvathukal gkthiruvathukal

  • Loyola University Chicago, Argonne National Laboratory (ALCF)
  • Chicago, IL, USA, North America, Earth, ..., Universe
  • LinkedIn in/gkthiruvathukal
View GitHub Profile
print "Hello World"
@gkthiruvathukal
gkthiruvathukal / sample.markdown
Created October 21, 2013 20:25
Sample Markdown

Heading

This is some text.

I love it.

Another Heading

@gkthiruvathukal
gkthiruvathukal / ListFilterMonteCarlo
Last active December 28, 2015 06:19
Simple Monte Carlo - Scala - classic area of a unit circle using random darts
import scala.math.Random
// Thanks to a great pairing session with Konstantin, we have finally been able to overcome some problems
// by using Stream.
def incircle(pair : (Double, Double)): Boolean = pair._1 * pair._1 + pair._2 * pair._2 <= 1.0;
val N = 10000
val darts = Stream.continually((math.random, math.random)).take(N)
// How many darts fall within the circle?
@gkthiruvathukal
gkthiruvathukal / gist:8163503
Created December 28, 2013 20:00
First attempt at a simple jazz pattern using Abjad
import sys
from abjad import *
# 0=C, 2=D, 3=E, 4=F, 5=F#, 6=G
# How to organize a pattern
# Write it in C-whatever first.
#(C E G)/4 (CC G E)/4 C/2
@gkthiruvathukal
gkthiruvathukal / gist:8925871
Created February 10, 2014 22:53
Simple MC in Python and NumPy
>>> import numpy
>>> a = numpy.random.random(1000000)
>>> n = 1000000
>>> a = numpy.random.random(n)
>>> b = numpy.random.random(n)
>>> a
array([ 0.13849378, 0.72228591, 0.49816557, ..., 0.08655529,
0.02044737, 0.86337785])
>>> b
array([ 0.28050175, 0.05473387, 0.99651725, ..., 0.37804476,
import scala.math.Random
// Thanks to a great pairing session with Konstantin, we have finally been able to overcome some problems
// by using Stream.
def incircle(pair : (Double, Double)): Boolean = pair._1 * pair._1 + pair._2 * pair._2 <= 1.0;
val N = 10000
val darts = Stream.continually((math.random, math.random)).take(N)
// How many darts fall within the circle?
@gkthiruvathukal
gkthiruvathukal / gist:7a933b4aaea42ef66b33
Created December 6, 2014 03:23
GUID using Mono csharp
csharp> System.Guid.NewGuid()
55305008-86b7-4003-913c-f0865b2095c9
@gkthiruvathukal
gkthiruvathukal / gist:45552651c921146e2416
Created December 6, 2014 03:38
GUID/UUID Command Line (Mono)
$ uuidgen
9ED55055-AD86-4B9D-B8FE-F18A2DA33259
#
# Suggested as a possibility by HomeBrew sbt formula
# Might be useful in the future
#
SBT_OPTS="-XX:+CMSClassUnloadingEnabled -XX:MaxPermSize=256M"
@gkthiruvathukal
gkthiruvathukal / scala-junit.scala
Last active August 29, 2015 14:11
Interactive Scala testing in sbt test:console
// Imports need to be done even though you entered a test:console
import org.junit.Test
import org.junit._
import org.junit.Assert._
// Create a test class inline
scala> :paste
// Entering paste mode (ctrl-D to finish)