Skip to content

Instantly share code, notes, and snippets.

package pc
import akka.actor.Actor
import akka.actor.Props
import akka.actor.ActorRef
import akka.actor.ActorRefFactory
class Parent extends Actor {
val child = context.actorOf(Props[Child], "child")
var ponged = false
#!/bin/bash
#
# Requires ftxdumperfuser from http://developer.apple.com/textfonts/download/
#
# Usage: fixconsolas [files ...]
# When called with no arguments, it attempts to operate on every TrueType
# file in the current directory.
#
# References:
# http://bandes-storch.net/blog/2008/12/21/consolas-controlled/#comment-2042
cabal: Could not resolve dependencies:
trying: Snowdrift-0.1.4 (user goal)
trying: yesod-static-1.5.0 (dependency of Snowdrift-0.1.4)
trying: conduit-extra-1.1.9 (dependency of yesod-static-1.5.0)
trying: monad-control-1.0.0.4 (dependency of conduit-extra-1.1.9)
trying: yesod-markdown-0.9.4 (dependency of Snowdrift-0.1.4)
trying: texmath-0.8.2 (dependency of yesod-markdown-0.9.4)
trying: pandoc-types-1.12.4.3 (dependency of texmath-0.8.2)
trying: aeson-0.9.0.1 (dependency of pandoc-types-1.12.4.3)
trying: yesod-form-1.4.4.1 (dependency of Snowdrift-0.1.4)
→ jclouds-examples[master+]/blobstore-clojure$ lein repl
"REPL started; server listening on localhost:26225."
user=> (use 'create-list.containers)
nil
user=> (create-and-list "transient" "foo" "bar" "mycontainer")
#<PageSetImpl [[type=CONTAINER, id=null, name=stub, location=[id=transient, scope=PROVIDER, description=http://localhost/transient, parent=null, iso3166Codes=[], metadata={}], uri=null, userMetadata={}], [type=CONTAINER, id=null, name=mycontainer, location=[id=transient, scope=PROVIDER, description=http://localhost/transient, parent=null, iso3166Codes=[], metadata={}], uri=null, userMetadata={}]]>
user=> (create-and-list "aws-s3" "***" "***" "vkbucket")
#<PageSetImpl []>
user=>
package controllers;
import org.apache.commons.mail.*;
import play.*;
import play.mvc.*;
import play.libs.*;
import java.util.*;
(defn index
"Get list of gamers"
([] (println "GET for the list of Gamers"))
([id] (println "GET for the gamer with " id)))
(defroutes routes
(GET "/gamers" [] (index))
public static void sendMail() throws Exception{
EmailAttachment attachment = new EmailAttachment();
attachment.setPath("/Users/vijay/Desktop/test.scala");
attachment.setDisposition(EmailAttachment.ATTACHMENT);
attachment.setDescription("Scala File");
attachment.setName("test.scala");
// Create the email message
MultiPartEmail email = new MultiPartEmail();
email.addTo("blah@example.com", "Vijay Kiran");
(defn index
[]
(ring.util.response/file-response "index.html"))
;;; routes
(defroutes routes
for i = 1:length(lambda_vec)
subsetX = X(1:i, :);
subsetY = y(1:i);
[theta] = trainLinearReg(subsetX, subsetY,lambda_vec(i));
[error_train(i),grad_train] = linearRegCostFunction(subsetX, subsetY, theta, lambda_vec(i));
[error_val(i),grad_val] = linearRegCostFunction(Xval, yval, theta, lambda_vec(i));
end
predictions = X * theta; %number of traing examples on m examples                                                                                            
                                                                                                                                                             
sqrErrors = (predictions - y).^2; % squared errors                                                                                                            
J = (1 / (2 *m) * sum(sqrErrors) ) + sum(theta(2:end) .^ 2) * lambda / (2 * m);                                                                              
grad = (1 / m) * ((X' * (predictions - y)) + (lambda * theta));                                                                                              
grad(1) -= (1 / m ) * (lambda * theta(1));