Skip to content

Instantly share code, notes, and snippets.

@uded
uded / cronitor.sh
Created January 14, 2018 18:34 — forked from AnthonySheetz/cronitor.sh
Cronitor wrapper script for start/stop notifications, now with proper encoding of stderror and optional dumping of stdout
#!/bin/bash
#
# This script surrounds the command passed in with start and finish notifications
# to the cronitor monitoring application.
#
# === SETUP
#
# * Make sure the cronitor script is executable.
#
# chmod +x cronitor
@uded
uded / EmbeddedKafkaCluster.java
Created March 3, 2017 10:24 — forked from vmarcinko/EmbeddedKafkaCluster.java
Embedded Zookeeper & Kafka cluster
import kafka.server.KafkaConfig;
import kafka.server.KafkaServer;
import java.io.File;
import java.io.FileNotFoundException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Properties;
[
{
"productId": "8d5b0391-3990-4f5f-b856-1a5c2bdce464",
"sku": "831-46-2908-pink-xs",
"amount": 1,
"reason": "ORDERED_MISTAKE"
}
]
SELECT
DATE_FORMAT(date_value, '{{ groupby }}') AS date_value,
SUM(values) AS sum
FROM
table
GROUP BY
date_value
@uded
uded / AdoPivotReportType.php
Last active December 22, 2015 08:48
The last iteration, `while ($row = $result->FetchRow()) {` does include an option to use associative arrays to manage a multi select list with both display and value or a non-associative array for just values which will be used to as text display in the select widget.
<?
public static function getVariableOptions($params, &$report) {
$report->conn->SetFetchMode(ADODB_FETCH_NUM);
$query = 'SELECT DISTINCT '.$params['column'].' FROM '.$params['table'];
if(isset($params['where'])) {
$query .= ' WHERE '.$params['where'];
}
$macros = $report->macros;