Skip to content

Instantly share code, notes, and snippets.

View devinrsmith's full-sized avatar

Devin Smith devinrsmith

  • Deephaven Data Labs
View GitHub Profile
@devinrsmith
devinrsmith / capn-proto-java.md
Created October 19, 2023 19:19
Cap'n Proto code generation and reflection for java

Cap’n Proto to Java

Note: this guide assumes Fedora, steps may be different for other OSes.

Install capnproto

sudo dnf install capnproto
import sys
import jpyutil
jpy_properties = {
'jpy.pythonPrefix': sys.prefix,
'jpy.programName': sys.executable,
'jpy.pythonLib': jpyutil._find_python_dll_file(fail=True),
'jpy.jpyLib': jpyutil._get_module_path('jpy', fail=True),
'jpy.jdlLib': jpyutil._get_module_path('jdl', fail=True)
}
@devinrsmith
devinrsmith / r_place_uncontested_pixels.py
Last active April 9, 2022 19:23
Script to create r/place uncontested pixels
# https://deephaven.io
from deephaven import agg, parquet, empty_table, merge
# Everything pre-whiteout
# https://www.reddit.com/r/place/comments/tzboys/the_rplace_parquet_dataset/
place = parquet.read('2022_place_deephaven.parquet')\
.where("k<155926002")
# 2000 x 2000 grid
all_pixels = empty_table(2000).view(["x1=(short)i"])\
#
# Copyright 2022 Deephaven Data Labs
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
@devinrsmith
devinrsmith / BracketOrdering.java
Last active March 21, 2022 21:25
Optimal single-elimination bracket ordering
/*
* Copyright 2022 Deephaven Data Labs
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
@devinrsmith
devinrsmith / classgraph-benchmark-1.md
Last active November 6, 2019 01:30
classgraph-benchmark-1
$ ./build/install/classgraph-benchmark/invoke.sh
Running a classgraph benchmark focused on startup speed
For more information, see https://github.com/devinrsmith/classgraph-benchmark

classloader META-INF/maven/com.google.guava/guava/pom.xml 2 84a3ee12 17 56
real 0.10
user 0.13
sys 0.03
classgraph META-INF/maven/com.google.guava/guava/pom.xml 2 84a3ee12 122 162
Verifying my Blockstack ID is secured with the address 19mEBDHwqMnWdZru6Bkg39WaL3EyrvkvKD https://explorer.blockstack.org/address/19mEBDHwqMnWdZru6Bkg39WaL3EyrvkvKD
@devinrsmith
devinrsmith / PermutationEncoding.java
Created October 3, 2017 04:37
PermutationEncoding.java
import java.util.Arrays;
import java.util.NoSuchElementException;
import java.util.PrimitiveIterator;
import java.util.function.IntConsumer;
/**
* @author Devin Smith
*/
public class PermutationEncoding {
@devinrsmith
devinrsmith / found_elgamal_test_vectors.csv
Created September 2, 2017 14:18
Various elgamal "test" vectors that I found online, either through simple examples or existing implementations
p g x k m a b
71 33 62 31 15 62 18
23 11 6 3 10 20 22
809 3 68 89 100 345 517
17 6 5 10 13 15 9
84265675725482892459719348378630146162719620409152809167814480007059199482163 5 2799014790424892046701478888900891009403869701173893426 23517683968368899022119256606644551548285683288848885921 87521618088882658227876453 22954586883013884818653063688294540134886732496160582262267014428782771199687 56046128113101346099694619669629128017849277484825379502821514323706183544424
12658517083168187407924345155971956101250996576825115113297001855799796437288935576230034157578333666497170430505565580165565829633685607504706642034926119 7 2001688878140630728014209681954697141876038523595247208 5446024688717452254835115775456957961297236108858862823 87521618088882658227876453 2150519483988769855483983776372336742288374425191291528256965705108393490638750082340115568718132372731853110762124400441550538499580316268601341087676203 1540471266850557563382406324432354117072109094950140952195099581066490559252112349492583688225692526
@devinrsmith
devinrsmith / elgamal_test_vectors.csv
Last active May 24, 2019 09:29
Randomly generated elgamal test vectors
p g x k m a b
11 3 2 2 0 9 0
23 6 7 6 9 12 6
47 24 6 16 0 34 0
83 28 29 11 34 10 76
167 88 21 69 82 42 135
359 292 11 3 272 79 79
983 368 39 253 457 489 239
1283 269 375 604 1260 940 334
2903 1697 762 133 311 2339 826