Skip to content

Instantly share code, notes, and snippets.

View snivas's full-sized avatar
🦁

Seeni snivas

🦁
View GitHub Profile
# Main script to prune docker repos in JFrog Repository
export PATH=$PATH:/C/jfrog
FILTER_REPO="*" # Include all repos
#FILTER_REPO="REPO1" # Enable to run this script on particular repo in Jfrog
EXCLUDE_BASE_PATH=("Repo2" "Repo3") # Add list of Repos to omit during process
PATH_ARR=$(jfrog.exe rt s "<ROOT_LOCATION>/$FILTER_REPO/*/manifest.json" --recursive=false | jq '.[].path' | xargs dirname | xargs dirname | sort | uniq)
@snivas
snivas / prune-docker-images.sh
Created October 29, 2021 19:18
JFrog Cli script to prune docker repositories and keep latest N images
# JFrog Cli script to prune docker repositories and keep latest 5 images
# This file is called by main.sh script by passing repo name each time
# This script can also be called directly by passing "prune-docker-images.sh <docker-image-repo-name>"
#check if repo name is passed if not exit
[ -f "$1" ] && echo "Path not given " && exit 1
REPO="$1"
TMP_LOC="/tmp/a.json" # path to store values temperorily
LIMIT=4 # Number of images to keep. Latest is not included
@snivas
snivas / flask_app_mutator_class.txt
Created October 31, 2019 17:17
FLASK_APP_MUTATOR Superset example
def attach_handler(app):
from flask import redirect, url_for
app.wsgi_app = CustomProxyFix(app.wsgi_app)
class CustomProxyFix(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
host = environ.get('HTTP_X_FHOST', '')
if host:
@snivas
snivas / flask_app_mutator_class.txt
Created October 31, 2019 17:16
FLASK_APP_MUTATOR Superset example
def attach_handler(app):
from flask import redirect, url_for
app.wsgi_app = CustomProxyFix(app.wsgi_app)
class CustomProxyFix(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
host = environ.get('HTTP_X_FHOST', '')
if host:
def attach_handler(app):
from flask import redirect, url_for
app.wsgi_app = CustomProxyFix(app.wsgi_app)
class CustomProxyFix(object):
def __init__(self, app):
self.app = app
def __call__(self, environ, start_response):
host = environ.get('HTTP_X_FHOST', '')
if host:
@snivas
snivas / pingid_superset.txt
Last active October 31, 2019 16:45
PingFederate oAuth configuration for Apache Superset
OAUTH_PROVIDERS = [
{
'name': 'pingid',
'icon': 'fa-address-card',
'token_key': 'access_token',
'remote_app': {
'consumer_key': 'PINGFEDERATE_OAUTH_KEY',
'consumer_secret': 'PINGFEDERATE_OAUTH_SECRET'
'request_token_params': {
'scope': 'openid email profile'
@snivas
snivas / gist:f291b6e301457ef716ff674682df6762
Created January 29, 2019 19:57
Given an array of ints, return True if the sequence.. 1, 3, 4 .. appears in the array somewhere
def checkseq(nums):
desired = [1, 3, 4]
if str(desired)[1:-1] in str(nums):
return True
return False
list123([1, 1, 3, 4, 5])
#True
list123([1, 2, 4, 3, 5])
#False
@snivas
snivas / basexextendedlogging
Created February 28, 2015 16:04
Logging Script for Xqueries in Basex
module namespace xqlogger = 'urn:sample:xqlogger';
declare variable $xqlogger:LOGDIR as xs:string := "./";
declare variable $xqlogger:LOGFILENAME as xs:string := "a.log";
declare variable $xqlogger:LOGFILESIZE as xs:integer := 100000; (: in bytes :)
declare variable $xqlogger:LOGSTATUSMAP := map {
0 := "INFO",
1 := "WARNING",
2 := "ERROR"