Skip to content

Instantly share code, notes, and snippets.

View AlainODea's full-sized avatar

Alain O'Dea AlainODea

View GitHub Profile
@AlainODea
AlainODea / alienvault.py
Created July 23, 2020 23:44
Example of connecting to AlienVault API using Python Requests 2 and Requests-OAuthlib
import json
from requests.auth import HTTPBasicAuth
from oauthlib.oauth2 import BackendApplicationClient
from requests_oauthlib import OAuth2Session
from getpass import getpass
domain = "alienvault.cloud"
subdomain = "example" # use your actual subdomain
@AlainODea
AlainODea / README.md
Last active June 15, 2020 18:15
Allowing Microsoft Update through a transparent Squid TLS proxy

Allowing Microsoft Update through a transparent Squid TLS proxy

Using Squid and getting TAG_NONE on sls.update.microsoft.com and several other domains?

Root Cause

The problem is certificate related. These domains use Microsoft Root Certificate Authority 2011 which is not publicly trusted. It is trusted by Windows, but not in general.

Remedy

@AlainODea
AlainODea / legal_fargate_configurations.md
Last active May 13, 2020 13:31
No Fargate configuration exists for given values
@AlainODea
AlainODea / Dockerfile
Created April 8, 2020 18:58
Circle CI multi-version Terraform Dockerfile with Gruntwork tools (you need a Gruntwork subscription to use them)
# The CircleCi builds will run in the Docker image built from this Dockerfile. To build a new image:
#
# 1. docker build -t <ACCOUNT_ID>.dkr.ecr.ca-central-1.amazonaws.com/circle-ci-build:<VERSION> --build-arg GITHUB_OAUTH_TOKEN=<YOUR_TOKEN> .
# 2. eval "$(aws ecr get-login --region ca-central-1 --no-include-email)"
# 3. docker push <ACCOUNT_ID>.dkr.ecr.ca-central-1.amazonaws.com/circle-ci-build:<VERSION>
# 4. Update the image setting in config.yml to your new VERSION.
#
# Note that we use a multi-stage build. This allows us to pass in the GITHUB_OAUTH_TOKEN secret (which we use to access
# the private gruntwork-io repos) as a build arg without it being stored in the build history. For more info, see:
#
@AlainODea
AlainODea / splunkforwarder-manifest.xml
Last active February 10, 2020 15:57
Splunk Forwarder SMF Manifest
<?xml version='1.0'?>
<!DOCTYPE service_bundle SYSTEM '/usr/share/lib/xml/dtd/service_bundle.dtd.1'>
<service_bundle type='manifest' name='export'>
<service name='site/splunkforwarder' type='service' version='0'>
<create_default_instance enabled='true'/>
<single_instance/>
<dependency name='fs-local' grouping='require_all' restart_on='none' type='service'>
<service_fmri value='svc:/system/filesystem/local'/>
</dependency>
<dependency name='splunk_multi-user' grouping='require_all' restart_on='none' type='service'>
@AlainODea
AlainODea / lambda_function.py
Created October 30, 2019 18:52
Providing encrypted environment variables to a Lambda decrypted on boot
from lib.secret_config import load_secret_config_from_env
def lambda_handler(event, context):
"""
The Handler function, which receives the lambda event and orchestrates the
response. It is called and passed args by Lambda.
Args:
event: The lambda event, which includes arguments from API Gateway.
context: Info about the execution context of the lambda.
"""
@AlainODea
AlainODea / GetURL.java
Last active February 3, 2019 05:39
Java Proxy Verfication - Simple URL Loader with no dependencies outside JavaSE
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.net.URL;
public class GetURL
{
public static void main(String[] args) throws Exception
@AlainODea
AlainODea / bootstrap.sh
Last active January 26, 2019 17:34
WIP: SmartOS installing Haskell Cabal 1.16.1.0 (look at install_cabal.sh)
#!/bin/sh
set -o xtrace
# A script to bootstrap cabal-install.
# It works by downloading and installing the Cabal, zlib and
# HTTP packages. It then installs cabal-install itself.
# It expects to be run inside the cabal-install directory.
# install settings, you can override these by setting environment vars
@AlainODea
AlainODea / w.tf
Created December 18, 2018 18:24
A Terraform module that cannot be constructed (Error: module "WTF": missing required argument "version")
variable "version" {}
@AlainODea
AlainODea / WhatIsMyProxy.java
Created September 11, 2013 14:18
Java Proxy Verification - Output current proxy in use for a supplied URL (if any) with no dependencies outside JavaSE
import java.net.Proxy;
import java.net.ProxySelector;
import java.net.URI;
public class WhatIsMyProxy
{
public static void main(String[] args)
{
String website = args[0];
Proxy proxy = ProxySelector.getDefault().select(URI.create(website)).iterator().next();