Skip to content

Instantly share code, notes, and snippets.

select t1.query_type,
t1.avg_time as current_avg,
t2.avg_time as previous_avg,
t1.avg_time / t2.avg_time as performance_ratio
from
(select query_type, count(*) as query_count, avg(total_elapsed_time) as avg_time
from table(information_schema.query_history_by_user(
'ct_us_keboola_3292',
{
"AWSTemplateFormatVersion": "2010-09-09",
"Resources": {
"S3FilesBucket": {
"Type": "AWS::S3::Bucket",
"Properties": {
"CorsConfiguration": {
"CorsRules": [
{
"AllowedHeaders": [
{
"parameters": {
"api": {
"baseUrl": "https:\/\/api.intercom.io",
"authentication": {
"type": "basic"
},
"http": {
"defaultOptions": {
"headers": {
{
"authorization": {
"oauth_api": {
"id": "new-template-60"
}
},
"parameters": {
"api": {
"authentication": {
"type": "oauth10"
{
"parameters": {
"api": {
"baseUrl": "http://api.fixer.io/"
},
"config": {
"outputBucket": "currency",
"incrementalOutput": true,
"jobs": [
{
@Halama
Halama / slack-config.json
Created December 1, 2015 08:37
Keboola Generic Extractor - Slack
{
"parameters": {
"api": {
"baseUrl": "https://slack.com/api/"
},
"config": {
"outputBucket": "slack",
"debug": true,
"jobs": [
{
@Halama
Halama / gist:c51fd28eef298d304e9d
Created May 27, 2015 11:42
Elastic search nested filter
POST /activity
{"settings" : {
"number_of_shards" : 1
},
"mappings" : {
"activity" : {
"properties": {
"id": {
"type": "long"
},
React = require 'react'
SearchRow = React.createClass
displayName: 'SearchRow'
propTypes:
query: React.PropTypes.string.isRequired
componentDidMount: ->
@refs.searchInput.getDOMNode().focus()
render: ->

Skripty které pollují frontu a spouštějí joby nespouštíme cronem ale máme nahozený pevně daný počet workerů. O udržování workerů při životě se stará Upstart http://upstart.ubuntu.com/getting-started.html

Konfigurace jobu

Pod rootem vytvořit soubor /etc/init/nazev-jobu.conf s obsahem:

instance $N
respawn
exec su -s /bin/sh -c 'exec "$0" "$@"' deploy -- php /cesta/k/memu-skriptu
<?php
$csvFile = new CsvFile(__DIR__ . '/_data/simple.csv');
$cols = $csvFile->getHeader());
$csvFile->next();
while($csvFile->valid()) {
$row = $csvFile->current();
var_dump($row);