Skip to content

Instantly share code, notes, and snippets.

View matejdro's full-sized avatar

Matej Drobnič matejdro

View GitHub Profile
import kotlinx.coroutines.GlobalScope
import kotlinx.coroutines.InternalCoroutinesApi
import kotlinx.coroutines.Job
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.channels.ReceiveChannel
import kotlinx.coroutines.channels.SendChannel
import kotlinx.coroutines.channels.ValueOrClosed
import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.consumeAsFlow
import kotlinx.coroutines.flow.emitAll
$thisDirectory = (Get-Location).Path
$notes = Get-ChildItem -Path . -Filter *.md -Recurse -ErrorAction SilentlyContinue -Force
foreach ($note in $notes) {
$relativeFolder = $note.DirectoryName.Replace($thisDirectory, "").Trim().TrimStart("\")
$contents = Get-Content -Path $note.FullName
if ($relativeFolder.Length -eq 0) {
$relativeFolder = "."
}
@matejdro
matejdro / HidableFragment.kt
Last active July 4, 2020 17:22
Android Fragment that holds lifecycle for being hidden
import android.os.Bundle
import androidx.annotation.CallSuper
import androidx.fragment.app.FragmentTransaction
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleOwner
import androidx.lifecycle.LifecycleRegistry
/**
* By default [FragmentTransaction.hide] does not trigger any lifecycle events (Fragment is
* still started and resumed even if invisible).
======build/aplite/pebble-app.elf======
Traceback (most recent call last):
File "/mnt/d/Pebble/pebble-tool/pebble.py", line 7, in <module>
pebble_tool.run_tool()
File "/mnt/d/Pebble/pebble-tool/pebble_tool/__init__.py", line 42, in run_tool
args.func(args)
File "/mnt/d/Pebble/pebble-tool/pebble_tool/commands/base.py", line 47, in <lambda>
parser.set_defaults(func=lambda x: cls()(x))
File "/mnt/d/Pebble/pebble-tool/pebble_tool/commands/sdk/project/analyse_size.py", line 40, in __call__
sections = binutils.analyze_elf(path, 'bdt', use_fast_nm=True)
public static void ditherToBlackWhite(LightBitmap bitmap)
{
double[][] separatedColorArray = new double[bitmap.getWidth()][bitmap.getHeight()];
for (int y = 0; y < bitmap.getHeight(); y++)
{
for (int x = 0; x < bitmap.getWidth(); x++)
{
separatedColorArray[x][y] = getGrayscaleColor(bitmap.getPixel(x, y));
}
IgnoredMobs:
- HORSE_DARK_BROWN_WHITE_DOTS
- HORSE_BROWN_WHITEFIELD
- HORSE_BLACK_WHITEFIELD
- VILLAGER
- IRON_GOLEM
- HORSE_WHITE_BLACK_DOTS
- HORSE_CREAMY_WHITEFIELD
- SQUID
- HORSE_CREAMY_WHITE_DOTS
Announcements:
Testing:
- if group is Guardian:
- message: Hello mighty admin
- if group is Novice:
- Pick:
- message: Hi
- message: Hello
- message: Good Day
@matejdro
matejdro / gist:8423662
Last active January 3, 2016 06:39 — forked from riddle/gist:8423562
Debug: false
Messages:
NoPermission: '&cNo permission!'
ConfigurationReloaded: '&aConfiguration reloaded successfully!'
AnnouncementPrefix: '&6'
Groups:
Inherited:
- Novice
- Flatcorian
- Nomad
Debug: false
Messages:
NoPermission: No permission!
ConfigurationReloaded: Configuration reloaded successfully!
Announcements:
FirstMessagge:
- if group Flatcorian:
- text: You are flatcorian
else:
- if group Veteran: