Skip to content

Instantly share code, notes, and snippets.

Avatar

Immanuel Potter immanuelpotter

View GitHub Profile
View copy-to-icloud.sh
#!/bin/bash
usage() {
echo "$0 [SRC] [DST]"
echo "Example iCloud path: /Users/$(whoami)/Library/Mobile Documents/com~apple~CloudDocs/"
exit 99
}
[[ -z "$1" || -z "$2" ]] && usage
@immanuelpotter
immanuelpotter / export-findings.sh
Last active Dec 16, 2020
aws-securityhub-export-findings
View export-findings.sh
#!/bin/bash
# Reads a list of profile names from a file in the local directory. Example provided.
set -e
# If a profiles.txt file doesn't exist in the current dir, fail.
[[ -f profiles.txt ]] && echo "profiles.txt found, continuing..." || echo "Please provide a profiles.txt with profile names separated by new lines."
@immanuelpotter
immanuelpotter / totp_now.py
Created Sep 15, 2020
Get MFA code for a TOTP String, right now
View totp_now.py
#!/usr/bin/env python
# https://github.com/pyotp/pyotp
import pyotp
import argparse
parser = argparse.ArgumentParser(description='Get the TOTP code, for an MFA string, right now.')
parser.add_argument('mfa_string', metavar='mfa_string', type=str, help='The MFA string to get the current totp code for.')
args = parser.parse_args()
View .zshrc
# If you come from bash you might have to change your $PATH.
# export PATH=$HOME/bin:/usr/local/bin:$PATH
# Path to your oh-my-zsh installation.
export ZSH="/Users/$(whoami)/.oh-my-zsh"
HISTFILE=~/.zsh_history
# Keep history, forever
HISTSIZE=999999999
SAVEHIST=$HISTSIZE
# Set name of the theme to load --- if set to "random", it will
@immanuelpotter
immanuelpotter / azure_sb_read_message.py
Created May 28, 2020
Sending & receiving messages from Azure ServiceBus.
View azure_sb_read_message.py
#!/usr/bin/env python
from azure.servicebus import QueueClient, Message
import sys, os
def main():
if 'SERVICEBUS_CONN_STRING' in os.environ:
connection_string = os.getenv("SERVICEBUS_CONN_STRING")
else:
print("Please provide connection string as envvar: SERVICEBUS_CONN_STRING")
@immanuelpotter
immanuelpotter / token-test.py
Last active Apr 24, 2020
Testing out PAT tokens can hit required endpoints they need to get to in Azure DevOps.
View token-test.py
#!/usr/bin/env python
import requests
import sys
import pprint
import base64
def encode_string(token):
to_encode_string = "Basic:" + token
encoded_str = base64.b64encode(to_encode_string.encode()).decode('utf-8')
@immanuelpotter
immanuelpotter / tpc-h-amazonlinux.sh
Last active Feb 11, 2020
Scripting dataset generation using TPC-H toolset in amazon linux, for a record of how it was done
View tpc-h-amazonlinux.sh
#!/bin/bash
# Ensure an S3 full access role is attached.
# Install TPC-H benchmarking tools on an rpm-based Linux machine, and generate two datasets: 10GB and 40GB of tabular data respectively.
# Create a bucket for storage of the generated data and upload to S3.
# Install tools
sudo yum install -y make git gcc
git clone https://github.com/gregrahn/tpch-kit
View gist:91e22525d21c337f0504a814f17b38aa
### Keybase proof
I hereby claim:
* I am immanuelpotter on github.
* I am immanuelpotter (https://keybase.io/immanuelpotter) on keybase.
* I have a public key ASC6arnPIwraZCSzMt9Cvhvw1RPU-M4Jz3EQB_Ry4jGp3go
To claim this, I am signing this object:
@immanuelpotter
immanuelpotter / schedule-task.ps1
Last active Sep 4, 2019
RAM-free-cloudwatch-custom-metric-powershell
View schedule-task.ps1
$action = New-ScheduledTaskAction -Execute "powershell" -Argument " we -File C:\Users\Administrator\Documents\WindowsPowerShell\write-ram-cw-custom-metric.ps1 -ExecutionPolicy bypass"
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date) -RepetitionInterval (New-TimeSpan -Minutes 1)
Register-ScheduledTask -Action $action -Trigger $trigger -TaskName "CustomRAMCloudWatchMetricWrite" -Description "Logging percentage free memory to CloudWatch for this instance"
View cookie-signer.js