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
def log_uncaught_exceptions(ex_cls, ex, tb): | |
logging.critical(''.join(traceback.format_tb(tb))) | |
logging.critical('{0}: {1}'.format(ex_cls, ex)) | |
os._exit(1) | |
sys.excepthook = log_uncaught_exceptions | |
def install_thread_excepthook(): | |
""" | |
Workaround for sys.excepthook thread bug | |
(https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1230540&group_id=5470). |
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 codecs, sys | |
sys.stdout = codecs.getwriter('utf8')(sys.stdout) | |
print 'ololo' | |
sys.stdout.flush() |
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
``` | |
org.springframework.web.util.NestedServletException: Request processing failed; nested exception is org.thymeleaf.exceptions.TemplateInputException: An error happened during template parsing (template: "URL [file:./web/templates/display/ad.html]") | |
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:982) ~[spring-webmvc-4.3.0.BUILD-SNAPSHOT.jar:4.3.0.BUILD-SNAPSHOT] | |
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:861) ~[spring-webmvc-4.3.0.BUILD-SNAPSHOT.jar:4.3.0.BUILD-SNAPSHOT] | |
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) ~[javax.servlet-api-3.1.0.jar:3.1.0] | |
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846) ~[spring-webmvc-4.3.0.BUILD-SNAPSHOT.jar:4.3.0.BUILD-SNAPSHOT] | |
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) ~[javax.servlet-api-3.1.0.jar:3.1.0] | |
at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:812) ~[jetty-servlet-9.2.17.v20160517.ja |
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
#coding=utf-8 | |
import sys | |
vowels = u"уеаоэяиюы" | |
text = sys.stdin.read() | |
consonant = filter(lambda x: x.lower() not in vowels, text) | |
vows = filter(lambda x: x.lower() in vowels or x == " ", text) | |
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 mwe | |
import co.paralleluniverse.fibers.Suspendable | |
import co.paralleluniverse.kotlin.Actor | |
import co.paralleluniverse.kotlin.register | |
import co.paralleluniverse.kotlin.spawn | |
import co.paralleluniverse.strands.Strand | |
class LazyActor : Actor() { |
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
apply plugin: 'java' | |
apply plugin: 'idea' | |
apply plugin: 'kotlin' | |
buildscript { | |
ext.kotlin_version = '1.1.51' | |
ext.quasar_version = '0.7.9' | |
repositories { | |
mavenCentral() |
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
(function logs_data_main(){ | |
const ui_id = "logs_ui"; | |
const data_id = "logs_data_ui"; | |
function addLogsData(){ | |
let text = document.getElementById(data_id).value; | |
let lines = text.split('\n'); | |
let urlsAndNames = lines | |
.filter(x => x.length > 2) |
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 com.typesafe.config.ConfigFactory | |
import scala.util.Try | |
object TestDuration extends App { | |
val strings = Seq("1s", "2s", "2m", "2h", "2d", "2y", "1h30m", "86000000ms") | |
def getISOPrefix(duration: String): String = if (Set('y', 'd').contains(duration.last)) "P" else "PT" | |
val parseAndProcessDuration: Map[String, String => String] = Map( |
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
//works with 0.3.10 but fails with OOM with 0.4.4 | |
//see https://github.com/flipkart-incubator/zjsonpatch/issues/77 | |
import com.fasterxml.jackson.databind.JsonNode; | |
import com.fasterxml.jackson.databind.ObjectMapper; | |
import com.flipkart.zjsonpatch.JsonDiff; | |
import java.io.IOException; | |
public class Main { |
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 org.apache.kafka.clients.consumer.ConsumerConfig | |
import org.apache.kafka.common.TopicPartition | |
import org.apache.kafka.common.serialization.StringDeserializer | |
import org.apache.spark.streaming.kafka010.KafkaUtils | |
import org.apache.spark.streaming.{Seconds, StreamingContext} | |
import org.apache.spark.{SparkConf, SparkContext, SparkEnv} | |
import org.apache.spark.streaming.kafka010._ | |
import org.apache.spark.streaming.kafka010.LocationStrategies.PreferConsistent | |
import org.apache.spark.streaming.kafka010.ConsumerStrategies.Subscribe |
OlderNewer