Skip to content

Instantly share code, notes, and snippets.

@twaddington
twaddington / gcp-migrate-cloud-run-custom-domain.md
Last active July 8, 2024 02:20
Migrate a Cloud Run custom domain to Cloud Load Balancing

Migrate a Cloud Run custom domain to Cloud Load Balancing

This guide was compiled from the following references:

  • [Set up a global external Application Load Balancer with Cloud Run, App Engine, or Cloud Functions][1]
  • [Migrate an App Engine custom domain to Cloud Load Balancing][2]

Create DNS authorization

@twaddington
twaddington / nut.conf
Last active April 22, 2024 06:30
Network UPS Tools (NUT) on Debian
MODE=standalone
@twaddington
twaddington / gist:67eba3288b092960106126081782fd82
Created July 18, 2022 21:45
Publish a Maven dependency (e.g. aar) to your local maven repo

Publish a Maven dependency (e.g. aar) to your local maven repo

$ mvn install:install-file \
    -Dfile=/path/to/file.aar \
    -DpomFile=/path/to/file.pom

// If you don't have a valid pom
$ mvn install:install-file \
 -Dfile=/path/to/file.aar \
@twaddington
twaddington / android-gradle-github-mvn.md
Last active July 18, 2022 21:42
Publishing a package from a file to a private GitHub Maven repository

Publishing a package from a file to a private GitHub Maven repository

Add your credentials to ~/.m2/settings.xml

Where token is your personal access token.

<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
 xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0
@twaddington
twaddington / gist:6ba44e4f8d74f40ab0d973e1af040d9b
Last active June 22, 2022 06:06
mitmproxy with Java and OkHttp

Add cert to Java keystore

sudo keytool -import -trustcacerts -cacerts -storepass changeit -alias mitmproxycert -file ~/.mitmproxy/mitmproxy-ca-cert.pem

Configure OkHttp

@twaddington
twaddington / gist:a6ffbeba9c964aff0257643b3f593c06
Created March 2, 2022 00:22
WeatherFlow Tempest UDP Monitoring
sudo tcpdump -i eth0 -s 0 udp port 50222 -A -v
https://weatherflow.github.io/Tempest/api/udp.html
@twaddington
twaddington / charles-proxy-android.md
Last active November 10, 2024 10:19
How to set up Charles Proxy for the Android Emulator.

Charles Proxy Android

Note: Consider using mitmproxy instead of Charles. There is better, more recent, documentation for using mitmproxy on Android.

Steps

1. Add the Network Security Configuration to your app

@twaddington
twaddington / LICENSE
Last active February 2, 2022 03:57
This code demonstrates a method of signing OkHttp requests with an OAuth access token. An Authenticator is provided to renew an expired token using a refresh token.
Copyright (C) 2017 Tristan Waddington <[email protected]>
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:
The above copyright notice and this permission notice shall be included in
@twaddington
twaddington / gist:c59a8957facf47b81249799a5664b963
Created October 12, 2017 02:19
Loading keystore signing info into Gradle
// Load release signing info from keystore.properties
def keystoreProps = new Properties()
keystoreProps.load(new FileInputStream(rootProject.file('keystore.properties')))
keystoreProps.each { prop ->
if (!project.hasProperty(prop.key)) {
project.ext.set(prop.key, prop.value)
}
}
android {
@twaddington
twaddington / UserAgentInterceptor.java
Created October 12, 2017 02:17
Injects a User-Agent header into outgoing OkHttp requests.
package com.enlighthq.mobile.http;
import android.os.Build;
import java.io.IOException;
import java.util.Locale;
import okhttp3.Interceptor;
import okhttp3.Request;
import okhttp3.Response;