Skip to content

Instantly share code, notes, and snippets.

object HelloWorld extends App {
println("Hello, world!")
}
@maxcom
maxcom / Demo.scala
Last active February 26, 2020 16:29
package demo
import java.time.Instant
import demo.Scheduler.Schedule
import scala.collection.mutable
import scala.concurrent.{Future, Promise}
import scala.concurrent.ExecutionContext.Implicits.global
2017-02-02 16:09:32.128363500 2017-02-02 16:09:32
2017-02-02 16:09:32.128366500 Full thread dump OpenJDK 64-Bit Server VM (25.101-b13 mixed mode):
2017-02-02 16:09:32.128368500
2017-02-02 16:09:32.128369500 "elasticsearch[main][flush][T#5]" #90 daemon prio=5 os_prio=0 tid=0x00007f5a5c003000 nid=0x14c waiting on condition [0x00007f5a4c252000]
2017-02-02 16:09:32.128371500 java.lang.Thread.State: WAITING (parking)
2017-02-02 16:09:32.128413500 at sun.misc.Unsafe.park(Native Method)
2017-02-02 16:09:32.128414500 - parking to wait for <0x00000006d4d0f238> (a org.elasticsearch.common.util.concurrent.EsExecutors$ExecutorScalingQueue)
2017-02-02 16:09:32.128427500 at java.util.concurrent.locks.LockSupport.park(LockSupport.java:175)
2017-02-02 16:09:32.128437500 at java.util.concurrent.LinkedTransferQueue.awaitMatch(LinkedTransferQueue.java:737)
2017-02-02 16:09:32.128449500 at java.util.concurrent.LinkedTransferQueue.xfer(LinkedTransferQueue.java:647)
@maxcom
maxcom / EventIndexingActor.scala
Created May 7, 2015 09:08
EventIndexingActor
package su.msk.jet.smap.id.actors.events
import akka.actor._
import akka.pattern.{CircuitBreaker, PipeToSupport}
import su.msk.jet.smap.id.actors.ActorHelpers
import su.msk.jet.smap.id.config.CircuitBreakerConfig
import su.msk.jet.smap.id.domain._
import su.msk.jet.smap.id.indexing.events.EventIndexingService
import su.msk.jet.smap.id.persistence.events.EventIndexingDataService
import su.msk.jet.smap.id.utils.CountBarrier
Apache Maven 3.2.3 (33f8c3e1027c3ddde99d3cdebad2656a31e8fdf4; 2014-08-12T00:58:10+04:00)
Maven home: /usr/local/Cellar/maven/3.2.3/libexec
Java version: 1.8.0_25, vendor: Oracle Corporation
Java home: /Library/Java/JavaVirtualMachines/jdk1.8.0_25.jdk/Contents/Home/jre
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "10.10.1", arch: "x86_64", family: "mac"
[INFO] Error stacktraces are turned on.
[DEBUG] Reading global settings from /usr/local/Cellar/maven/3.2.3/libexec/conf/settings.xml
[DEBUG] Reading user settings from /Users/maxcom/.m2/settings.xml
[DEBUG] Using local repository at /Users/maxcom/.m2/repository
@maxcom
maxcom / eclipse mat output
Created October 17, 2014 11:01
List iterable eats memory even when iteration is finised
Class Name | Shallow Heap | Retained Heap
----------------------------------------------------------------------------------------------------------
cur scala.collection.Iterator$JoinIterator @ 0xf093eb48 | 32 | 63 443 416
|- <class> class scala.collection.Iterator$JoinIterator @ 0xf06e19c0 | 0 | 0
|- lhs scala.collection.LinearSeqLike$$anon$1 @ 0xf093eb68 | 24 | 1 040 024
| |- <class> class scala.collection.LinearSeqLike$$anon$1 @ 0xf00f2410 | 0 | 0
| |- these scala.collection.immutable.Nil$ @ 0xf037c0b0 | 16 | 16
| |- $outer scala.collection.immutable.$colon$colon @ 0xf09ff3d0 | 24 | 1 040 000
| | |- <class> class scala.collection.immutable.$colon$colon @ 0xf00b4138| 0 | 0
| | |- head su.msk.jet.smap.id.domain.EventId @ 0xf09ff3e8
{
"query":{
"filtered":{
"query":{
"bool":{
"should":[
{
"mlt_field":{
"title":{
"like_text":"BenQ S6: мобильное интернет-устройство под управлением Red Flag Midinux Linux",
Class Name | Shallow Heap | Retained Heap | Percentage
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
@maxcom
maxcom / Tool.scala
Created March 27, 2013 14:27
Конвертер профилей в БД
package lor.profiletool
import java.io.{IOException, FileInputStream, ObjectInputStream, File}
import java.util
import collection.JavaConversions._
import java.sql.DriverManager
object Tool {
def main(args: Array[String]) {
if (args.length!=2) {
@maxcom
maxcom / gist:635897
Created October 20, 2010 06:33 — forked from hizel/gist:633686
drop table jam_authorities;
create view jam_authorities as
select nick as username, 'ROLE_ADMIN' as authority from users where canmod='t'
union all
select nick as username, 'ROLE_SYSADMIN' as authority from users where id=1
union all
select nick as username, 'ROLE_EDIT_EXISTING' as authority from users where not users.blocked AND users.score >= 0
union all