Skip to content

Instantly share code, notes, and snippets.

View macalinao's full-sized avatar

Ian Macalinao macalinao

View GitHub Profile
ian@ian-mac ~/proj/asunasan
% sbt publish
[info] Loading global plugins from /Users/ian/.sbt/0.13/plugins
[info] Loading project definition from /Users/ian/proj/asunasan/project
[info] Set current project to asunasan (in build file:/Users/ian/proj/asunasan/)
[info] :: delivering :: lio.asuna#asunasan_2.11;0.0.1 :: 0.0.1 :: release :: Sat Oct 08 23:22:00 CDT 2016
[info] delivering ivy file to /Users/ian/proj/asunasan/target/scala-2.11/ivy-0.0.1.xml
java.lang.Error: s3://aincrad.asuna.io/lio/asuna/asunasan_2.11/0.0.1/asunasan_2.11-0.0.1.jar exists but overwriting is disabled
at ohnosequences.ivy.S3Repository.put(S3Repository.java:205)
lsport() {
if [ "$#" -ne 1 ]; then
echo "Gets information about processes running on the given port."
echo "Usage: lsport <port>"
else
lsof -wni tcp:$1
fi
}
pidport() {
@macalinao
macalinao / -
Created September 25, 2016 19:11
dcos spark run --submit-args='-Dspark.mesos.coarse=true --num-executors 1 --executor-cores 1 --executor-memory 3G -Dspark.cassandra.connection.host=node-0.cassandra.mesos --class ai.legends.athena.Main https://s3-us-west-2.amazonaws.com/asuna-spark-jobs/legendsai-athena/legendsai-athena-latest.jar'
127.0.0.1 - - [25/Sep/2016 14:11:14] "POST /v1/submissions/create HTTP/1.1" 500 -
Spark submit failed:
Using Spark's default log4j profile: org/apache/spark/log4j-defaults.properties
16/09/25 14:11:14 INFO RestSubmissionClient: Submitting a request to launch an application in mesos://localhost:62280.
Exception in thread "main" org.apache.spark.deploy.rest.SubmitRestProtocolException: Malformed response received from server
at org.apache.spark.deploy.rest.RestSubmissionClient.readResponse(RestSubmissionClient.scala:299)
at org.apache.spark.deploy.rest.RestSubmissionClient.org$apache$spark$deploy$rest$RestSubmissionClient$$postJson(RestSubmissionClient.scala:255)
at org.apache.spark.deploy.res
package lib
import (
"github.com/Sirupsen/logrus"
"github.com/asunaio/apollo/config"
"github.com/asunaio/apollo/models"
"github.com/gocql/gocql"
"github.com/simplyianm/inject"
)
// Sum derives a sum from a set of filters.
func (a *aggregatorImpl) Sum(filters []*apb.MatchFilters) (*apb.MatchSum, error) {
// Channel containing sums
sumsChan := make(chan *apb.MatchSum)
// Error from fetching aggregates
var fetchErr error = nil
// Concurrently fetch all sums
var wg sync.WaitGroup
// Create aggregate sum
sum := (*apb.MatchSum)(nil)
go func() {
for sumRow := range sumsChan {
if sum == nil {
sum = &apb.MatchSum{}
}
sum = addMatchSums(sum, sumRow)
}
package models
import (
"time"
apb "github.com/simplyianm/apollo/gen-go/asuna"
)
// makeQuotient creates a MatchQuotient from a MatchSum.
func makeQuotient(sum *apb.MatchSum) *apb.MatchQuotient {
func makeMatchAggregateCollections(quot *apb.MatchQuotient) (*apb.MatchAggregateCollections, error) {
// derive runes
var runes []*apb.MatchAggregateCollections_RuneSet
for rs, rstats := range quot.Runes {
// rs is rune set string
// rstats is rune set subscalars
runeSet, err := deserializeBonusSet(rs)
if err != nil {
return nil, fmt.Errorf("could not deserialize rune set: %v", err)
package models
import (
"sort"
"strconv"
"strings"
apb "github.com/simplyianm/apollo/gen-go/asuna"
)
for _, quot := range quots {
// Scalars
gs.scalars.winRate = append(gs.scalars.winRate, quot.Scalars.Wins)
gs.scalars.gamesPlayed = append(gs.scalars.pickRate, quot.Scalars.Plays)
gs.scalars.goldEarned = append(gs.scalars.goldEarned, quot.Scalars.GoldEarned)
gs.scalars.kills = append(gs.scalars.kills, quot.Scalars.Kills)
gs.scalars.deaths = append(gs.scalars.deaths, quot.Scalars.Deaths)
gs.scalars.assists = append(gs.scalars.assists, quot.Scalars.Assists)
gs.scalars.damageDealt = append(gs.scalars.damageDealt, quot.Scalars.DamageDealt)
gs.scalars.damageTaken = append(gs.scalars.damageTaken, quot.Scalars.DamageTaken)