Skip to content

Instantly share code, notes, and snippets.

View JBirdVegas's full-sized avatar
:octocat:

Jon Stanford JBirdVegas

:octocat:
View GitHub Profile
@JBirdVegas
JBirdVegas / dynamic-version-test.txt
Created January 21, 2016 23:49
Url Based versioning from gradle
1.2
@JBirdVegas
JBirdVegas / ThreadPoolWorkHandler.java
Created November 15, 2016 22:01
Example thread pool manager in java
package com.jbirdvegas.testing;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
public class ThreadPoolWorkHandler {
private static final int QUEUE_SIZE = 50;
@JBirdVegas
JBirdVegas / error_from_terraform_0_11.txt
Created November 21, 2017 16:52
ERROR: $ TF_LOG=trace terraform plan
$ TF_LOG=trace terraform plan
2017/11/21 10:50:23 [INFO] Terraform version: 0.11.0 ec9d4f1d0f90e8ec5148f94b6d634eb542a4f0ce+CHANGES
2017/11/21 10:50:23 [INFO] Go runtime version: go1.9
2017/11/21 10:50:23 [INFO] CLI args: []string{"/Users/Jonathan.Stanford/bin/terraform", "plan"}
2017/11/21 10:50:23 [DEBUG] Attempting to open CLI config file: /Users/jonathan.stanford/.terraformrc
2017/11/21 10:50:23 [DEBUG] File doesn't exist, but doesn't need to. Ignoring.
2017/11/21 10:50:23 [INFO] CLI command args: []string{"plan"}
2017/11/21 10:50:23 [INFO] command: empty terraform config, returning nil
2017/11/21 10:50:23 [DEBUG] command: no data state file found for backend config
2017/11/21 10:50:23 [DEBUG] New state was assigned lineage "c46e7369-871e-4fa2-a20b-a6586036d0e9"
@JBirdVegas
JBirdVegas / tf_0_11_error.tf
Created November 21, 2017 16:59
Gist to showcase configuration to trigger error in terraform
resource "null_resource" "write_py" {
triggers {
time = "${timestamp()}"
}
provisioner "local-exec" {
command = <<PYTHON
echo "import json
from concurrent.futures import ThreadPoolExecutor
from time import sleep
@JBirdVegas
JBirdVegas / pinned_request.py
Last active December 13, 2024 08:50
Example of how to perform certificate pinning in python without host or chain validation
import hashlib
import io
import json
import socket
import ssl
from base64 import b64encode
from json import JSONDecodeError
from typing import Any, Dict, Optional
from urllib import parse
@JBirdVegas
JBirdVegas / s3_undelete.py
Created September 14, 2018 05:22
Bulk undelete of versioned s3 objects
#!/usr/bin/env python
import json
from datetime import datetime
from boto3 import Session
BUCKET_NAME = "my-sweet-bucket"
prefix = 'my-sweet-dir'
session = Session(region_name='us-east-1', profile_name='my.sweet.profile.name')
import typing
def safer_execute(method: typing.Callable[[typing.Any, typing.Optional[typing.Dict[str, typing.Any]]], typing.Any],
errors: typing.List[typing.Type[Exception]],
*args, default=None, **kwargs):
try:
return method(*args, **kwargs)
except tuple(errors):
if callable(default):
import time
import netifaces
from scapy import sendrecv
from scapy.layers import l2
_SLEEP_INTERVAL = 5
DEBUG = True
@JBirdVegas
JBirdVegas / Program.cs
Created September 23, 2020 15:24
Certificate pinning example using C#
using System;
using System.IO;
using System.Net;
using System.Net.Security;
using System.Security.Cryptography.X509Certificates;
using System.Text.Json;
namespace CertificatePinningTutorial
{
internal class Program
@JBirdVegas
JBirdVegas / main.rb
Created October 13, 2020 15:41
cert.ist certificate chain pinning example Ruby
#!/usr/bin/env ruby -W0
require 'net/http'
require 'openssl'
require 'json'
require 'digest'
def validate_cert_for_domain(domain)
uri = URI("https://api.cert.ist/#{domain}")
response = Net::HTTP.get(uri)