Skip to content

Instantly share code, notes, and snippets.

import boto3
access_key = "YOURACCESSKEYHERE"
secret_key = "YOURSECRETKEYHERE"
bucket = "YOURBUCKETNAMEHERE"
filename = "YOURFILENAME.ova"
full_path = "/path/to/your/file/"
conn = boto3.client('s3', 'us-east-1',
endpoint_url="http://ceph-s3.services.dmtio.net",
## upload config
curl -u admin:${p} -k --form file="@./path/to/cloud-portal-template.xml" "https://${ip}/api/?type=import&category=configuration"
<response status="success"><msg><line>cloud-portal-template.xml saved</line></msg></response>
## load config
curl -u admin:${p} -k "https://${ip}/api/?type=op&cmd=<load><config><from>cloud-portal-template.xml</from></config></load>"
<response status="success"><result><msg><line>Config loaded from cloud-portal-template.xml</line></msg></result></response>
## commit config
curl -u admin:${p} -k "https://${ip}/api/?type=commit&cmd=<commit><force></force></commit>"
@jworl
jworl / boto3_s3_paginate.py
Created February 24, 2021 00:21
boto3 s3 pagination example
/usr/bin/env python3
import boto3
from boto3.session import Session
from io import BytesIO
from sys import argv
pn = argv[1]
bucket = argv[2]
sub_folder_path = argv[3]
'''
Description:
- pivot into other accounts with specified RoleARN
References:
assume_role:
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/sts.html#STS.Client.assume_role
'''
import boto3
import botocore.exceptions
#! /usr/bin/env python3
'''
author: Joshua Worley
'''
import argparse
import json
import requests
import pprint
@jworl
jworl / ipmi_power.sh
Last active September 8, 2022 07:53
Issue reset, power off, or power on for SuperMicro BMC via web interface
#!/usr/bin/env bash
# written by: Joshua Worley
# received great help from DavidWittman here:
# https://gist.github.com/DavidWittman/98281cdf1d32ac795b74
# This version's improvements:
# - allows reset, power on, or power off
# - sanity check conditionals
# - sends pushover alert for notification