Skip to content

Instantly share code, notes, and snippets.

@codejockie
codejockie / R8 error
Created April 5, 2025 18:37
R8_Error.txt
java.lang.IllegalArgumentException: Unable to create call adapter for y8.d<t4.e>
for method g.a
at y8.U.n(Unknown Source:46)
at y8.p.b(Unknown Source:2850)
at y8.M.invoke(Unknown Source:67)
at java.lang.reflect.Proxy.invoke(Proxy.java:1006)
at $Proxy2.a(Unknown Source)
at j4.h0.s(Unknown Source:30)
at j4.h0.h(Unknown Source:12)
at t6.a.f0(Unknown Source:4)
@codejockie
codejockie / ASM.md
Created November 21, 2024 19:54
Programming in assembly language tutorial (Forked from https://github.com/mschwartz/assembly-tutorial/blob/main/README.md)

Programming in assembly language tutorial

This tutorial covers AMD64/Intel 64 bit programming. Instruction sets for other processors, such as ARM or RISC-V are radically different, though the concepts are the same. They all have instructions, registers, stacks, and so on. Once you know one processor's assembly language, adapting to a different processor is rather easy.

I found that I was writing code for a new processor within hours, and writing quality code within a week or two. This is going from Z80 to 6502 to 6809 to 8086 to 68000 and so on. It is interesting to be able to look at a processor's technical manuals and evaluate the power and flexibility of its instruction set.

This tutorial is aimed at novices and beginners who want to learn the first thing about assembly language programming. If you are an expert, you may or may not get a lot out of this.

@codejockie
codejockie / levenshtein.kt
Created July 25, 2024 14:21
Levenshtein Distance
fun main() {
val word1 = "kitten"
val word2 = "sitting"
val distance = levenshteinDistanceOp(word1, word2)
println("Levenshtein distance between $word1 and $word2 is $distance")
val input = "kotln"
val target = "kotlin"
val tolerance = 1 // Allow up to 1 typo
@codejockie
codejockie / gist:9ee0d18f0142f3afd305a596507cab48
Created July 12, 2024 18:32 — forked from darkfall/gist:1656050
A simple class that converts a image to a icon in c# without losing image color data, unlike System.Drawing.Icon; ico with png data requires Windows Vista or above
class PngIconConverter
{
/* input image with width = height is suggested to get the best result */
/* png support in icon was introduced in Windows Vista */
public static bool Convert(System.IO.Stream input_stream, System.IO.Stream output_stream, int size, bool keep_aspect_ratio = false)
{
System.Drawing.Bitmap input_bit = (System.Drawing.Bitmap)System.Drawing.Bitmap.FromStream(input_stream);
if (input_bit != null)
{
int width, height;
@codejockie
codejockie / DownloadProgressLiveData.kt
Created March 23, 2024 16:25 — forked from typebrook/DownloadProgressLiveData.kt
Observe Download manager progress using LiveData and Coroutine #android #kotlin #livedata
data class DownloadItem(
val bytesDownloadedSoFar: Long = -1,
val totalSizeBytes: Long = -1,
val status: Int,
val uri: String
)
class DownloadProgressLiveData(private val activity: Activity) :
LiveData<List<DownloadItem>>(),
CoroutineScope {
// REFERENCE UNICODE TABLES:
// http://www.rikai.com/library/kanjitables/kanji_codes.unicode.shtml
// http://www.tamasoft.co.jp/en/general-info/unicode.html
//
// TEST EDITOR:
// http://www.gethifi.com/tools/regex
//
// UNICODE RANGE: DESCRIPTION
//
// 3000-303F: punctuation
@codejockie
codejockie / README.md
Created March 6, 2024 18:19 — forked from lopspower/README.md
Hexadecimal color code for transparency

Hexadecimal color code for transparency

Twitter

How to set transparency with hex value ?

For example, you want to set 40% alpha transparence to #000000 (black color), you need to add 66 like this #66000000.

Download This sample on Google Play Store

@codejockie
codejockie / CSharpExtensions.cs
Last active January 30, 2024 12:45
Array Tabulator
public static class MyExtensions
{
public static void TimeAgo(this DateTime date)
{
// 1000 millisecs = 1 sec
// 60 secs = 1 min
// 60 mins = 1 hr
// 24 hrs = 1 day
var diff = DateTime.Now - date;
var millis = diff.TotalMilliseconds;
@codejockie
codejockie / Bitwise.cs
Created January 26, 2024 20:26
Use cases of bitwise operators
const byte SECURITY_CHECK_FLAG = 0b00000001;
const byte TWO_FACTOR_AUTH_FLAG = 0b00000010;
const byte JUST_A_FLAG = 0b00000100;
// Uses of Bitwise operators
void Main()
{
// 1. Storing multiple boolean flags
byte flags = 0;
// Enabling flags
@codejockie
codejockie / Program.cs
Created January 19, 2024 13:41
Using ResourceDescription to embed resource information
// https://github.com/dotnet/roslyn/issues/7791#issuecomment-394133511
var resourceDescription = new Microsoft.CodeAnalysis.ResourceDescription(
resourceFullName,
() => ProcessFile(resourceFilePath),
isPublic: true);
private static MemoryStream ProcessFile(string inFile)
{
var readers = new List<ReaderInfo>();
var resources = ReadResources(inFile);