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 org.jruby.embed.ScriptingContainer; | |
public class RubyTest { | |
public static void main(String[] args) { | |
ScriptingContainer container = new ScriptingContainer(); | |
// From a string | |
Object myclassString = container.runScriptlet("" + | |
"class MyClass\n" + |
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
object Test extends App { | |
trait BitPrinter[B <: BitDescription] { | |
def printBits(value: Long): (List[String], Long) | |
} | |
trait BitDescription | |
trait BitField extends BitDescription |
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
/** | |
* A command ID for SMPP | |
*/ | |
trait FieldHelpers { | |
val className = getClass.getName.dropRight(1) | |
val missingLabel = "unknown" |
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 com.fasterxml.jackson.databind.ObjectMapper | |
import com.fasterxml.jackson.module.scala.DefaultScalaModule | |
import com.fasterxml.jackson.module.scala.experimental.ScalaObjectMapper | |
import spray.http.{ContentTypes, HttpCharsets, HttpEntity, MediaTypes} | |
import spray.httpx.marshalling.Marshaller | |
import spray.httpx.unmarshalling.Unmarshaller | |
/** | |
* Use Jackson directly to avoid json4s's dependencies | |
*/ |
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
from flask import Flask, render_template, jsonify, request | |
from threading import Timer, Thread | |
from time import sleep | |
app = Flask(__name__) | |
@app.route("/api/<method>") | |
def api(method): | |
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 java.net.{URL, InetSocketAddress} | |
import javax.sound.sampled.{AudioSystem, LineListener, LineEvent} | |
import scala.concurrent.{Promise, Future, Await} | |
import scala.concurrent.duration.Duration | |
import scala.concurrent.ExecutionContext.Implicits.global | |
import akkasmpp.actors.{SmppClient, SmppClientConfig} | |
import akkasmpp.protocol.{Pdu, BindTransceiverResp, CommandStatus, COctetString, DeliverSm, DeliverSmResp} | |
import akka.actor.ActorSystem | |
import akka.pattern.ask |
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 java.net.URL | |
import javax.sound.sampled.{AudioSystem, LineListener, LineEvent} | |
import scala.concurrent.{Promise, Future, Await} | |
import scala.concurrent.duration.Duration | |
object PlayAudio extends App { | |
val f = playUrl( | |
new URL("http://www.wavsource.com/snds_2014-05-05_4169601282614752/movies/airplane/wrong_week4.wav") | |
) |
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
/** | |
* SCALA!! | |
*/ | |
object DisjointGraphs extends App { | |
val disjoints = findThem(List((1,2), (2,3), (5,6), (7,8), (1,8))) | |
println(disjoints) | |
def findThem(edges: List[(Int, Int)]) = { | |
val initial = List[Set[Int]]() // empty list of int sets |
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/python -u | |
from twilio.rest import TwilioRestClient | |
import sys | |
import time | |
import threading | |
import argparse | |
total = 0 | |
class Reporter(threading.Thread): |
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
# okcupidgirl.py ignores you | |
from __future__ import print_function | |
import argparse | |
import socket | |
import select | |
def listen(port): | |
print("Listening on port {}".format(port)) | |
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM) |