Skip to content

Instantly share code, notes, and snippets.

View marknca's full-sized avatar

Mark marknca

View GitHub Profile
@marknca
marknca / install-build-env.sh
Last active January 14, 2016 05:43
Python extension build environment for AWS Lambda
#! /usr/bin/env bash
# Install the required libraries for a Python build environment on Amazon Linux
# Note, you only really need lines #6 & 7, the rest of the lines install
# pre-requisities for the SciPy stack
yum -y update
yum -y groupinstall "Development Tools"
yum -y install Cython --enablerepo=epel
@marknca
marknca / create-iam-cloudaccount.sh
Created August 31, 2016 14:28
Automate connecting Deep Security to an AWS account
#!/bin/bash
# create-iam-cloudaccount dsmuser dsmFQDNorIP connectorName newAwsUserToCreate (TenantID if needed)
if [[ $1 == *"help"* ]]
then
echo -e "## usage:\n## create-iam-cloudaccount <managerUsername> <managerUrl:port> Amazon <newAwsUserToCreate>\n"
echo -e "## example to create User and Cloud account on a DeepSecurity Manager:\n"
echo -e "## create-iam-cloudaccount administrator dsm.example.local:443 Amazon DsmSyncUser"
echo -e "## example to create User and Cloud account in DSaaS\n"
echo -e "## create-iam-cloudaccount administrator app.deepsecurity.trendmicro.com:443 DsmSyncUser CustomerTenant\n"
exit 0
@marknca
marknca / manage_access_and_secret_keys_in_iam.json
Created September 6, 2016 17:29
Allow an IAM AWS user to manage other AWS IAM user's access/secret keys
{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"iam:ListUsers",
"iam:CreateAccessKey",
"iam:DeleteAccessKey",
"iam:GetAccessKeyLastUsed",
@marknca
marknca / yahoo-sites.md
Last active September 24, 2016 12:12
List of Sites Run by Yahoo!
@marknca
marknca / setup_opengraphiti_mac.sh
Last active November 28, 2016 17:53
Setup the OpenGraphiti project on a Mac
#! /usr/bin/env bash
# Setup a new Mac
DEVPATH="$HOME/dev/"
# Homebrew
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew doctor
brew update
@marknca
marknca / summary.md
Last active March 9, 2017 17:17
Annual cost of time wasted waiting for City of Ottawa recreation registration

After scraping the 2016/2017 recreation guides for all availablesession codes, the following assumptions were made;

  • sessions average 10 spaces
  • 35% of all sessions are booked in the initial rush period on registration nights (4x per year)
  • 3 spaces are taken for each person waiting to register
  • average wait time is 35 minutes
  • average hourly wage is $26.57 (based on median household income of $102,020 and 2 wage earners in the household)

Therefore we get...

@marknca
marknca / Links.md
Last active December 7, 2017 16:13
AWS re:Invent re:View, 2017 Edition
@marknca
marknca / .bash_profile
Last active July 7, 2018 12:05
Mac bash personal configuration
# Config var
USERNAME=__CHANGE_THIS__
# Path
export PATH=$PATH:/Users/$USERNAME/bin:/usr/local/go/bin:/usr/local/bin:$PATH
# Env
export EDITOR=subl
# Prompt
@marknca
marknca / test-dsm.py
Created September 13, 2018 16:57
Why can't I log into the Deep Security Manager via the API?
import deepsecurity # from https://github.com/deep-security/deep-security-py
import logging
# if testing a tenant login
mgr = deepsecurity.dsm.Manager(username=YOUR_USERNAME, password=YOUR_PASSWORD, tenant=YOUR_TENANT_NAME) # will call the API authenticateTenant
# or
# if testing the primary tenant
mgr = deepsecurity.dsm.Manager(username=YOUR_USERNAME, password=YOUR_PASSWORD) # if "tenant" argument ISN'T sent, it calls a different API call "authenticate"
mgr.log_at_level = logging.DEBUG
mgr.sign_in()