Backup Jenkins configuration XML files.
Python 2.7 and pip are required.
$ virtualenv --distribute $HOME/pyvenv/jenkins-backup
| from time import sleep | |
| from tornado.httpserver import HTTPServer | |
| from tornado.ioloop import IOLoop | |
| from tornado.web import Application, asynchronous, RequestHandler | |
| from multiprocessing.pool import ThreadPool | |
| _workers = ThreadPool(10) | |
| def run_background(func, callback, args=(), kwds={}): | |
| def _callback(result): |
| #!flask/bin/python | |
| from flask import Flask, jsonify, abort, request, make_response, url_for | |
| from flask_httpauth import HTTPBasicAuth | |
| app = Flask(__name__, static_url_path = "") | |
| auth = HTTPBasicAuth() | |
| @auth.get_password | |
| def get_password(username): | |
| if username == 'miguel': |
| from collections import defaultdict | |
| import boto3 | |
| """ | |
| A tool for retrieving basic information from the running EC2 instances. | |
| """ | |
| # Connect to EC2 | |
| ec2 = boto3.resource('ec2') |
| import sys,os | |
| import curses | |
| def draw_menu(stdscr): | |
| k = 0 | |
| cursor_x = 0 | |
| cursor_y = 0 | |
| # Clear and refresh the screen for a blank canvas | |
| stdscr.clear() |
| bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' localhost:9000)" != "200" ]]; do sleep 5; done' | |
| # also check https://gist.github.com/rgl/c2ba64b7e2a5a04d1eb65983995dce76 |
| # Example: | |
| # $ python argparse_dict_argument.py --env a=b --env aa=bb | |
| # Namespace(env={'a': 'b', 'aa': 'bb'}) | |
| import argparse | |
| parser = argparse.ArgumentParser() | |
| parser.add_argument('--env', action = type('', (argparse.Action, ), dict(__call__ = lambda a, p, n, v, o: getattr(n, a.dest).update(dict([v.split('=')])))), default = {}) # anonymously subclassing argparse.Action | |
| print(parser.parse_args()) |
| #!/usr/bin/python | |
| import socket #for sockets | |
| import sys #for exit | |
| try: | |
| #create an AF_INET, STREAM socket (TCP) | |
| s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) | |
| except socket.error, msg: | |
| print 'Failed to create socket. Error code: ' + str(msg[0]) + ' , Error message : ' + msg[1] |
curl --proxy http://127.0.0.1:<tinyproxy-port> https://httpbin.org/ip. And I don't use any user authentication for proxy, so I locked down the firewall rules with my laptop IP/32.HTTPS_PROXY=<bastion-external-ip>:<tinyproxy-port> KUBECONFIG=my-kubeconfig kubectl get nodes
| {{- range .Values.zones }} | |
| --- | |
| apiVersion: crd.k8s.amazonaws.com/v1alpha1 | |
| kind: ENIConfig | |
| metadata: | |
| name: {{ .name }} | |
| spec: | |
| subnet: {{ .subnetID }} | |
| securityGroups: | |
| {{- range $.Values.securityGroupIDs }} |