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
# just an example for me to remember | |
import urllib2, base64 | |
username = "testuser" | |
password = "changeme" | |
url = "https://example.com/" | |
request = urllib2.Request(url) | |
b64auth = base64.standard_b64encode("%s:%s" % (username,password)) | |
request.add_header("Authorization", "Basic %s" % b64auth) |
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 shlex, subprocess | |
cmd = 'ls -la' | |
shcmd = shlex.split(cmd) | |
p = subprocess.Popen(cmd) |
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
# just a short example of using optparse | |
import getpass | |
import optparse | |
# def parseCmdArgs(): | |
cmdOpts = optparse.OptionParser(usage = '%prog [options]') | |
cmdOpts.add_option('-i', dest = 'ipaddr', help = 'IP address of CIMC') | |
cmdOpts.add_option('-u', dest = 'user', help = 'Username') | |
cmdOpts.add_option('-p', dest = 'passwd', help = 'Password (Optional. If not provided you will be prompted.)') | |
cmdOpts.add_option('-l', action = 'store_true', dest = 'list', help = 'Just query running firmware.') |
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
--- | |
# ansible code documenting steps to setup ssl certs for 389DS / RHDS | |
- set_fact: | |
dirsrv_root: "/etc/dirsrv/slapd-{{ dirsrv_server_id }}" | |
tags: | |
- dirsrv | |
- dirsrv-ssl | |
- name: certdb password file (temporary) | |
copy: |
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
FROM tiangolo/uwsgi-nginx-flask:python3.6 | |
COPY . /app | |
RUN pip install -r requirements.txt |
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
[uwsgi] | |
module = wsgi | |
master = true | |
processes = 5 | |
socket = mysite.sock | |
chmod-socket = 660 | |
vacuum = true |
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
--- | |
image: 'williamyeh/ansible:centos7' | |
variables: | |
ANSIBLE_ROLES_PATH: './roles/' | |
ANSIBLE_VAULT_PASSWORD_FILE: '/root/.ssh/vault.sh' | |
ANSIBLE_TIMEOUT: 60 # some systems are very slow to establish ssh connection | |
before_script: | |
- "ansible --version" # for verbosity |
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
#!/usr/bin/env python | |
### | |
# This script loads a csv named intake.csv | |
# For the purposes of the demo that file looked like this: | |
# | |
# name,weight,height,breakfast_foods,lunch_foods,diner_foods | |
# jacob,155,6'2","beef,chicken",salad,beef | |
# | |
### |