Skip to content

Instantly share code, notes, and snippets.

View afarber's full-sized avatar
🏠
Working from home

Alexander Farber afarber

🏠
Working from home
View GitHub Profile
@afarber
afarber / ParseVersion.cs
Created June 10, 2022 11:35
Parse numeric version - to decide which of 4 possible Protobuf parsers to apply
using System;
using System.Collections.Generic;
namespace MyName
{
using static ProtobufParserBase;
/// <summary>
@afarber
afarber / Client.java
Created March 1, 2021 09:42
A static map of maps to handle WebSocket sessions for users
package de.afarber;
import java.io.IOException;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.Collectors;
import org.eclipse.jetty.websocket.api.Session;
@afarber
afarber / sfcluster.json
Created June 12, 2020 20:00
sfcluster.json
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"type": "string",
"defaultValue": "sfcluster",
"minLength": 5,
"metadata": {
"description": "Name of the SF cluster"
{
"$schema": "https://schema.management.azure.com/schemas/2019-04-01/deploymentTemplate.json#",
"contentVersion": "1.0.0.0",
"parameters": {
"clusterName": {
"type": "string",
"defaultValue": "eventhub",
"metadata": {
"description": "Name for the Event Hub cluster."
}
@afarber
afarber / 1.json
Created October 3, 2018 13:49
Despite successful @TypeConverter call: NOT NULL constraint failed: table_games.pile
{
"formatVersion": 1,
"database": {
"version": 1,
"identityHash": "b4b5c4981b24b731a84a2c6cd13f8c1a",
"entities": [
{
"tableName": "table_config",
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`uid` INTEGER NOT NULL, `visited` INTEGER NOT NULL, `banned` TEXT, `vip` TEXT, `grand` TEXT, `elo` INTEGER NOT NULL, `coins` INTEGER NOT NULL, `medals` INTEGER NOT NULL, PRIMARY KEY(`uid`))",
"fields": [
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>jQuery UI Menu - Categories</title>
<link rel="stylesheet" href="https://code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<script src="https://code.jquery.com/jquery-1.12.4.js"></script>
<script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>
CREATE OR REPLACE FUNCTION words_get_chat(
in_gid integer,
in_social integer,
in_sid text
) RETURNS TABLE (
out_mine integer,
out_msg text
) AS
$func$
DECLARE
-- Reboot --
Mär 05 10:13:18 www systemd[1]: Started Jetty.
Mär 05 10:13:18 www systemd[1]: Starting Jetty...
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13:19.330:INFO::main: Logging initialized @985ms to org.eclipse.jetty.util.log.StdErrLog
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13:19.656:INFO:oejs.Server:main: jetty-9.4.8.v20171121, build timestamp: 2017-11-21T22:27:37+01:00, git hash: 82b8fb23f757335bb3329d540ce37a2a2615f0a8
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13:19.680:INFO:oejdp.ScanningAppProvider:main: Deployment monitor [file:///var/www/jetty-base/webapps/] at interval 1
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13:19.805:INFO:oejs.AbstractNCSARequestLog:main: Opened /var/log/jetty/ruhrgebietsingle.de/2018_03_05.request.log
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13:19.811:INFO:oejsh.ContextHandler:main: Started o.e.j.s.ServletContextHandler@3224f60b{/,file:///var/www/html/ruhrgebietsingle.de/,AVAILABLE,ruhrgebietsingle.de}
Mär 05 10:13:19 www java[1083]: 2018-03-05 10:13
CREATE TABLE words_moves (
mid BIGSERIAL PRIMARY KEY,
action text NOT NULL,
gid integer NOT NULL REFERENCES words_games ON DELETE CASCADE,
uid integer NOT NULL REFERENCES words_users ON DELETE CASCADE,
played timestamptz NOT NULL,
tiles jsonb,
score integer CHECK(score >= 0)
);
CREATE OR REPLACE FUNCTION words_play_game(
in_uid integer,
in_gid integer,
in_tiles jsonb
) RETURNS table (
out_uid integer, -- the player to be notified
out_fcm text,
out_apns text,
out_adm text,
out_body text