Skip to content

Instantly share code, notes, and snippets.

@Halama
Halama / sapi-upload.java
Created February 4, 2014 10:00
Example of CSV file import into Keboola Storage API table in Java
package javaapplication1;
import java.io.*;
import java.net.*;
import org.apache.http.Header;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
@Halama
Halama / node.json
Last active August 29, 2015 13:55
Elasticsearch - devel
{
"run_list": [ "recipe[java]",
"recipe[monit]",
"recipe[elasticsearch]",
"recipe[elasticsearch::plugins]",
"recipe[elasticsearch::monit]" ],
"java": {
"install_flavor": "openjdk",
"jdk_version": "7"
@Halama
Halama / example.sh
Last active December 27, 2015 09:09
Storage Import using Storage API Cli
# download latest version of Storage API Command line client
wget https://s3.amazonaws.com/keboola-storage-api-cli/builds/sapi-client.phar
# import table into Storage API asynchronously
php sapi-client.phar write-table --token=your_token in.c-main.users ./data.csv.gz
@Halama
Halama / 0_reuse_code.js
Created October 18, 2013 11:58
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@Halama
Halama / kibana-sapi-dashboard.json
Last active December 24, 2015 23:48
ES Kibana SAPI
{
"title": "SAPI",
"services": {
"query": {
"idQueue": [
1,
2,
3,
4
],
<?php
/**
* Storage API table write example
*/
$client = new \Keboola\StorageApi\Client('your_token');
$csvFile = new Keboola\Csv\CsvFile(__DIR__ . '/my-file.csv.gz', ',', '"');
$client->writeTableAsync('in.c-main.my-table', $csvFile);
@Halama
Halama / keboolahelper.py
Created July 17, 2013 11:21
Keboola Storage API Python wrapper
"""This module is intended to help interactions
with Goodata Keboola storage.
It creates and performs requests and parse response back
to handler which called it.
"""
import json
import logging as log
import time
@Halama
Halama / sapi.py
Last active July 12, 2017 07:22
Keboola Storage API Python client example
import json
import os
import requests
class HttpHelper:
server = "https://connection.keboola.com/v2/"
def __init__(self,token):
self.token = token
def tokenheader(self):
return {'X-StorageApi-Token':self.token}
@Halama
Halama / AESEncryptor.php
Created July 15, 2013 09:15
AES encryption using mcrypt advanced API
<?php
/**
* AES Encryption in CBC mode with PKCS7 padding
*
* User: martinhalamicek
* Date: 7/8/13
* Time: 3:06 PM
*/
namespace Keboola\Encryption;
@Halama
Halama / AESEncryptor.php
Created July 15, 2013 09:14
AES ecryption using mcrypt simple API
<?php
/**
* AES Encryption in CBC mode with PKCS7 padding
*
* User: martinhalamicek
* Date: 7/8/13
* Time: 3:06 PM
*/
namespace Keboola\Encryption;