Skip to content

Instantly share code, notes, and snippets.

View bnutz's full-sized avatar

Brian Lau bnutz

View GitHub Profile
@bnutz
bnutz / 00_Generic permission handler in Kotlin.md
Last active October 11, 2020 10:24
Base flow for handling Android permission request and response in Kotlin

To be placed in a main parent Activity, or as part of some custom BaseActivity class for handling permission request and responses without losing the "flow".

Example usage:

btn_load_timeline?.setOnClickListener {
    permissionCheck(Manifest.permission.READ_EXTERNAL_STORAGE, PermissionRequestCode.TIMELINE_FEATURE_EXTERNAL_STORAGE) { permissionResponse ->
        when (permissionResponse) {
            PermissionResponse.PERMISSION_GRANTED -> {
                Log.d(TAG, "Permission granted, load timeline here")
                // Do stuff with granted permission
@bnutz
bnutz / How to Extract Username Links from your Social Media Pages.md
Last active March 8, 2018 10:33
Contact Pic Linkimator will *never* ask for your social media logins. This means if you want to import your full list of friend links from your social media accounts; you will need to copy out the username list from your friend list pages and paste them into the app. Don't worry! It's easy!
@bnutz
bnutz / 00-depolymer-youtube.js
Last active March 15, 2018 03:30
Bookmarklet for disabling the new Polymer interface on YouTube (for more reliable Chromecast controls)
/*
The new (2017) YouTube interface is quite pretty (especially Dark Mode), but doesn't play nice with Chromecast controls (yet).
Until this is fixed, can use this bookmarklet to easily go back to the old YT interface with the more robust casting controls.
All this does is just add an extra query string parameter to the current URL: disable_polymer=true
To use, create a new bookmark in your browser, name it whatever you want, and then copy and past the code below into the address field.
Now when on any YouTube page and you need to go back to the old interface - click your new bookmarklet and it will automagically disable the new interface.
Adapted from: https://stackoverflow.com/a/20678352
@bnutz
bnutz / 01 pi-hole-vpn-combo_setup.md
Last active May 20, 2023 09:31
Installing Pi-Hole, Unbound and a WireGuard VPN server on a Raspberry Pi (via Docker)

Updated: 2022-07

Raspberry Pi-Hole VPN Setup

I wrote the first edition of this as a guide for myself at the end of 2017 - it was a mashup of Pi-Hole + PiVPN scripts and an IPsec script installed within a separate Raspian Docker image... and it actually worked!

But things have come a long way, and WireGuard happened - I've since streamlined and simplified my setup into a single Docker Compose script.

The steps below assume the following:

@bnutz
bnutz / nexus5X_bootloop_fix_sequence.md
Last active August 9, 2021 20:20
Procedure used for working around Nexus 5X bootloop issue

Just documenting my own experiences in restoring my Nexus 5X back from bootlooping state.

Hopefully this can be helpful to some, but "common sense" caveats apply:

  • Follow at your own risk
  • I'm not responsible for any loss of data, loss of hair, bricked devices, exploding(!) devices, mental / physical injuries, etc. etc. etc.

Remember:

  • This is only an account of what I did to get my 5X working operational again.
  • YMMV if you decide to try the steps below on your bootlooping device.