Watch a table for changes and push a notification with a payload describing the change.
In the Postgres shell:
-- Create the functions
version: "3" | |
services: | |
domoticz: | |
image: linuxserver/domoticz:latest | |
container_name: domoticz | |
environment: | |
- PUID=19000 | |
- PGID=19000 | |
- TZ=Europe/Lisbon | |
volumes: |
LD SP,$fffe ; $0000 Setup Stack | |
XOR A ; $0003 Zero the memory from $8000-$9FFF (VRAM) | |
LD HL,$9fff ; $0004 | |
Addr_0007: | |
LD (HL-),A ; $0007 | |
BIT 7,H ; $0008 | |
JR NZ, Addr_0007 ; $000a | |
LD HL,$ff26 ; $000c Setup Audio |
Article: https://github.com/puma/puma/blob/master/docs/systemd.md | |
#1 nano /etc/systemd/system/puma.service | |
#2 paste from puma.service | |
Commands: | |
# After installing or making changes to puma.service | |
systemctl daemon-reload | |
# Enable so it starts on boot | |
systemctl enable puma.service |
Watch a table for changes and push a notification with a payload describing the change.
In the Postgres shell:
-- Create the functions
This document outlines setting up google's ruby gem, google-api-client, to verify payloads(receipts) sent to a server from google play in app purchases made via an android app.
This document was written using version 0.9.13.
First you'll need 'owner' access to the google play developer's console that contains the mobile app you wish to verify receipts from.
Next setup an api account
require 'faye/websocket' | |
require 'eventmachine' | |
require "json" | |
EM.run { | |
ws = Faye::WebSocket::Client.new("wss://certstream.calidog.io") | |
ws.on :message do |event| | |
message = JSON.parse(event.data) | |
all_domains = message.dig("data", "leaf_cert", "all_domains") |
#!/bin/sh | |
sudo docker stop sentry-worker sentry-cron | |
sudo docker stop sentry sentry-smtp sentry-postgres sentry-redis | |
sudo docker rm sentry-worker | |
sudo docker rm sentry-cron | |
sudo docker rm sentry | |
sudo docker rm sentry-smtp | |
sudo docker rm sentry-postgres |
# I'm no benchmark guru. Just did a bunch of: | |
$ time ruby <filename> | |
# Note: This is just an 80mb XML file with 38,000 nodes. | |
ox_dom.rb 4.56s user 0.78s system 93% cpu 5.714 total (550mb) | |
ox_dom.rb 4.58s user 0.79s system 87% cpu 6.126 total (550mb) | |
ox_dom.rb 4.60s user 0.80s system 87% cpu 6.140 total (550mb) | |
nokigiri_dom.rb 11.75s user 1.02s system 94% cpu 13.518 total (895mb) | |
nokigiri_dom.rb 11.36s user 1.02s system 93% cpu 13.211 total (895mb) |
var mongoose = require('mongoose'); | |
var db = mongoose.connect("mongodb://localhost/testdb"); | |
var reconnTimer = null; | |
function tryReconnect() { | |
reconnTimer = null; | |
console.log("try to connect: %d", mongoose.connection.readyState); | |
db = mongoose.connect("mongodb://localhost/testdb"); | |
} |
// Adapted from: http://stackoverflow.com/questions/563198/how-do-you-detect-where-two-line-segments-intersect/1968345#1968345 | |
function line_intersects(p0_x, p0_y, p1_x, p1_y, p2_x, p2_y, p3_x, p3_y) { | |
var s1_x, s1_y, s2_x, s2_y; | |
s1_x = p1_x - p0_x; | |
s1_y = p1_y - p0_y; | |
s2_x = p3_x - p2_x; | |
s2_y = p3_y - p2_y; | |
var s, t; |