Skip to content

Instantly share code, notes, and snippets.

@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 April 20, 2024 17:26
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 <tristan.waddington@gmail.com>
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;
@twaddington
twaddington / build.gradle
Created July 25, 2017 03:36
Android - Load signing info from keystore.properties
// 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)
}
}