Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

PROgrm_JARvis JarvisCraft

🏠
Working from home
View GitHub Profile
View main.cpp
#include <iostream>
#include <string>
#include <vector>
#include <map>
#include <unordered_map>
#include <algorithm>
#ifndef in
#define in std::cin
@JarvisCraft
JarvisCraft / hg.diff
Created Sep 9, 2019
[OpenJDK] [PATCH] Allow LambdaMetaFactory generate direct field access instructions
View hg.diff
diff --git a/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java b/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
--- a/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
+++ b/src/java.base/share/classes/java/lang/invoke/AbstractValidatingLambdaMetafactory.java
@@ -61,6 +61,7 @@
final MethodHandleInfo implInfo; // Info about the implementation method handle "MethodHandleInfo[5 CC.impl(int)String]"
final int implKind; // Invocation kind for implementation "5"=invokevirtual
final boolean implIsInstanceMethod; // Is the implementation an instance method "true"
+ final boolean implIsMethodNotField; // "true" for method and "false" for field
final Class<?> implClass; // Class for referencing the implementation method "class CC"
final MethodType instantiatedMethodType; // Instantiated erased functional interface method ty
View AsmTextModelFactory$TextModelBuilder$$Generated$$TextModel$$1.java
package ru.progrm_jarvis.ultimatemessenger.format.model;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModel;
import ru.progrm_jarvis.ultimatemessenger.format.model.AsmTextModelFactory.TextModelBuilder;
public final class AsmTextModelFactory$TextModelBuilder$$Generated$$TextModel$$1 implements TextModel {
public static final TextModel D0 = TextModelBuilder.internal$getDynamicTextModel("1");
public static final TextModel D1 = TextModelBuilder.internal$getDynamicTextModel("2");
public static final TextModel D2 = TextModelBuilder.internal$getDynamicTextModel("3");
public static final TextModel D3 = TextModelBuilder.internal$getDynamicTextModel("4");
@JarvisCraft
JarvisCraft / LinesWithPlaceholders.txt
Last active Aug 8, 2019
ultimate-messenger Placeholders benchmark
View LinesWithPlaceholders.txt
Hello world
Hello, {user:name}
Hello, {user:name}, how are you?
Hello, {user:name}, how are you?
Hi, {user:name} your ping is {user:ping}
Hi, dear {user:name}, btw, {user:name}, how are you feeling? Also, what are you doing?
Your ping is {user:ping}.
Speaking about your friends, {user:friends}, how are they feeling?
Do your friends ({user:friends}) feel like they want to test your ping ({user:ping}?
This {user:magic could have been a great placeholder, but it isn't, lol
View TextModelVsReplaceBenchmark.java
package ru.progrm_jarvis.benchmark.ultimatemessenger;
import org.openjdk.jmh.annotations.*;
import org.openjdk.jmh.infra.Blackhole;
import org.openjdk.jmh.runner.Runner;
import org.openjdk.jmh.runner.RunnerException;
import org.openjdk.jmh.runner.options.OptionsBuilder;
import ru.progrm_jarvis.ultimatemessenger.format.model.AsmGeneratingTextModelFactory;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModel;
import ru.progrm_jarvis.ultimatemessenger.format.model.TextModelFactory;
View Base2Encoder.java
class Base2Encoder {
public static final int CHAR_SIZE = 16;
public static final char POSITIVE_SYMBOL = ')';
public static void main(String[] args) {
final String encoded = toBase2("Hello world!");
System.out.printf("Encoded: %s%n", encoded);
System.out.printf("Decoded: %s%n", fromBase2(encoded));
@JarvisCraft
JarvisCraft / vk_handler.groovy
Created May 20, 2019
CatOBot handler scripts
View vk_handler.groovy
import com.vk.api.sdk.callback.CallbackApi
import com.vk.api.sdk.objects.messages.AudioMessage
import com.vk.api.sdk.objects.messages.Message
import groovy.transform.Canonical
import groovy.transform.builder.Builder
import org.slf4j.Logger
import org.slf4j.LoggerFactory
import ru.progrm_jarvis.catobot.CatOBot
import ru.progrm_jarvis.catobot.ai.RecognitionResult
import ru.progrm_jarvis.catobot.image.CatImage
@JarvisCraft
JarvisCraft / Standard.md
Last active Mar 28, 2019
Project April <Annotation Remote Procedure Call API>
View Standard.md

Project April

Standard

TODO

Idea

Project April is an API invented for annotation-based approach in creating distributed services.

Terminology:

Remote procedure = Remote method = RP

Procedure (method) whose execution is delegated to a Data-provider server (most commonly, on other physical machine) via the Distributor server

@JarvisCraft
JarvisCraft / Standard.md
Created Mar 28, 2019
Project April <Annotation Remote Procedure Call API>
View Standard.md

Project April

Standard

Idea

Project April is an API invented for annotation-based approach in creating distributed services.

Terminology:

Remote procedure = Remote method = RP

Procedure (method) whose execution is delegated to a Data-provider server (most commonly, on other physical machine) via the Distributor server

Data-user( server) = DU
@JarvisCraft
JarvisCraft / Standard.md
Created Mar 28, 2019
Project April <Annotation Remote Procedure Call API>
View Standard.md

Project April

Standard

Idea

Project April is an API invented for annotation-based approach in creating distributed services.

Terminology:

Remote procedure = Remote method = RP

Procedure (method) whose execution is delegated to a Data-provider server (most commonly, on other physical machine) via the Distributor server

Data-user( server) = DU