Skip to content

Instantly share code, notes, and snippets.


Matt noln

View GitHub Profile
noln / MainActivity.kt
Last active May 30, 2020
Share an Image or Video file to Instagram, via MediaStore Uri
View MainActivity.kt
import android.annotation.SuppressLint
import android.content.*
import android.os.Build
import android.os.Bundle
import android.provider.MediaStore
import android.util.Log
import android.widget.Button
noln / gist:d33e432158a8240d2fb7cd5850092933
Created Nov 28, 2017
Alert dialog with Spinner in customView, using Anko (Kotlin)
View gist:d33e432158a8240d2fb7cd5850092933
// Items for spinner
val items = arrayOf("One", "Two", "Three", "Four", "Five")
// Alert with a spinner
alert("Example Alert") {
title = "Example Alert"
customView {
verticalLayout {
spinner {
adapter = ArrayAdapter(ctx, android.R.layout.simple_spinner_dropdown_item, countries)
noln / ffmpeg_commands.txt
Last active Aug 21, 2018
Handy FFMPEG Commands for Quickly Processing GoPro Videos
View ffmpeg_commands.txt
1) Concatenate a list of videos into one
ffmpeg -f concat -safe 0 -i tojoin.txt -c copy output.mp4
// Format of tojoin.txt:
file 'file0.MP4'
file 'file1.MP4'
file 'etc..
2) Scale down 4k video to
noln /
Last active Apr 8, 2020
A basic activity that listens to zen_mode state (Android's "do not disturb" volume/vibration muting feature) and dumps the current value to log. There are two ways included; the first is an observer and doesn't work in every case (I think there's a separate preference for priority messages), the second may is a manual check by hitting a button.
import android.database.ContentObserver;
import android.os.Bundle;
import android.os.Handler;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.util.Log;
import android.view.View;
import android.widget.Button;
noln /
Last active Aug 29, 2015
Using this instead of straight Spoon.screenshot(..) until issue identified in is resolved. Extremely noddy for a Gist, but works with my library-builder script (which I might open source when it's done :-P).
private void failoverScreenshot(String desc) {
try {
Spoon.screenshot(getActivity(), desc);
catch (IllegalArgumentException e) {
Log.v(TAG, "Handled erroneous Spoon-Client screenshot exception.");
noln / DownloadsToTrash
Created Jul 19, 2015
Moves contents of current user's Downloads folder to Trash
View DownloadsToTrash
# b.nelissen
# move contents of downloads folder to trash (I want a clean downloads folder every time I login)
mv ~/Downloads/* ~/.Trash/
noln / gist:4853bfe0908f87dee41f
Last active Jun 16, 2020
A basic anonymous AsyncTask with void return and no pre/post method.
View gist:4853bfe0908f87dee41f
new AsyncTask<Integer, Void, Void>(){
protected Void doInBackground(Integer... params) {
// main logic
return null;
View gist:9d5424cb4953e8c29c22
public void onPropertiesChanged(Bundle properties) {
mLowBitAmbient = properties.getBoolean(PROPERTY_LOW_BIT_AMBIENT, false);
mBurnInProtection = properties.getBoolean(PROPERTY_BURN_IN_PROTECTION,
View gist:77503c4d6734429220ee
First-off, huge thanks both Fenix and Buffer teams for the apps, I use them both
every day, and think they're brilliant! The only issue I have is that they don't
currently like to talk to eachother...if they did? That would be great!
Here's my analysis on why they currently don't:
You can’t perform that action at this time.