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
package com.ericsson.asn12schema.transformer | |
import scala.xml.{UnprefixedAttribute, Null} | |
import com.honnix.asn12schema.model.datatype.complex.{ASN1EnumeratedType, ASN1SetField, ASN1SetOfType, ASN1SetType} | |
import com.honnix.asn12schema.model.ASN1Module | |
import com.honnix.asn12schema.model.datatype.primitive.{ASN1PrimitiveType, ASN1BooleanType, ASN1IA5StringType, ASN1IntegerType} | |
class DefaultTransformer extends Transformer { | |
private def dealWithIntOrString(field: ASN1SetField) = { |
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
// _[@type=="baoc" and ts10[@value=="1" and a==2] and ts20] | |
package com.honnix.xml.transformer | |
import scala.xml.NodeSeq | |
import scala.util.parsing.combinator.JavaTokenParsers | |
object XPathParser { | |
def apply(conditionalPath: String, topSelector: (NodeSeq, String) => NodeSeq) = | |
new XPathParser(conditionalPath, topSelector) |
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
case class Tree(var left: Tree, var right: Tree, var value: Int) | |
def build(seq: Seq[Int]): Tree = seq match { | |
case Nil => null | |
case _ => | |
import scala.util.Random | |
val pos = Random nextInt seq.length | |
val (left, right) = seq splitAt pos | |
Tree(build(left), build(right.tail), right.head) | |
} |
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 ruby | |
# Copyright (c) 2009 Samuel Williams. Released under the GNU GPLv3. | |
# | |
# This program is free software: you can redistribute it and/or modify | |
# it under the terms of the GNU General Public License as published by | |
# the Free Software Foundation, either version 3 of the License, or | |
# (at your option) any later version. | |
# | |
# This program is distributed in the hope that it will be useful, |
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 scala.language.postfixOps | |
import scala.util.Random | |
class Guess { | |
class GeneticSolver { | |
def getBest(toMatch: String) = { | |
def random: Stream[Char] = toMatch(Random.nextInt(toMatch.length)) #:: random | |
def iterate(parent: Seq[Char], score: Int, generation: Int): Seq[Char] = if (score != toMatch.length) { | |
def mutate = parent.updated(Random.nextInt(toMatch.length), toMatch(Random.nextInt(toMatch.length))) |
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
us_state_abbrev = { | |
'Alabama': 'AL', | |
'Alaska': 'AK', | |
'Arizona': 'AZ', | |
'Arkansas': 'AR', | |
'California': 'CA', | |
'Colorado': 'CO', | |
'Connecticut': 'CT', | |
'Delaware': 'DE', | |
'Florida': 'FL', |
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
package com.ericsson.research.axon.messenger; | |
import java.io.IOException; | |
import com.rabbitmq.client.AMQP; | |
import com.rabbitmq.client.Channel; | |
import com.rabbitmq.client.Connection; | |
import com.rabbitmq.client.ConnectionFactory; | |
import com.rabbitmq.client.DefaultConsumer; | |
import com.rabbitmq.client.Envelope; |
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
require 'sinatra' | |
require 'haml' | |
# Handle GET-request (Show the upload form) | |
get "/upload" do | |
haml :upload | |
end | |
# Handle POST-request (Receive and save the uploaded file) | |
post "/upload" do |
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
#!/bin/sh | |
if [ $# -ne 1 ] | |
then | |
echo "use: ec <file>" | |
exit -1 | |
fi | |
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -n $1 > /dev/null 2>&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 perl | |
# You can use this script in a pipe. It's input will become an emacs buffer | |
# via emacsclient (so you need server-start etc.) | |
# See http://mark.aufflick.com/o/886457 for more information | |
# Copyright (C) 2011 by Mark Aufflick <[email protected]> | |
# | |
# Permission is hereby granted, free of charge, to any person obtaining a copy |
OlderNewer