Skip to content

Instantly share code, notes, and snippets.

Avatar
🏠
Working from home

Kartik Khare KKcorps

🏠
Working from home
View GitHub Profile
View BenchmarkJoda.java
import java.time.Instant;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.concurrent.ThreadLocalRandom;
import java.util.concurrent.TimeUnit;
import org.joda.time.format.DateTimeFormat;
import org.joda.time.format.DateTimeFormatter;
import org.openjdk.jmh.annotations.Benchmark;
import org.openjdk.jmh.annotations.BenchmarkMode;
import org.openjdk.jmh.annotations.CompilerControl;
View generated_code_by_copilot.java
// generate red-black tree from a list
void generateRedBlackTree(){
// create a red-black tree
// for each node in the list
// insert the node into the tree
RedBlackTree tree = new RedBlackTree();
for(Node node : list){
tree.insert(node);
}
View github_events_table_config.json
{
"tableName": "pullRequestMergedEvents",
"tableType": "REALTIME",
"segmentsConfig": {
"timeColumnName": "mergedTimeMillis",
"retentionTimeUnit": "DAYS",
"retentionTimeValue": "60",
"schemaName": "pullRequestMergedEvents",
"replication": "1",
"replicasPerPartition": "1"
View github_events_schema.json
{
"schemaName": "pullRequestMergedEvents",
"dimensionFieldSpecs": [
{
"name": "title",
"dataType": "STRING",
"defaultNullValue": ""
},
{
"name": "labels",
View dummy.py
from java_integration_lib import find_modules
import subprocess
def foo_bar():
jar_path = find_modules._find_dummy_java_module()
output = subprocess.check_output(["java", "-cp", jar_path, "org.example.Main"])
print(str(output))
View Main.class
package org.example;
public class Main {
public static void main(String[] args) {
System.out.println("Java " + Main.class.toString() + " executed!!");
}
}
View setup.py
from future import standard_library
standard_library.install_aliases()
from builtins import *
from shutil import copytree, copy, rmtree
from setuptools import setup
import os
import sys
from distutils.command.build_ext import build_ext
import glob
from setuptools.command.install import install
View find_modules.py
import os
from importlib.util import find_spec
import glob
def _contains_jar(path):
jar_file = path + "/dummy-*.jar"
jar_file_matches = glob.glob(jar_file)
if len(jar_file_matches) > 0:
return jar_file_matches[0]
else:
View pinot.sql
-- Scalar Functions
SELECT UPPER(playerName) FROM baseballStats
SELECT SUBSTR(playerName, 2, 11) FROM baseballStats
SELECT CONCAT(firstName, lastName, '-') FROM baseballStats
-- Non scalar Functions
View custom_function.sql
SELECT encode_geohash(28.7, 77.1, 4) FROM TABLE