This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import contextlib | |
import questionary | |
import os | |
from interactive_ssh import interactive_shell | |
class ConfirmAddPolicy(paramiko.client.MissingHostKeyPolicy): | |
""" | |
Policy for confirming the user if they want to add the hostname and new host key to the |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- coding: utf-8 -*- | |
"""Quart request argument parsing module. | |
Example: :: | |
from quart import Quart | |
from webargs import fields | |
from webargs.quartparser import use_args |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Configures AWS CLI config with the MFA session token. | |
Recommended usage: | |
* Set 'MFA_ARN' env variable | |
* Run `python aws_mfa.py`. Script will prompt you for the mfa code. | |
''' | |
import boto3 | |
import click |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- id: rule1 | |
match: | |
url: <.*>/api/auth/users | |
methods: ["GET"] | |
authenticators: | |
- handler: noop | |
authorizer: | |
handler: allow | |
mutators: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Adds the pug-loader inside Angular CLI's webpack config, if not there yet. | |
* @see https://github.com/danguilherme/ng-cli-pug-loader | |
*/ | |
const fs = require('fs'); | |
const commonCliConfig = 'node_modules/@angular-devkit/build-angular/src/angular-cli-files/models/webpack-configs/common.js'; | |
const pugImport = 'const PugNgPlugin = require("pug-plugin-ng");'; | |
const pugRule = '{ test: /.pug$/, use: [ { loader: "html-loader" }, { loader: "pug-html-loader", options: {doctype: "html", plugins: PugNgPlugin} } ] },'; | |
fs.readFile(commonCliConfig, (err, data) => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def uint(i): | |
return 0xffffffff & i | |
def IP2Int(ip): | |
o = map(int, ip.split('.')) | |
res = (16777216 * o[0]) + (65536 * o[1]) + (256 * o[2]) + o[3] | |
return res | |
def Int2IP(ipnum): |