Skip to content

Instantly share code, notes, and snippets.

@yershalom
yershalom / cassandra.py
Created August 15, 2016 08:15
Cassandra DS for redash
import sys
import logging
from redash.query_runner import *
logger = logging.getLogger(__name__)
class Cassandra(BaseQueryRunner):
@classmethod
def configuration_schema(cls):
@classmethod
def groups_name(cls, email):
t = db.session.query(F.unnest(cls.group_ids)).filter(cls.email == email)
print "New Q is coming !!!! {}".format(t)
print "!!!!!!!!!!!!!!!!!! {} !!!!!!!!".format(cls.group_ids)
return list([g.name for g in Group.query.filter(Group.id.in_(cls.query(t)))])
@yershalom
yershalom / get_commit_count.py
Created December 17, 2017 13:19
Easy way to calculate commits count from the github api
import requests
base_url = 'https://api.github.com'
def get_all_commits_count(owner, repo, sha):
first_commit = get_first_commit(owner, repo)
compare_url = '{}/repos/{}/{}/compare/{}...{}'.format(base_url, owner, repo, first_commit, sha)
commit_req = requests.get(compare_url)
@yershalom
yershalom / .nvmrc
Created December 18, 2017 08:20
nvmrc file for lazy
8.9.1
getNumOfCommitsOnBranchAfterDiverged() {
const numOfCommitsHere = exec.execRead(`git log --oneline HEAD | wc -l`);
const numOfCommitsInMasterBeforeDiverged = this.getNumOfCommitsOnMasterBeforeDiverged();
return numOfCommitsHere - numOfCommitsInMasterBeforeDiverged;
}
getNumOfCommitsOnMasterBeforeDiverged() {
let mergeBase;
try {
exec.execSyncSilent(`git fetch -q | true`);
mergeBase = exec.execRead(`git merge-base HEAD origin/master`);
} catch (ex) {
mergeBase = exec.execRead(`git merge-base HEAD master`);
}
const numOfCommits = exec.execRead(`git log --oneline ${mergeBase} | wc -l`);
import React, { Component } from 'react'
import WordArt from 'react-wordart'
class Example extends Component {
render () {
return (
<WordArt text='I Love WordArt' theme={`rainbow`} fontSize={100} />
)
}
pipeline {
agent {
node {
label 'master'
}
}
stages {
stage('android') {
steps {
pipeline {
agent {
node {
label 'master'
}
}
stages {
stage('android') {
steps {
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac