Skip to content

Instantly share code, notes, and snippets.

View iTrauco's full-sized avatar

Christopher Trauco iTrauco

View GitHub Profile
@iTrauco
iTrauco / show_ssl_expire
Created April 1, 2022 04:34 — forked from bmatthewshea/show_ssl_expire
Retrieve/Check SSL certificate expiration date(s)
#!/bin/bash
# By B Shea Dec2018 & Mar2020
# https://www.holylinux.net
# Test for OpenSSL - if not installed stop here.
if ! [[ -x $(which openssl) ]]; then
printf "\nOpenSSL not found or not executable.\nPlease install OpenSSL before proceeding.\n\n"
exit 1
fi
@iTrauco
iTrauco / jks-certificate-expiry-checker.sh
Created April 1, 2022 04:37 — forked from zatarra/jks-certificate-expiry-checker.sh
Small script to check the expiry of all the certificates inside a java keystore.
#!/bin/sh
########################################################
#
# Check certificates inside a java keystore
#
########################################################
TIMEOUT="timeout -k 10s 5s "
KEYTOOL="$TIMEOUT keytool"
THRESHOLD_IN_DAYS="30"
@iTrauco
iTrauco / aws-console
Created April 8, 2022 02:28 — forked from ottokruse/aws-console
Python script to launch the AWS console in your webbrowser, using a presigned URL generated from your AWS CLI credentials
#!/usr/bin/env python3
"""
Usage:
- Save this script somewhere on your path (e.g. `vi /usr/local/bin/aws-console && chmod +x /usr/local/bin/aws-console`)
- Make AWS credentials available in one of the usual places where boto3 can find them (~/.aws/credentials, env var, etc.)
- Excute the script: `aws-console --profile myprofile`
- :tada: Your browser opens and you are signed in into the AWS console
"""
@iTrauco
iTrauco / get_aws_profile_keys.py
Created April 8, 2022 02:29 — forked from kmcquade/get_aws_profile_keys.py
Simple python script to grab profile-specific keys from aws credentials file for environment variables export
#!/usr/bin/python2.7
import ConfigParser
import os
import sys
from os.path import expanduser
config = ConfigParser.RawConfigParser()
# credentials_file: The file where this script will grab the temp creds
credentials_file = '/.aws/credentials'
@iTrauco
iTrauco / console.py
Created April 8, 2022 02:30 — forked from weavenet/console.py
Python script to assume STS role and generate AWS console URL.
#!/usr/bin/env python
import getpass
import json
import requests
import sys
import urllib
import boto3
@iTrauco
iTrauco / credentials.py
Created April 8, 2022 02:30 — forked from fiunchinho/credentials.py
Python script to fetch AWS access key and secret key from a running EC2 instance
from botocore.credentials import InstanceMetadataProvider, InstanceMetadataFetcher
provider = InstanceMetadataProvider(iam_role_fetcher=InstanceMetadataFetcher(timeout=1000, num_attempts=2))
credentials = provider.load()
access_key = credentials.access_key
secret_key = credentials.secret_key
print access_key
print secret_key
@iTrauco
iTrauco / gcp-roles.js
Created August 11, 2022 01:02 — forked from Code-Hex/gcp-roles.js
Get GCP IAM Roles
const cheerio = require('cheerio');
const fetch = require('node-fetch');
const fs = require('fs');
// roles["roles/accesscontextmanager.policyAdmin"]["en"]
const roles = {};
async function makePredefinedRoles(locale) {
const response = await fetch(
`https://cloud.google.com/iam/docs/understanding-roles?hl=${locale}`
@iTrauco
iTrauco / query-strings_demo.ipynb
Created October 1, 2022 02:44 — forked from fomightez/query-strings_demo.ipynb
passing full URL to Python via query string demonstrated via mybinder.org
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@iTrauco
iTrauco / exportSpreadsheet.gs
Created October 6, 2022 02:46 — forked from Spencer-Easton/exportSpreadsheet.gs
Example on how to export a Google sheet to various formats, includes most PDF options
function exportSpreadsheet() {
//All requests must include id in the path and a format parameter
//https://docs.google.com/spreadsheets/d/{SpreadsheetId}/export
//FORMATS WITH NO ADDITIONAL OPTIONS
//format=xlsx //excel
//format=ods //Open Document Spreadsheet
//format=zip //html zipped
@iTrauco
iTrauco / export-to-csv.gs
Created November 1, 2022 04:05 — forked from mderazon/export-to-csv.gs
Google apps script to export to individual csv files all sheets in an open spreadsheet
/*
* script to export data in all sheets in the current spreadsheet as individual csv files
* files will be named according to the name of the sheet
* author: Michael Derazon
*/
function onOpen() {
var ss = SpreadsheetApp.getActiveSpreadsheet();
var csvMenuEntries = [{name: "export as csv files", functionName: "saveAsCSV"}];
ss.addMenu("csv", csvMenuEntries);