Skip to content

Instantly share code, notes, and snippets.

View threethan's full-sized avatar

Ethan Medeiros threethan

View GitHub Profile
@threethan
threethan / translate_android_string.py
Last active October 25, 2025 06:47
Translate Android strings.xml with DeepL and python. Supports incremental translation & mid-string tags.
'''
Translate Android strings.xml files using DeepL API.
Requires an API key from https://www.deepl.com/pro-api
Usage:
- Set the DEEPL_API_KEY environment variable to your key or pass it via --auth-key
- Run the script with --res-dir pointing to your Android res folder (or without args to see help)
- Optionally specify source and target languages, and files to translate.
(Default: Extend existing translations in values folders from EN strings.xml)
'''
@threethan
threethan / ViewFlinger.java
Last active November 18, 2024 01:35
[Updated 2024] ViewFlinger - An android view flipper component with support for touch or mouse, looping, auto-advance, and page indicators.
/*
* Copyright 2011 Google Inc.
*
* 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
@threethan
threethan / DataStoreEditor.java
Last active October 21, 2025 06:02
An easy to use Java-only wrapper for Android DataStores which can be used to migrate from SharedPreferences
import android.annotation.SuppressLint;
import android.content.Context;
import android.content.SharedPreferences;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
// ==UserScript==
// @name Subpixel Kerning for Google Docs (Firefox Only!)
// @namespace http://tampermonkey.net/
// @version 1.0
// @description Enables subpixel kerning on the content of google docs. Includes an automatic dark mode, see code comments for Dark Reader compatibility.
// @author threethan
// @match https://docs.google.com/document/*
// @icon https://ssl.gstatic.com/docs/documents/images/kix-favicon7.ico
// @grant none
// ==/UserScript==
@threethan
threethan / compress.sh
Created April 9, 2023 09:54
Compress Godot HTML5 export with gunzip for smaller file size
#!/bin/bash
### usage ./convert.sh game
## where game is baseName of the export
# Based on https://gist.github.com/natrim/1a19f4b7668e0474897f3f28171f3b33
# wish revisions from https://gist.github.com/natrim/1a19f4b7668e0474897f3f28171f3b33?permalink_comment_id=4108811#gistcomment-4108811
if [ ! "$1" ]; then
read -p 'Game name: ' game
else
@threethan
threethan / userChrome.css
Last active March 3, 2023 00:31
Windows 11 Styled Right-Click Menu for FireFox (userChrome tweak)
/*
* Makes the right-click menu in FireFox look like windows 11's native right click menus
*
* Add as your userChrome.css or append to an existing one
* https://www.reddit.com/r/firefox/wiki/userchrome/
*
* Created for Firefox 111 but should work with future versions
*/
menupopup {