Skip to content

Instantly share code, notes, and snippets.

@bgotink
bgotink / howto.md
Last active October 17, 2020 03:02
unset a setting if it breaks your android OS

This guide tells you how to reset a system setting in case your OS breaks once you change it. In my case, as soon as I enabled the "force RTL layout" setting, I got "System UI stopped working" over and over again, even in safe mode.

Requirements

  • This guide is written for Android 5.1, it should work for older versions (with remarks, cf. below), it might work for newer versions.
  • You'll need a custom recovery, I recomment TWRP.
  • You'll need adb available, google around to know how to install it on your OS. If you're on windows, ensure you have the drivers for your smartphone!
  • USB debugging should be enabled in the developer menu
  • If you already have root access over ADB on your phone, you can skip the entire "reboot into recovery and mount /system and /data" part. You will probably still need the reboot at the end though.

gray2white

This small C++ program converts a grayscale OpenEXR image to an image with transparancy and white colours.

behaviour

  • takes only red channel of RGBA into account, prints message if color isn't gray
  • makes any partially transparent pixel completely transparent
  • makes colours darker than #F0F0F0 white and colors lighter than or equal to #F0F0F0 transparent
@bgotink
bgotink / index.html
Created June 19, 2016 22:43
Get paper-buttons to behave as a radio group
<paper-radio-group
class="language-select"
selected-attribute="active"
selectable="paper-button"
selected="{{language}}">
<template is="dom-repeat" items="[[possibleLanguages]]">
<paper-button disabled="[[disabled]]" toggles raised noink name="[[item]]">[[item]]</paper-button>
</template>
</paper-radio-group>
@bgotink
bgotink / _Track RxJs subscriptions.md
Last active November 27, 2018 12:19
Track all observable subscriptions

Exmaple usage:

  • Add this piece of code in your angular application's main.ts, above the bootstrap call
  • Execute subscriptions.clear() in the console, because a lot of subscriptions are created at bootstrap time
  • Trigger the actions you want to investigate
  • Copy the subscriptions map to prevent changes while you're investigating
  • Investigate
@bgotink
bgotink / yarnw.sh
Last active March 30, 2022 18:41
Yarn wrapper script to use checked in yarn version without installing it globally
#!/usr/bin/env bash
#
# Wrapper script that executes the yarn version checked in in a project without
# requiring the global package to be available.
#
# This script uses nvm when a .nvmrc file is found next to it.
#
# Usage:
# - Place yarnw into the folder containing your .yarnrc / .yarnrc.yml file
# pointing to a local yarn version.
@bgotink
bgotink / Yarn binaries in FISH.md
Last active January 11, 2021 23:11
Add binaries installed via yarn to the $PATH

Add this script to your fish config.

It sets up a listener. Every time the working directory changes, it checks what binaries are installed and accessible via yarn 2, and makes those accessible on the PATH.

In other words, if you've got a yarn 2 workspace you can run

yarn add -D typescript
tsc --init