- Amazon ECS Optimized AMI: ami-b4ae1dd7
- Instance Type: t2.small
- Name: [CONFIG_NAME]
- IAM role: fever_ecs
- User data: As text
| import android.app.Activity; | |
| import android.app.Service; | |
| import android.content.BroadcastReceiver; | |
| import android.content.Context; | |
| import android.content.Intent; | |
| import android.content.IntentFilter; | |
| import android.os.Bundle; | |
| import android.os.IBinder; | |
| import android.support.v4.content.LocalBroadcastManager; |
| require 'uri' | |
| namespace :mongo do | |
| desc "Dump the production database and restore to development and staging databases." | |
| task :dump_and_restore => :environment do | |
| dev = URI.parse(ENV["MONGO_URI"]) | |
| prod = URI.parse(`heroku config:get MONGO_URI --remote production`) | |
| prod_username, prod_password = prod.userinfo.split(':') |
| var express = require("express"); | |
| var app = express(); | |
| app.get("/restricted", function(req, res, next){ | |
| // Grab the "Authorization" header. | |
| var auth = req.get("authorization"); | |
| // On the first request, the "Authorization" header won't exist, so we'll set a Response | |
| // header that prompts the browser to ask for a username and password. |
| // Sequence of numbers | |
| val xs = Seq(1, 5, 3, 4, 6, 2) | |
| // Sort using Natural ordering as defined for Integers in Scala Library | |
| xs.sorted //1,2,3,4,5,6 | |
| // Sort 'with' a comparator function | |
| xs.sortWith(_<_) //1,2,3,4,5,6 | |
| xs.sortWith(_>_) //6,5,4,3,2,1 | |
| xs.sortWith((left,right) => left > right) //6,5,4,3,2,1 |
| package com.semperos.example | |
| import org.apache.http.impl.client.{BasicResponseHandler, DefaultHttpClient} | |
| import org.apache.http.{HttpRequest, HttpRequestInterceptor} | |
| import org.apache.http.client.methods.HttpGet | |
| import org.apache.http.protocol.HttpContext | |
| import org.apache.log4j.Logger | |
| /** |
| package com.scalawilliam.example.play | |
| import play.api.libs.ws._ | |
| /** | |
| * Play's Scala WS library is very very cool. Provides you with plenty niceties. | |
| * See more: https://www.playframework.com/documentation/2.3.x/ScalaWS | |
| * | |
| * Unfortunately it by default requires a Play application context. | |
| * But you do not necessarily always want that. |
| import play.api.libs.ws.ahc.AhcWSClient | |
| import akka.stream.ActorMaterializer | |
| import akka.actor.ActorSystem | |
| implicit val system = ActorSystem() | |
| implicit val materializer = ActorMaterializer() | |
| val ws = AhcWSClient() | |
| val req = ws.url("http://example.com").get().map{ | |
| resp => resp.body |
| # Inspired from http://blog.akquinet.de/2010/05/26/mastering-the-maven-command-line-%E2%80%93-reactor-options/ | |
| # Build only specific modules: | |
| mvn clean install -pl sub-module-name2 | |
| mvn clean install -pl sub-module-name2,sub-module-name3 | |
| # Build only starting from specific sub-module (resume from) | |
| mvn clean install -rf sub-module-name2 | |
| # Build dependencies (also make) |
| ### KERNEL TUNING ### | |
| # Increase size of file handles and inode cache | |
| fs.file-max = 2097152 | |
| # Do less swapping | |
| vm.swappiness = 10 | |
| vm.dirty_ratio = 60 | |
| vm.dirty_background_ratio = 2 |