Skip to content

Instantly share code, notes, and snippets.

@jjorissen52
jjorissen52 / basic_aiohttp.py
Last active July 29, 2020 20:25
Basic GET/POST bulk operations using asyncio and aiohttop
"""
Basic GET/POST bulk operations using asyncio and aiohttop
Copyright 2020 John-Paul Jorissen
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the Software without restriction, including without
limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
of the Software, and to permit persons to whom the Software is furnished to do so, subject to the
following conditions:
@jjorissen52
jjorissen52 / IAPTunneling.md
Created May 28, 2020 21:48
SSH TCP Tunneling using Google Cloud SDK Identity Aware Proxy Commands

Using ssh Command:

# sudo only necessary to bind to protected port such as 80 or 443
sudo gcloud compute ssh <instance_name> -- -N -L 80:localhost:80

Using start-iap-tunnel Command

# sudo only necessary to bind to protected port such as 80 or 443
sudo gcloud compute start-iap-tunnel  80 --local-host-port=localhost:80
@jjorissen52
jjorissen52 / helpers.py
Last active September 30, 2020 20:14
A CLI tool with some helpers that I use occasionally
#!/usr/bin/env python
import os
import sys
import json as json
import json as _json
import base64
import logging
import functools
import subprocess
@jjorissen52
jjorissen52 / gcr-images-cleanup.sh
Last active October 23, 2019 14:30
Delete all but last 5 images that are not tagged with "latest"
# Copyright 2019 JP Jorissen
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@jjorissen52
jjorissen52 / gcp-terraform-cloudbuilder.tf
Last active October 2, 2023 13:41
Terraform `null_resource` objects to create a gcloud config on your machine and use them to submit cloudbuilders to your project
locals {
gcloud_config_script =<<GCLOUD
# Make a gcloud config for this project locally if there isn't one already.
# if there is one, go ahead and activate.
script_dir=$PWD
configname="${var.project_id_prefix}-${terraform.workspace}"
project_id="${google_project_services.project.project}"
account="${var.gcp_account}"
existing_account=$(gcloud auth list --format="value(account)" --filter="account:$account")
@jjorissen52
jjorissen52 / pubsub-consumer-specs.md
Last active August 29, 2019 17:15
UWU Bot Specs

This should be enough to get you started!

hello_pubsub should take an event object, uwu-ize the data, and print the uwu-d message!

import base64

def hello_pubsub(event, context):
    """Background Cloud Function to be triggered by Pub/Sub.
 Args:

Keybase proof

I hereby claim:

  • I am jjorissen52 on github.
  • I am jjorissen (https://keybase.io/jjorissen) on keybase.
  • I have a public key ASB6Ww6qSARphLT-X7dBsdRawEARNaf6NbtxQNUfov908Ao

To claim this, I am signing this object: