Skip to content

Instantly share code, notes, and snippets.

View bortels's full-sized avatar

Tom Bortels bortels

View GitHub Profile
@bortels
bortels / chrome-cache-recovery.js
Last active September 19, 2015 20:19 — forked from whatnickcodes/chrome-cache-recovery.js
Quick and dirty script to recover images from chrome cache. Just paste this into your console to automatically download all Scotch.io cached images
// Open chrome://cache/ and paste the following script in the console. Feel free to edit the filter variable
var filter = /cask\.scotch\.io(.)*\.(jpg|jpeg|png|gif)/g;
/*! jQuery v2.1.4 | (c) 2005, 2015 jQuery Foundation, Inc. | jquery.org/license */
!function(a,b){"object"==typeof module&&"object"==typeof module.exports?module.exports=a.document?b(a,!0):function(a){if(!a.document)throw new Error("jQuery requires a window with a document");return b(a)}:b(a)}("undefined"!=typeof window?window:this,function(a,b){var c=[],d=c.slice,e=c.concat,f=c.push,g=c.indexOf,h={},i=h.toString,j=h.hasOwnProperty,k={},l=a.document,m="2.1.4",n=function(a,b){return new n.fn.init(a,b)},o=/^[\s\uFEFF\xA0]+|[\s\uFEFF\xA0]+$/g,p=/^-ms-/,q=/-([\da-z])/gi,r=function(a,b){return b.toUpperCase()};n.fn=n.prototype={jquery:m,constructor:n,selector:"",length:0,toArray:function(){return d.call(this)},get:function(a){return null!=a?0>a?this[a+this.length]:this[a]:d.call(this)},pushStack:function(a){var b=n.merge(this.constructor(),a);retu
@bortels
bortels / ad_to_json
Last active December 17, 2016 04:31
take ldapsearch output and save big json blob
#!/usr/bin/env ruby
# Save all AD objects in a big json blob you can mess around with
require 'json'
require 'Open3'
require 'pry'
# replace below with correct AD server, baseDN, and bind account DN and password
cmd = "ldapsearch -E pr=1000/noprompt -xLLL " +

Keybase proof

I hereby claim:

  • I am bortels on github.
  • I am bortels (https://keybase.io/bortels) on keybase.
  • I have a public key ASCeqIowRbUyNLDgN8_8rLFq3SvWbylbnVrd6j1d83q4bQo

To claim this, I am signing this object:

#!/usr/bin/env python3
# export the AWS environment for a given profile
import boto3
import argparse
parser = argparse.ArgumentParser(prog="exportaws",
description="Extract AWS credentials for a profile as env variables.")
parser.add_argument("profile", help="profile name in ~/.aws/config.")
#!/usr/bin/env python3
"""Update pod inventory pages"""
import requests
from requests.auth import HTTPBasicAuth
import json
from pprint import pprint
import datetime
import gzip
@bortels
bortels / gist:1f047f3e7877d5566988492d69171f30
Created May 20, 2019 17:50
Session policies explained
Create fine-grained session permissions using AWS Identity and Access Management (IAM) managed policies -
I've read this three times and I still don't understand what it does. Help?
Sure, I'd be happy to help you with that.
You use AWS STS (Simple Token Service) to assume a role and it's associated policies. So - you might call STS to assume
a role with "AdministratorAccess" policy in another account.
When you do this, you have an option to also add a "session role" on the fly - think of it as an addendum to the role.
Example, you might assume that "AdministratorAccess" role, but add in "No IAM access, please". This is handy because it

Keybase proof

I hereby claim:

  • I am bortels on github.
  • I am tbortels (https://keybase.io/tbortels) on keybase.
  • I have a public key ASAUnHiD-G0g6ue8r_9avYDaMu6idftEYxq08_XH5gWl-wo

To claim this, I am signing this object: