Skip to content

Instantly share code, notes, and snippets.

# Faster R-CNN with Resnet-101 (v1) configured for the Oxford-IIIT Pet Dataset.
# Users should configure the fine_tune_checkpoint field in the train config as
# well as the label_map_path and input_path fields in the train_input_reader and
# eval_input_reader. Search for "PATH_TO_BE_CONFIGURED" to find the fields that
# should be configured.
model {
faster_rcnn {
num_classes: 37
image_resizer {
@fizz
fizz / learning_schedules.py
Last active April 21, 2019 05:31
learning_schedules.py
# Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@fizz
fizz / docker_aliases.sh
Last active April 21, 2019 05:41
Docker aliases
function dumpenv { docker inspect -f '{{range $index, $value := .Config.Env}}{{println $value}}{{end}}' $1; }
function dumpenv2 { docker inspect -f '{{range $index, $value := .Config.Env}}{{println $value}}{{end}}' $1 > $1.env; }
function ct2sh { docker inspect -f "$(<./run.tpl)" $1 > $1.sh; }
function labels { docker inspect -f '{{range $l, $v := .Config.Labels}} {{printf "%q" $l}}={{printf "%q\n" $v}} {{end}}' $1;}
@fizz
fizz / attributes.rb
Created April 21, 2019 05:48 — forked from lizthegrey/attributes.rb
Hardening SSH with 2fa
default['sshd']['sshd_config']['AuthenticationMethods'] = 'publickey,keyboard-interactive:pam'
default['sshd']['sshd_config']['ChallengeResponseAuthentication'] = 'yes'
default['sshd']['sshd_config']['PasswordAuthentication'] = 'no'
#!/bin/sh
# Get the procs sorted by the number of inotify watchers
#
# From `man find`:
# %h Leading directories of file's name (all but the last element). If the file name contains no slashes (since it
# is in the current directory) the %h specifier expands to `.'.
# %f File's name with any leading directories removed (only the last element).
lines=$(
find /proc/*/fd \
@fizz
fizz / clean_virtualenvs.sh
Last active February 12, 2020 01:16
Uninstall a package from all pyenv virtualenvs that have it installed (e.g. in order to use pipx)
ipython 2>&1 | tail | xargs -IJK -p zsh -c 'eval "$(pyenv init -)" && eval "$(pyenv virtualenv-init -)" && pyenv activate JK && pip uninstall -y ipython'
@fizz
fizz / README.md
Created July 2, 2020 18:23 — forked from ktmud/README.md
Enable Okta Login for Superset

This Gist demonstrates how to enable Okta/OpenID Connect login for Superset (and with slight modifications, other Flask-Appbuilder apps).

All you need to do is to update superset_config.py as following and make sure your Cliend ID (OKTA_KEY) and Secret (OKTA_SECRET) are put into the env.

@fizz
fizz / create-stack.sh
Created November 13, 2020 17:57 — forked from lantrix/create-stack.sh
Find yourself creating the same AWS CFN stack a lot during testing? Wasting too much time repeating tags? Put your tags and params in json files and use this bash wrapper script to create the cloudformation stack. Provide your own template file, and modify the stackParams and stackTags to your own needs.
# Create AWS CFN Stack - wrapper for `aws cloudformation create-stack`
#Example Usage:
[ $# -eq 0 ] && { echo -e "\nUsage `basename $0` <stack name> <CFN template file> <JSON parameters file> <JSON tags file>\n\nExample:\n`basename $0` mystackname MyCfn.template stackParams.json stackTags.json\n"; exit 1; }
#Inputs
stackName=${1?param missing - Stack Name}
templateFile=${2?param missing - Template File}
paramsFile=${3?param missing - Json Parameters file}
tagsFile=${4?param missing - Json Tags file}
@fizz
fizz / script-template.sh
Created December 29, 2020 07:21 — forked from m-radzikowski/script-template.sh
Minimal safe Bash script template - see the article with full description: https://betterdev.blog/minimal-safe-bash-script-template/
#!/usr/bin/env bash
set -Eeuo pipefail
trap cleanup SIGINT SIGTERM ERR EXIT
script_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd -P)
usage() {
cat <<EOF
Usage: $(basename "${BASH_SOURCE[0]}") [-h] [-v] [-f] -p param_value arg1 [arg2...]
@fizz
fizz / update_lambda_env_vars.bash
Last active January 16, 2021 07:55 — forked from monkut/update_awslambda_envars.bash
update aws lambda environment variables via awscli and jq
#!/usr/bin/env bash
# the `update-function-configuration` overwrites the existing set envars.
# In order to *ADD* variables we need to read the existing envars and add to that.
# This command uses `jq` to read and transform the json result to an envar then update the lambda configuration
# create the updated envar set
FUNCTION_NAME=trip-analytics-prod-app
UPDATED=.env.prod
UPDATE=$(jq --raw-input --slurp 'split("\n")[:-1]|map(split("=") as [$key, $value] | {$key, $value}) | from_entries' $UPDATED)