Skip to content

Instantly share code, notes, and snippets.

@brianmwadime
brianmwadime / bash.sh
Created March 25, 2024 15:38
Silicon - install: you may need to run ldconfig
sudo update_dyld_shared_cache
\documentclass[11pt, oneside]{article}
\usepackage[margin=0.5in]{geometry}
\geometry{letterpaper}
\usepackage[parfill]{parskip}
\usepackage{graphicx}
\usepackage{amssymb}
\usepackage{xcolor}
\pagecolor{white}
\usepackage[colorlinks = true, linkcolor = blue, urlcolor = blue]{hyperref}
\pagestyle{empty}
@brianmwadime
brianmwadime / TextFieldWithBackoff.kt
Created November 23, 2023 21:55 — forked from nemscep/TextFieldWithBackoff.kt
TextField which automatically triggers provided `onValueChange` lambda with the full text input (not for every character).
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.shape.ZeroCornerSize
import androidx.compose.foundation.text.KeyboardActions
import androidx.compose.foundation.text.KeyboardOptions
import androidx.compose.material.LocalTextStyle
import androidx.compose.material.MaterialTheme
import androidx.compose.material.TextField
import androidx.compose.material.TextFieldColors
import androidx.compose.material.TextFieldDefaults
import androidx.compose.runtime.Composable
@brianmwadime
brianmwadime / CurrencyOffsetMapping.kt
Created November 23, 2023 21:25 — forked from damianpetla/CurrencyOffsetMapping.kt
Transforming EditText value into currency
import androidx.compose.ui.text.input.OffsetMapping
class CurrencyOffsetMapping(originalText: String, formattedText: String) : OffsetMapping {
private val originalLength: Int = originalText.length
private val indexes = findDigitIndexes(originalText, formattedText)
private fun findDigitIndexes(firstString: String, secondString: String): List<Int> {
val digitIndexes = mutableListOf<Int>()
var currentIndex = 0
for (digit in firstString) {

https://groups.google.com/forum/#!topic/comp.sys.mac.system/jIWY8VRl3cw

Recommended "vm_compressor=2" or "vm_compressor=4".

Compressor mode 4 (VM compressed + swap) and all the steps between 1st-4th descripted before, is equal than compressor mode 2 (VM compressed/encrypted without swap).

In compressor mode 1, if you disable swap, system is always 100% memory pressure, and if memory is full at some point, the system will freeze.

So i recommended mode 2 or 4 with steps to disable swap applied.

@brianmwadime
brianmwadime / AsyncSequence-subprotocol-try-await-element-type.swift
Created May 2, 2023 06:29 — forked from inamiy/AsyncSequence-subprotocol-try-await-element-type.swift
AsyncSequence subprotocol with primary associated type, erase with existential, and check try-await element type
import Foundation
import _Concurrency
extension AsyncStream {
public init<S: AsyncSequence & Sendable>(
_ sequence: S,
bufferingPolicy limit: Continuation.BufferingPolicy = .unbounded
) where S.Element == Element {
self.init(bufferingPolicy: limit) { continuation in
let task = Task {
@brianmwadime
brianmwadime / README.md
Created October 20, 2022 22:06 — forked from dylangolow/README.md
Postman Pre-Request script for Firebase Auth

Postman Pre-Request Script to fetch Firebase Auth token

This pre-request script uses environment variables to fetch an auth JWT.

This Auth JWT is used in the header of all requests when testing API endpoints that use Firebase for authorization.

@brianmwadime
brianmwadime / OpacityHex.markdown
Created April 18, 2022 08:29 — forked from passiondroid/OpacityHex.markdown
Opacity percentage in a Hex color code

Android uses hexadecimal ARGB values, which are formatted as #AARRGGBB. That first pair of letters, the AA, represent the alpha channel. You must convert your decimal opacity values to a hexadecimal value. Here are the steps:

Alpha Hex Value Process

  • Take your opacity as a decimal value and multiply it by 255. So, if you have a block that is 50% opaque the decimal value would be .5. For example: .5 x 255 = 127.5

  • The fraction won't convert to hexadecimal, so you must round your number up or down to the nearest whole number. For example: 127.5 rounds up to 128; 55.25 rounds down to 55.

  • Enter your decimal value in a decimal-to-hexadecimal converter, like http://www.binaryhexconverter.com/decimal-to-hex-converter, and convert your values.

@brianmwadime
brianmwadime / CurvedUIView.swift
Created October 4, 2021 09:51 — forked from anitaa1990/CurvedUIView.swift
A Swift extension of UIView to display a curved view
import UIKit
extension UIView {
/* Usage Example
* bgView.addBottomRoundedEdge(desiredCurve: 1.5)
*/
func addBottomRoundedEdge(desiredCurve: CGFloat?) {