Skip to content

Instantly share code, notes, and snippets.

View menjoo's full-sized avatar

Menno Morsink menjoo

  • Netherlands
View GitHub Profile
@menjoo
menjoo / my-test-sensor.json
Last active April 15, 2020 07:55
my dummy sensor
{
"meters":[
{
"power":1.0
}
]
}
@menjoo
menjoo / ActivityScopedModule.kt
Last active June 30, 2020 11:29
Tie object lifetime to a set of activities
/**
* Ties the lifetime of an instance to the lifetime of a set of activities.
* If all activities in the scope are destroyed, T will be stopped and recycled.
*
* This solves the problem that it is very hard to stop and recycle objects when no longer needed
* that need to survive activity navigation.
*
* An example is when you have a MainActivity, and a feature with Activities A, B, C and D.
* If you must have an session object hold by a Module that is instantiated in A and needed in B, C and D.
* Then it needs to be recycled whenever the user leaves the feature.
@menjoo
menjoo / download_all_SNES_roms_from_emuparadise.sh
Created January 4, 2019 19:26
Bash script to download all SNES roms from emuparadise.me
#!/bin/bash
# emuparadise.me SNES roms start at id 32787 and ends with 36466, loop through the ids:
for i in {32787..36466}
do
# Define emuparadise rom ID to be downloaded
gameId=$i
# The url where to start