Skip to content

Instantly share code, notes, and snippets.

View dhinojosa's full-sized avatar

Daniel Hinojosa dhinojosa

View GitHub Profile
blaff, acoin, furzy, trest, haugh, chary, wauve, dekle, askos, rifty, secos, derry, tylus, clite, croci, ribby, calli, gowan, iztle, holer, gaspy, ovist, awing, galop, bandy, stipe, genip, ditch, droit, fodda, sowel, gauzy, mulga, toise, pavan, wiser, cueca, quoin, forby, kinky, sparm, untin, muser, pinta, kneed, ducal, darac, awber, baron, unity, arado, wheep, minge, silex, balut, stosh, sclim, petre, arzun, cheki, kotal, ilima, glint, cairn, plasm, rebec, daric, levee, saily, belar, trasy, recce, penal, borty, swarm, banga, sully, stert, crine, nizam, xysti, doggy, adead, tepor, quave, chous, timon, astor, ocote, haggy, chaus, blair, taler, anigh, snary, drown, basos, jacko, jural, rooty, steer, acock, peasy, tanti, sawah, negro, aleak, royet, unlaw, chola, frush, tween, myron, gawby, enzym, kokan, jatha, kakar, podgy, foute, hajib, yoven, nurly, unsex, stull, cadew, rutin, epact, zokor, widow, widdy, cumbu, bolar, finis, joist, acred, metic, piked, lapon, gerah, enoil, refix, slour, pondy, durra, heaps, sw
@dhinojosa
dhinojosa / Blackjack.py
Created January 27, 2025 23:07
PythonGame
import random
from colorama import Fore, Style, init
# Initialize colorama
init(autoreset=True)
class Card:
def __init__(self, suit, rank):
self.suit = suit
self.rank = rank
@dhinojosa
dhinojosa / JustinLeeByteCode.md
Created January 19, 2025 03:16
Justin Lee ByteCode Low Down

I'm putting together an "intro to bytecode" talk for jfokus in a couple of weeks and noticed an oddity that I don't have an explanation for. If i have a method like this:

    public void someMethod() {
        int local = 17;
        local *= 18;
      
        var name = "Iron Man";
        name = "Tony Stark";
       }
@dhinojosa
dhinojosa / TicTacToe.java
Created August 8, 2024 15:47
Made by AI, needs refactoring
import java.util.Scanner;
public class TicTacToe {
private static char[][] board = new char[3][3];
private static char currentPlayer = 'X';
public static void main(String[] args) {
initializeBoard();
playGame();
@dhinojosa
dhinojosa / C64Emulator.java
Created June 5, 2024 15:18
ChatGPT Commodore 64 Emulator
import java.util.Arrays;
public class C64Emulator {
private static final int MEMORY_SIZE = 65536; // 64KB memory
private byte[] memory = new byte[MEMORY_SIZE];
// 6502 CPU registers
private int pc; // Program Counter
private byte sp; // Stack Pointer
@dhinojosa
dhinojosa / VirtualThreadsTryWithResources.java
Created March 24, 2024 23:02
The following hangs when using ExecutorService in TWR block
package com.evolutionnext.demo.virtualthreads;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.concurrent.*;
@dhinojosa
dhinojosa / FindAllJavaWordsFromURL.java
Last active March 24, 2024 20:22
Does this deadlock for you?
package com.evolutionnext.demo.virtualthreads;
import java.io.BufferedReader;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.net.URI;
import java.nio.charset.StandardCharsets;
import java.util.Arrays;
import java.util.concurrent.*;
@dhinojosa
dhinojosa / UsingGathererGroupBy.java
Last active March 10, 2024 22:26
GroupBy as a Gatherer
static class GroupBy<T, K> implements Gatherer<T, HashMap<K, List<T>>, Map.Entry<K, List<T>>> {
private final Function<T, K> groupFunction;
public GroupBy(Function<T, K> groupFunction) {
this.groupFunction = groupFunction;
}
@Override
public Supplier<HashMap<K, List<T>>> initializer() {
@dhinojosa
dhinojosa / git_repo_check.sh
Last active February 29, 2024 18:26
Find all the repositories in your home directory and tells you what needs to be updated. Run with ./git_repo_check <dir1> <dir 2>
#!/bin/bash
# Function to check a single git repository
check_git_repo() {
local dir=$1
cd "$dir" || return
# Check for uncommitted changes
uncommitted_changes=$(git status --porcelain)
if [ ! -z "$uncommitted_changes" ]; then
import java.util.concurrent.ExecutionException;
import java.util.concurrent.StructuredTaskScope;
import java.util.concurrent.atomic.AtomicLong;
public class MillionsOfTasks {
private final AtomicLong atomicLong;
public MillionsOfTasks() {
atomicLong = new AtomicLong();
}