This file contains 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
# | |
# Custom Dockerfile | |
# - based on Alpine linux | |
# - install AzureCLI v2.0 | |
# - install Helm [Kubernetes (more than) package manager] | |
# - install kubectl | |
# Usage: | |
# Build it and push it to the private registry. | |
# Gitlab will use it to interact with Azure Kubernetes and Registry [AKS, ACR] | |
# |
This file contains 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
# check http://kazuar.github.io/scraping-tutorial/ | |
from bs4 import BeautifulSoup | |
import requests | |
from lxml import html | |
def grab_gitlab_runner_token(gl_user, gl_pass): | |
protocol = "http" | |
domain = "gitlab.example.com" | |
login_url = protocol+"://"+domain+"/users/sign_in" |
This file contains 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
#Notice: add your .pem private key in the same path as the Dockerfile | |
# get the private key as on-build argument | |
ARG SSH_KEY_FILE = some-file.pem | |
ARG REPO_USER = some-user | |
ARG PROJECT = some-project | |
ENV REPO_URL = gitlab.example.com | |
#add the private key & set its permissions | |
RUN mkdir /root/.ssh/ | |
COPY ./${SSH_KEY_FILE} /root/.ssh/${SSH_KEY_FILE} |
This file contains 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
running build_clib | |
Traceback (most recent call last): | |
File "<string>", line 1, in <module> | |
File "/tmp/pip-build-oDYnTF/pynacl/setup.py", line 251, in <module> | |
"Programming Language :: Python :: 3.6", | |
File "/usr/lib/python2.7/distutils/core.py", line 151, in setup | |
dist.run_commands() | |
File "/usr/lib/python2.7/distutils/dist.py", line 953, in run_commands | |
self.run_command(cmd) | |
File "/usr/lib/python2.7/distutils/dist.py", line 972, in run_command |
This file contains 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 boto3,requests,json,os,pprint | |
from bs4 import BeautifulSoup | |
tf_github_url = os.environ["target_url"] #"https://github.com/hashicorp/terraform/releases" | |
sns_topic_arn = os.environ["sns_topic_arn"] # eg arn:aws:sns:us-west-2:account-id:Report_terra_version | |
def post_to_SNS(SNS_topic_ARN, msg): | |
client = boto3.client('sns') | |
response = client.publish( |
This file contains 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
# When using a CI server, like Jenkins, in conjunction with github, you may wish to use | |
# multiple deploy keys (github-speak for an rsa key pair that has been assigned to a single | |
# repo, rather than a user) to allow Jenkins to pull code from the github repositories | |
# In the example here, where three repos are used, the idea is to take advantage of ssh's config mechanism | |
# For use with Jenkins, do the following: | |
# login to your CI Server | |
sudo su jenkins | |
cd ~/.ssh/ |
This file contains 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
from time import time, localtime, strftime, sleep, gmtime | |
from AWSsetup import AWS_user_secret_access_key,AWS_user_access_key_id | |
import boto.rds | |
def get_rds_instance_status(RDSconn, rds_instance_name): | |
# Grab the RDS instance status | |
instances = RDSconn.get_all_dbinstances( | |
instance_id = rds_instance_name, | |
) | |
# print instances #debug |
This file contains 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 time,randint,config | |
users = 1000 | |
users_rate = 10 | |
class UserBehavior(TaskSet): | |
wait_secs = config.wait_for_locusts_to_hatch(locusts_num=users, hatch_rate=users_rate) | |
def on_start(self): |
This file contains 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
__author__ = 'wehappyfew' | |
import time | |
from locust import HttpLocust, TaskSet, task | |
class UserBehavior(TaskSet): | |
def on_start(self): | |
# The scenario always starts by executing this function | |
# The way I load-test is creating a scenario function and running it from inside the on_start function. | |
# Notice: Inside the scenario function will reside ALL the steps of the load test. |
This file contains 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
{ | |
"AWSTemplateFormatVersion" : "2010-09-09", | |
"Description" : "uDeploy Agent-Relay-Server", | |
"Parameters" : { | |
"keyName" : { | |
"Description" : "SSH key to enable access on the servers", | |
"Type" : "String", | |
"Default" : "nick-portal" |
NewerOlder