Skip to content

Instantly share code, notes, and snippets.


Arik Fraimovich arikfr

View GitHub Profile
arikfr / index.js
Created Mar 10, 2020
Changelog generator
View index.js
const Octokit = require("@octokit/rest");
const createCsvWriter = require("csv-writer").createObjectCsvWriter;
const octokit = new Octokit({
auth: "token " + process.env.GITHUB_TOKEN
async function getCommits(since) {
const options = octokit.repos.listCommits.endpoint.merge({
owner: "getredash",
repo: "redash",
arikfr /
Last active Dec 20, 2019
Trigger refresh of Redash queries based on query tag
from urllib.parse import urljoin
import requests
import click
import json
class Redash:
def __init__(self, host, api_key): = host
self.api_key = api_key
arikfr / get-query-result.js
Created Aug 18, 2019
Query Redash's API for fresh results from Javascript
View get-query-result.js
function sleep(ms) {
return new Promise(resolve => setTimeout(resolve, ms));
async function getQueryResult(slug, queryId, apiKey, options = {}) {
const instance = axios.create({
baseURL: `${slug}`,
headers: {
Authorization: `Key ${apiKey}`
import requests
import os
class Redash(object):
def __init__(self, redash_url, api_key):
self.redash_url = redash_url
self.session = requests.Session()
self.session.headers.update({'Authorization': 'Key {}'.format(api_key)})
def test_credentials(self):
arikfr / example.rb
Last active Mar 15, 2019
Example of for using Redash API in Ruby to update the schedule
View example.rb
require 'httparty'
class Redash
include HTTParty
def initialize(slug, api_key)
@base_uri = "{slug}"
@headers = {
'Authorization': "Key #{api_key}"
arikfr /
Last active Jun 3, 2022
Setting up HTTPS with LetsEncrypt for Redash Docker Deployment
  1. Make sure the domain you picked points at the IP of your Redash server.
  2. Switch to the root user (sudo su).
  3. Create a folder named nginx in /opt/redash.
  4. Create in the nginx folder two additional folders: certs and certs-data.
  5. Create the file /opt/redash/nginx/nginx.conf and place the following in it: (replace with your domain name)
    upstream redash {
        server redash:5000;
#!/bin/env python
import sys
import re
import subprocess
def get_change_log(previous_sha):
args = ['git', '--no-pager', 'log', '--merges', '--grep', 'Merge pull request', '--pretty=format:"%h|%s|%b|%p"', 'master...{}'.format(previous_sha)]
log = subprocess.check_output(args)
changes = []
arikfr / saas_metrics.sql
Last active Feb 20, 2022
SaaS Metrics Query
View saas_metrics.sql
Explanation of what's going on in this query can be found in this blog post:
WITH v_charges AS (
SELECT org_id,
date_trunc('month', start_date) AS month,
coalesce((extra::json->>'amount')::float, (extra::json->>'charged_amount')::integer/100) as total
FROM charges
WHERE extra::json->>'months' = '1'
arikfr /
Created Sep 11, 2017
Redash API usage example
import requests
class Redash(object):
def __init__(self, redash_url, api_key):
self.redash_url = redash_url
if not self.redash_url.endswith('/'):
self.redash_url = '{}/'.format(self.redash_url)
self.auth_headers = {'Authorization': 'Key {}'.format(api_key)}
View dynamodb_readonly.json
"Version": "2012-10-17",
"Statement": [
"Action": [