Skip to content

Instantly share code, notes, and snippets.

View asad-awadia's full-sized avatar
☁️
Server Dev

Asad Awadia asad-awadia

☁️
Server Dev
View GitHub Profile
@asad-awadia
asad-awadia / App.java
Created April 14, 2024 19:48 — forked from davepkennedy/App.java
SQLite + JDBI
public class App
{
private static final String JDBC_DRIVER = "org.sqlite.JDBC";
private static final String CONNECTION_STRING = "jdbc:sqlite:/tmp/testdb.db";
public static void main( String[] args ) throws SQLException, ClassNotFoundException {
SQLiteDataSource ds = new SQLiteDataSource();
ds.setUrl("jdbc:sqlite:/tmp/data.db");
DBI dbi = new DBI(ds);
Handle h = dbi.open();
@asad-awadia
asad-awadia / cloudfanatic-4vcpu-8gb-yabs.out
Created August 6, 2023 18:01
cloudfanatic-4vcpu-8gb-yabs.out
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2023-04-23 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Aug 6 17:43:28 UTC 2023
Basic System Information:
---------------------------------
@asad-awadia
asad-awadia / linode-4vcpu-8gb-yabs.out
Created August 6, 2023 04:17
linode-4vcpu-8gb-yabs.out
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2023-04-23 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Aug 6 04:01:44 UTC 2023
Basic System Information:
---------------------------------
@asad-awadia
asad-awadia / vultr4vcpu-8gb-yabs.out
Created August 6, 2023 03:52
vultr-4vcpu-8gb-yabs.out
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2023-04-23 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Aug 6 03:39:44 UTC 2023
Basic System Information:
---------------------------------
@asad-awadia
asad-awadia / rpi4b-yabs.out
Created August 6, 2023 03:32
rpi4b-yabs.out
# v2023-04-23 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sat Aug 5 23:24:44 EDT 2023
ARM compatibility is considered *experimental*
Basic System Information:
---------------------------------
@asad-awadia
asad-awadia / digitalocean-4vcpu-8gb-yabs.out
Last active August 6, 2023 16:42
digitalocean-4vcpu-8gb-yabs.out
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
# Yet-Another-Bench-Script #
# v2023-04-23 #
# https://github.com/masonr/yet-another-bench-script #
# ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## ## #
Sun Aug 6 03:07:53 UTC 2023
Basic System Information:
---------------------------------
@asad-awadia
asad-awadia / stream.rs
Created May 25, 2023 14:22
roux-stream.rs
use async_std::task::sleep;
use crypto::digest::Digest;
use crypto::sha1::Sha1;
use futures_util::*;
use roux::comment::CommentData;
use roux_stream::stream_comments;
use serde_json::{json, Value};
use std::{borrow::Borrow, collections::HashSet, time::Duration};
use tokio_retry::strategy::ExponentialBackoff;
use chrono::{self, Timelike};
@asad-awadia
asad-awadia / GeoHashUtils.java
Created October 25, 2022 12:58 — forked from klehmann/GeoHashUtils.java
GeoHash utilities in Java
/*
* Copyright (c) 2013 Mindoo GmbH
*
* 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
@asad-awadia
asad-awadia / cartesianProduct.kt
Created March 31, 2022 23:21 — forked from bastman/cartesianProduct.kt
Kotlin collections - leftJoin,innerJoin, ...
infix fun <T,O>List<T>.cartesianProduct(others:List<O>):List<Pair<T,O>> =
flatMap{ t:T->
others.map { o-> Pair(t,o) }
}
inline fun <T, O, R> List<T>.mapCartesianProduct(others: List<O>, transform: (Pair<T, O>) -> R): List<R> =
flatMap { t: T ->
others.map { o -> transform(Pair(t, o)) }
}
@asad-awadia
asad-awadia / chat-server.kt
Created March 2, 2021 03:38
Vert.x live chat feeds
fun main() {
val rooms = mutableMapOf<String, MutableSet<ServerWebSocket>>()
val vertx = Vertx.vertx()
vertx.createHttpServer()
.webSocketHandler {
rooms.computeIfPresent(it.path()) { _, listOfConnections ->
listOfConnections.add(it)
listOfConnections
}
rooms.computeIfAbsent(it.path()) { _ -> mutableSetOf(it) }