Skip to content

Instantly share code, notes, and snippets.

fun def1(par: String) =
//Вызов которые нельзя менять
GlobalScope.async {
println(par + "-1: " + System.currentTimeMillis())
Thread.sleep(1000)
if (par == "3") throw RuntimeException("error '3'")
par + "_map1"
}
fun def2(list: List<String>) =
#include "Nokia_5110.h"
#include "DHT.h"
#include "MQ135.h"
#define LCD_RST 7
#define LCD_CE 6
#define LCD_DC 5
#define LCD_DIN 4
#define LCD_CLK 3
@glebmtb
glebmtb / TestCounter.java
Last active September 11, 2015 11:28
Hello World Atomic
package cun;
import java.util.concurrent.atomic.AtomicInteger;
public class TestCounter {
public static void main(String[] args) {
ExecutorService executors = Executors.newCachedThreadPool();
Counter counter = new Counter();
@glebmtb
glebmtb / TestNotify.java
Last active September 11, 2015 10:44
Hello World synchronized
import java.util.*;
public class TestNotify {
public static void main(String[] args) {
Stock stock = new Stock();
Thread consumer = new Thread(new Consumer(stock));
Thread producer = new Thread(new Producer(stock));
consumer.start();
producer.start();
@glebmtb
glebmtb / TestServer.java
Created September 9, 2015 13:21
Http Server
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import com.sun.net.httpserver.HttpServer;
import sun.net.httpserver.HttpServerImpl;
import java.io.IOException;
import java.io.OutputStream;
import java.net.InetSocketAddress;
import java.util.HashMap;
import java.util.Map;
public class Singlton
{
private static class SingltonHolder
{
private static final Singlton INSTANCE = new Singlton();
}
public static Singlton getInstance()
{
return SingltonHolder.INSTANCE;