- References
- Dependency
unittest2
aws s3api delete-objects --bucket bucket-name --delete "$(aws s3api list-object-versions --bucket "bucket_name" --output=json --query='{Objects: DeleteMarkers[].{Key:Key,VersionId:VersionId}}')" |
""" | |
Here is a way to flatten python dictionaries for making multipart/form-data POST requests. | |
{"some": ["balls", "toys"], "field": "value", "nested": {"objects": "here"}} | |
-> | |
{"some[0]": "balls", "some[1]": "toys", "field": "value", "nested[objects]": "here"} | |
import boto3 | |
import base64 | |
if __name__ == '__main__': | |
session = boto3.session.Session() | |
kms = session.client('kms') | |
encrypted_password = 'AQECAHjgTiiE7TYRGp5Irf8jQ3HzlaQaHGYgsUJDaavnHcFm0gAAAGswaQYJKoZIhvcNAQcGoFwwWgIBADBVBgkqhkiG9w0BBwEwHgYJYIZIAWUDBAEuMBEEDDwxVQuG0oVwpkU7nQIBEIAoVGk1/wpserb+GVUOzE7PiL/Nr9fTDFKZfpKpF0ip2ct4B2q0Wn6ZZw==' | |
binary_data = base64.b64decode(encrypted_password) |
#!/bin/bash -eo pipefail | |
## Allows for creation of "Basic" DNS records in a Route53 hosted zone | |
function main() { | |
record_name=$1 | |
record_value=$2 | |
[[ -z $record_name ]] && echo "record_name is: $record_name" && exit 1 | |
[[ -z $record_value ]] && echo "record_value is: $record_value" && exit 1 |
[CmdLetBinding()] | |
Param( | |
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)] | |
[String] $HostedZoneId, | |
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)] | |
[ValidateSet("CNAME","A","AAAA","MX","TXT","PTR","SRV","SPF","NS","SOA")] | |
[String] $Type, | |
[Parameter(Mandatory=$true,ValueFromPipeLine=$false,ValueFromPipeLineByPropertyName=$true)] |
# Enable syntax-highlighting in less. | |
# Last tested on CentOS 6.3. | |
# | |
# First, add these two lines to ~/.bashrc | |
# export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s" | |
# export LESS=" -R " | |
sudo yum -y install boost boost-devel ctags | |
wget http://springdale.math.ias.edu/data/puias/unsupported/6/x86_64/source-highlight-3.1.6-3.puias6.x86_64.rpm |
unittest2
# From http://stackoverflow.com/a/11158224 | |
# Solution A - If the script importing the module is in a package | |
from .. import mymodule | |
# Solution B - If the script importing the module is not in a package | |
import os,sys,inspect | |
current_dir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) | |
parent_dir = os.path.dirname(current_dir) | |
sys.path.insert(0, parent_dir) |
import logging | |
import logging.handlers | |
log = logging.getLogger(__name__) | |
log.setLevel(logging.DEBUG) | |
handler = logging.handlers.SysLogHandler(address = '/dev/log') | |
formatter = logging.Formatter('%(module)s.%(funcName)s: %(message)s') |
import { Injectable } from '@angular/core'; | |
import { APP_CONSTANTS } from '@constants/app.constants'; | |
import { Storage } from '@ionic/storage'; | |
@Injectable({ | |
providedIn: 'root' | |
}) | |
export class StorageService { | |
private _storage: Storage | null = null; |