Skip to content

Instantly share code, notes, and snippets.

View rayworks's full-sized avatar
:octocat:

rayworks rayworks

:octocat:
  • Shanghai, China
  • 13:38 (UTC +08:00)
View GitHub Profile
@rayworks
rayworks / cleaner.kt
Created April 23, 2025 03:30
Image resource cleaner for Android project
import java.io.File
import java.util.regex.Pattern
import kotlin.system.exitProcess
fun findMatches(directory: File, pattern: Pattern, extensions: List<String>): Set<String> {
val result = mutableSetOf<String>()
directory.walkTopDown()
.filter { it.isFile && it.extension in extensions }
@rayworks
rayworks / README.md
Created May 16, 2025 03:31 — forked from avoidik/README.md
Repack APK, make it debuggable
@rayworks
rayworks / Interceptor.java
Created June 24, 2025 02:57 — forked from alex-shpak/Interceptor.java
Refreshing OAuth token with okhttp interceptors. All requests will wait until token refresh finished, and then will continue with the new token.
private class HttpInterceptor implements Interceptor {
@Override
public Response intercept(Chain chain) throws IOException {
Request request = chain.request();
//Build new request
Request.Builder builder = request.newBuilder();
builder.header("Accept", "application/json"); //if necessary, say to consume JSON
package com.example.myapplication
import androidx.compose.runtime.Composable
import androidx.compose.runtime.getValue
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.modifier.modifierLocalConsumer
@rayworks
rayworks / microgpt.py
Created June 14, 2026 15:45 — forked from karpathy/microgpt.py
microgpt
"""
The most atomic way to train and run inference for a GPT in pure, dependency-free Python.
This file is the complete algorithm.
Everything else is just efficiency.
@karpathy
"""
import os # os.path.exists
import math # math.log, math.exp