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
CREATE OR REPLACE FUNCTION words_expire_games(
) RETURNS TABLE (
out_uid integer, -- the player to be notified
out_gid integer, -- which game has expired
out_fcm text,
out_apns text,
out_sns text,
out_note text
) AS
$func$
CREATE OR REPLACE FUNCTION words_skip_game(
in_uid integer,
in_gid integer
) RETURNS TABLE (
out_uid integer, -- the player to be notified
out_fcm text,
out_apns text,
out_sns text,
out_note text
) AS
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>de.afarber</groupId>
<artifactId>mavenproject1</artifactId>
<version>1.0</version>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
package de.afarber.mavenproject1;
import com.google.gson.Gson;
import java.util.Map;
public class Main {
public static void main(String[] args) {
String str = "{\"Chapter\": \"5.2\",\n" +
" \"Title\": \"Hello\",\n" +
" \"Text\": \"Sentence 1. Sentence 2.\"}";
@afarber
afarber / paho0.log.0
Created March 9, 2017 08:42
How to detect “Connection refused” when using MqttAsyncClient with no automatic reconnect?
FINE 17-03-09 07:55:32.0694 tv3.MqttAsyncClient MqttAsyncClient 60 ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8: <init> ClientID=ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8 ServerURI=tcp://127.0.0.1 PersistenceType=org.eclipse.paho.client.mqttv3.persist.MemoryPersistence@5a642197
FINE 17-03-09 07:55:32.0701 nal.CommsTokenStore <Init> 60 ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8: <>
FINER 17-03-09 07:55:32.0710 nternal.ClientState <Init> 60 ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8:
FINE 17-03-09 07:55:32.0713 nternal.ClientState restoreState 60 ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8: >
FINE 17-03-09 07:55:32.0714 tv3.MqttAsyncClient connect 60 ef978a39c826cd6d4ad22f20d5abe6c236eddb060b5d765a1fe2e1d79837fcc8: cleanSession=true connectionTimeout=30 TimekeepAlive=60 userName=OAUTH password=[notnull] will=[null] u
"use strict";
function Score(color) {
PIXI.Container.call(this);
this.color = color;
this.interactive = false;
this.buttonMode = false;
this.visible = false;
@afarber
afarber / 2016_07_13.stderrout.log
Created July 13, 2016 19:24
jetty-distribution-9.3.10.v20160621
This file has been truncated, but you can view the full file.
2016-07-13 21:02:51.898:DBUG:oejx.XmlConfiguration:main: XML call setOut
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: parse: file:/usr/share/java/jetty-distribution-9.3.10.v20160621/etc/jetty.xml
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: parsing: sid=file:/usr/share/java/jetty-distribution-9.3.10.v20160621/etc/jetty.xml,pid=null
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: resolveEntity(-//Jetty//Configure//EN, http://www.eclipse.org/jetty/configure_9_3.dtd)
2016-07-13 21:02:51.898:DBUG:oejx.XmlParser:main: Redirected entity http://www.eclipse.org/jetty/configure_9_3.dtd --> jar:file:/usr/share/java/jetty-distribution-9.3.10.v20160621/lib/jetty-xml-9.3.10.v20160621.jar!/org/eclipse/jetty/xml/configure_9_3.dtd
2016-07-13 21:02:51.915:DBUG:oejuc.ContainerLifeCycle:main: org.eclipse.jetty.server.Server@41a4555e added {qtp212628335{STOPPED,8<=0<=200,i=0,q=0},AUTO}
2016-07-13 21:02:51.915:DBUG:oejx.XmlConfiguration:main: XML get ThreadPool
2016-07-13 21:02:51.917:DBUG:oejx.XmlConfiguration:main:
# java -Dorg.eclipse.jetty.LEVEL=DEBUG -jar /Users/afarber/jetty-distribution-9.3.10.v20160621/start.jar jetty.base=/Users/afarber/jetty-base
2016-07-02 16:24:54.864:INFO::main: Logging initialized @487ms
2016-07-02 16:24:54.903:DBUG:oejx.XmlParser:main: parse: file:/Users/afarber/jetty-distribution-9.3.10.v20160621/etc/jetty.xml
2016-07-02 16:24:54.906:DBUG:oejx.XmlParser:main: parsing: sid=file:/Users/afarber/jetty-distribution-9.3.10.v20160621/etc/jetty.xml,pid=null
2016-07-02 16:24:54.916:DBUG:oejx.XmlParser:main: resolveEntity(-//Jetty//Configure//EN, http://www.eclipse.org/jetty/configure_9_3.dtd)
2016-07-02 16:24:54.916:DBUG:oejx.XmlParser:main: Redirected entity http://www.eclipse.org/jetty/configure_9_3.dtd --> jar:file:/Users/afarber/jetty-distribution-9.3.10.v20160621/lib/jetty-xml-9.3.10.v20160621.jar!/org/eclipse/jetty/xml/configure_9_3.dtd
2016-07-02 16:24:54.978:DBUG:oejuc.ContainerLifeCycle:main: org.eclipse.jetty.server.Server@5aaa6d82 added {qtp1993134103{STOPPED,8<=0<=200,i=0,q=0},AUTO}
20
@afarber
afarber / merge.sql
Last active February 27, 2016 18:55
Merge records belonging to same user - without losing payment or punishment information: http://stackoverflow.com/questions/35673982/using-jsonb-array-elements-with-where-in-condition
DROP TABLE IF EXISTS users;
CREATE TABLE users (
uid SERIAL PRIMARY KEY,
paid1_until timestamptz NULL,
paid2_until timestamptz NULL,
banned_until timestamptz NULL,
banned_reason varchar(255) NULL
);
@afarber
afarber / words.sql
Last active October 31, 2016 12:45
DROP TABLE IF EXISTS words_scores;
DROP TABLE IF EXISTS words_chat;
DROP TABLE IF EXISTS words_notes;
DROP TABLE IF EXISTS words_moves;
DROP TABLE IF EXISTS words_games;
DROP TABLE IF EXISTS words_social;
DROP TABLE IF EXISTS words_users;
DROP TABLE IF EXISTS words_nouns;
DROP TABLE IF EXISTS words_verbs;
DROP TABLE IF EXISTS words_values;