Skip to content

Instantly share code, notes, and snippets.

View josmithua's full-sized avatar
👨‍💻

Joshua josmithua

👨‍💻
View GitHub Profile
@josmithua
josmithua / result.py
Last active October 19, 2025 04:23
Python 3.12+ version of result.py from rustedpy/result
"""Result type for representing success and failure."""
# ruff: noqa: PLR6301
from __future__ import annotations
import functools
import inspect
from collections.abc import AsyncGenerator, Awaitable, Callable, Generator, Iterator
from typing import Any, Final, Literal, NoReturn

52 Gospel Verses

Memorize one per week!

Psalm 86:5

For you, O Lord, are good and forgiving,
abounding in steadfast love to all who call upon you.

Isaiah 1:18

Come now, let us reason together, says the LORD:
though your sins are like scarlet,

@josmithua
josmithua / UartInputStream.kt
Created September 10, 2018 15:48
InputStream for Android Things UartDevice
package com.mycompany.uartproj
import com.google.android.things.pio.UartDevice
import java.io.InputStream
class UartInputStream(private val uartDevice: UartDevice) : InputStream() {
override fun read(): Int {
val byteArray = ByteArray(1)
while (true) {

GitHub Cheat Sheet for my Forgetful Mind

git remote add alias_name_for_remote repo_URL
git push -u alias_name_for_remote branch_name

git config --global alias.lol "log --oneline --graph --decorate --all"
git config --global alias.cm "commit -m"
git config --global alias.s "status"
@josmithua
josmithua / max.h
Last active August 29, 2015 14:13
Different algorithms
int arrayMax(int * a, int n) {
if (n == 1) {
return a[0];
}
return max(arrayMax(a, n-1), a[n-1]);
}
int arrayMax(int * a, int i, int j) {
if (i >= j) {
return a[i]; //or a[j]
@josmithua
josmithua / OpenGL330Basics.cpp
Last active August 29, 2015 14:11
Basic Procedure of Drawing Something in OpenGL 3.3
#include <gl/glew.h>
#include <glm/glm.hpp>
#include <glm/gtc/matrix_transform.hpp>
GLuint vao;
GLuint vbo;
GLuint shader_program;
GLint uniform_color;
GLint uniform_MVP;