Skip to content

Instantly share code, notes, and snippets.

@brysontyrrell
brysontyrrell / Install_Python_Ubuntu.sh
Last active June 30, 2017 02:54
Install Python from source on Ubuntu Linux
#!/bin/bash
# This script will install specific versions of Python on Ubuntu Linux servers
if [ "$(whoami)" != "root" ]; then
echo "WARNING: You must run this script as 'root'"
# This shortcut method will fail if the script file does not have execute permissions
exec sudo -- "$0" "$@"
fi
inputVersion=$1
if [[ $inputVersion == "" ]]; then
import base64
import getpass
import sys
import xml.etree.ElementTree as Et
import urllib
import urllib2
reload(sys)
sys.setdefaultencoding('utf-8')
@brysontyrrell
brysontyrrell / JamfUAPIAuthToken.py
Created October 19, 2016 17:52
Generate a token for the Jamf Universal API (UAPI) that will auto-refresh as needed.
import datetime
import logging
import requests
import urlparse
class JamfUAPIAuthToken(object):
def __init__(self, jamf_url, username, password):
"""
:param jamf_url: Jamf Pro URL
:type jamf_url: str
@brysontyrrell
brysontyrrell / cipher.py
Last active April 17, 2023 17:52
AES256 encryption using pyca/cryptography
import base64
import os
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
from cryptography.hazmat.backends import default_backend
class AESCipher(object):
block_size = algorithms.AES.block_size / 8
@brysontyrrell
brysontyrrell / create_jss_account.py
Last active November 21, 2023 23:00
Create a JSS admin account
import getpass
import sys
import xml.etree.ElementTree as Et
import requests
try:
NEW_USERNAME = sys.argv[1]
except IndexError:
print('No username provided!')
# Run from a directory that contains your ROOT.war file.
# Change VERSION to that of the ROOT.war being deployed
VERSION=10.17.0
docker build . -t jamfpro:${VERSION} -f - <<EOF
FROM jamfdevops/jamfpro:0.0.10
ADD ROOT.war /data/
EOF
@brysontyrrell
brysontyrrell / jamfpro-docker-compose.yml
Created November 25, 2019 14:16
A Docker Compose file for launching Jamf Pro
version: "3"
services:
mysql:
image: "mysql:5.7"
networks:
- jamfnet
ports:
- "3306:3306"
environment:
MYSQL_ROOT_PASSWORD: "jamfsw03"
@brysontyrrell
brysontyrrell / jamfpro-template.yaml
Last active March 26, 2022 21:52
Deploy Jamf Pro using Fargate and Aurora Serverless (non production)
AWSTemplateFormatVersion: 2010-09-09
Parameters:
AvailabilityZone1:
Type: String
Default: a
AvailabilityZone2:
Type: String
@brysontyrrell
brysontyrrell / ami-lookup.yaml
Created November 30, 2019 21:04
A CloudFormation custom resource to perform the lookup of the latest NAT instance AMI ID for the region.
AWSTemplateFormatVersion: 2010-09-09
Transform: AWS::Serverless-2016-10-31
Resources:
NatInstaceAmi:
Type: AWS::CloudFormation::CustomResource
Properties:
ServiceToken: !GetAtt NatInstanceAmiLookup.Arn
from datetime import datetime
import json
import os
import boto3
EVENT_BUS = os.getenv("EVENT_BUS")
events_client = boto3.client("events")