Skip to content

Instantly share code, notes, and snippets.

View galderz's full-sized avatar

Galder Zamarreño galderz

  • Red Hat
  • Switzerland
View GitHub Profile
defaults read com.apple.symbolichotkeys AppleSymbolicHotKeys | grep -A6 "\"60\""
defaults write com.apple.symbolichotkeys AppleSymbolicHotKeys -dict-add 60 '
{
"enabled" = 0;
"value" = {
"parameters" = (32, 49, 262144);
"type" = "standard";
};
}'
//MANIFEST Main-Class=org.mendrugo.fibula.MutiVmMain
package red.hat.puzzles.loom;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.util.concurrent.TimeUnit;
import org.openjdk.jmh.annotations.Benchmark;
@galderz
galderz / custom.cnf
Created September 12, 2022 15:50 — forked from Sanne/custom.cnf
MySQL configuration for testing
#
# MariaDB tuning meant for fast integration test execution:
# data is meant to be lost. Never use for actual database needs!
#
[mysqld]
# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links = 0
SerializationContext serialCtx = ...
String protoFile = read(CryptoCurrency.class.getResourceAsStream("/crypto.proto"));
metadataCache.put("crypto.proto", protoFile);
...
serialCtx.registerProtoFiles(FileDescriptorSource.fromResources("/crypto.proto"));
serialCtx.registerMarshaller(new CryptoCurrencyMarshaller());
import org.infinispan.protostream.MessageMarshaller;
public class CryptoCurrencyMarshaller implements MessageMarshaller<CryptoCurrency> {
@Override
public CryptoCurrency readFrom(ProtoStreamReader reader) throws IOException {
String description = reader.readString("description");
Integer rank = reader.readInt("rank");
return new CryptoCurrency(description, rank);
}
package crypto;
/**
* @Indexed
*/
message CryptoCurrency {
/**
* @Field
*/
public class CryptoCurrency {
public final String description;
public final Integer rank;
....
}
RemoteCache<String, String> metadataCache =
remote.getCache(PROTOBUF_METADATA_CACHE_NAME);
metadataCache.put(fileName, protoFile);
String filesWithErrors = metadataCache.get(ERRORS_KEY_SUFFIX);
if (filesWithErrors != null)
throw new AssertionError("Error in proto file(s): " + filesWithErrors);
else
System.out.println("Added schema file: " + fileName);
RemoteCacheManager remote = …
SerializationContext serialCtx =
ProtoStreamMarshaller.getSerializationContext(remote);
ProtoSchemaBuilder protoSchemaBuilder = new ProtoSchemaBuilder();
String protoFile = protoSchemaBuilder
.fileName(fileName)
.addClass(Pokemon.class)
.packageName("pokemons")
.build(serialCtx);
import org.infinispan.protostream.annotations.ProtoDoc;
import org.infinispan.protostream.annotations.ProtoField;
@ProtoDoc("@Indexed")
public class Pokemon {
@ProtoDoc("@Field")
@ProtoField(number = 10)
String name;