Skip to content

Instantly share code, notes, and snippets.

@Halama
Halama / AESEncryptor.php
Last active December 6, 2018 16:39
AES Encryption with PKCS7 padding in PHP
<?php
/**
* AES Encryption with PKCS7 padding http://en.wikipedia.org/wiki/Padding_(cryptography)#PKCS7
* https://gist.github.com/RiANOl/1077723
* http://php.net/manual/en/function.mcrypt-encrypt.php
* http://stackoverflow.com/questions/7448763/proper-php-mcrypt-encryption-methods
*
* User: martinhalamicek
* Date: 7/8/13
* Time: 3:06 PM
@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 / 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
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": [
@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": [
{
{
"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 / 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