Skip to content

Instantly share code, notes, and snippets.

View perdona's full-sized avatar
🌱

Caio Perdona perdona

🌱
  • PiniOn
  • Brazil
View GitHub Profile
@Composable
fun MapSnapshot(map: MapView, location: LatLng) {
val mapBitmap: MutableState<Bitmap?> = remember { mutableStateOf(null) }
val coroutineScope = rememberCoroutineScope()
if (mapBitmap.value != null) {
Image(
bitmap = mapBitmap.value!!.asImageBitmap(),
contentDescription = "Map snapshot",
@LongClipeus
LongClipeus / HashUtils.kt
Last active March 13, 2024 11:54
How to generate checksum hash for a file in Kotlin
import StringUtils.encodeHex
import java.io.File
import java.io.FileInputStream
import java.io.InputStream
import java.security.MessageDigest
object HashUtils {
const val STREAM_BUFFER_LENGTH = 1024
@sbinlondon
sbinlondon / synthwaveglow.md
Last active February 22, 2024 22:40
Get the synth wave glow theme working for VS Code on Mac

Get the synth wave glow working for VS Code on Mac

These notes are pretty much the same steps as the two extensions list, it's just that I had to collate them together because neither seems to list it fully in the proper order.

  1. Install Synthwave ’84/Synthwave + Fluoromachine theme on VS Code (I used the Fluoromachine one)

  2. Install Custom CSS and JS Loader

  3. Command + Shift + P to open command palette > "Preferences: Open settings (JSON)"

@hansemannn
hansemannn / liveview-from-cli.md
Last active December 9, 2022 17:12
Use LiveView from the Titanium CLI (without Studio)
  1. Install LiveView globally:
npm i -g liveview
  1. Change the ~/.titanium/config.json to include the CLI hook (under paths -> hook):
{
	"user": { ... },
	"app": { ... },
	"cli": { ... },
@paolocarrasco
paolocarrasco / README.md
Last active May 3, 2024 15:20
How to understand the `gpg failed to sign the data` problem in git

Problem

You have installed GPG, then tried to commit and suddenly you see this error message after it:

error: gpg failed to sign the data
fatal: failed to write commit object

Debug

@lovubuntu
lovubuntu / Sha256.kt
Created November 24, 2017 15:58
function to generate Sha-256 in Kotlin
Class Hasher {
fun hash(): String {
val bytes = this.toString().toByteArray()
val md = MessageDigest.getInstance("SHA-256")
val digest = md.digest(bytes)
return digest.fold("", { str, it -> str + "%02x".format(it) })
}
}
@mg6maciej
mg6maciej / MoshiExtensions.kt
Created May 6, 2017 10:07
Moshi generic type adapters
import com.squareup.moshi.JsonAdapter
import com.squareup.moshi.Moshi
import com.squareup.moshi.Types
import java.lang.reflect.Type
// val adapter = moshi.listAdapter<MyModel>()
// val adapter = moshi.mapAdapter<String, List<MyModel>>(valueType = listType<MyModel>())
inline fun <reified E> Moshi.listAdapter(elementType: Type = E::class.java): JsonAdapter<List<E>> {
return adapter(listType<E>(elementType))
@scottopell
scottopell / fix_exfat_drive.md
Last active April 30, 2024 22:46
Fix corrupted exFAT disk macOS/OSX

exFAT support on macOS seems to have some bugs because my external drives with exFAT formatting will randomly get corrupted.

Disk Utility is unable to repair this at first, but the fix is this:

  1. Use diskutil list to find the right drive id.
  2. You want the id under the IDENTIFIER column, it should look like disk1s1
  3. Run sudo fsck_exfat -d <id from above>. eg sudo fsck_exfat -d disk1s3
  4. -d is debug so you'll see all your files output as they're processed.
  5. Answer YES if it gives you the prompt Main boot region needs to be updated. Yes/No?
@yosukehasumi
yosukehasumi / git-auto-deploy.md
Last active July 25, 2023 20:07
Setting Up Git-Auto-Deploy on Digital Ocean

Install software-properties-common

sudo apt-get install software-properties-common

Add Repo

sudo add-apt-repository ppa:olipo186/git-auto-deploy
@rcugut
rcugut / node-npm-install.md
Last active February 2, 2024 11:51 — forked from DanHerbert/fix-homebrew-npm.md
Install node & npm on Mac OS X with Homebrew

DEPRECATED as of macOS 10.13 (High Sierra). See the new GUIDE to install nvm and yarn for macOS (updated July 2019)

Fixing npm On Mac OS X for Homebrew Users

Installing node through Homebrew can cause problems with npm for globally installed packages. To fix it quickly, use the solution below. An explanation is also included at the end of this document.

Solution

This solution fixes the error caused by trying to run npm update npm -g. Once you're finished, you also won't need to use sudo to install npm modules globally.