Skip to content

Instantly share code, notes, and snippets.

View UniversalSuperBox's full-sized avatar

Dalton Durst UniversalSuperBox

View GitHub Profile
@UniversalSuperBox
UniversalSuperBox / Help.md
Last active October 27, 2021 20:12
Linux kernel: security/apparmor/lsm.c:1146:2: warning: initialization from incompatible pointer type

While performing a backport of apparmor 3 to kernel 3.4, I received the following error:

security/apparmor/lsm.c:1146:2: warning: initialization from incompatible pointer type
error, forbidden warning: lsm.c:1146

There was no more information. gcc didn't even print the erroneous line. The line in question was:

@UniversalSuperBox
UniversalSuperBox / fetch-and-prepare-image-version.sh
Last active October 19, 2021 16:16
Grabs an image from a system-image-server channel for a given device with a given tag
#!/bin/bash
set -e
# Fetches and prepares a certain tag from system server
# First argument: Channel, like '16.04/arm64/android9/stable'
# Second argument: Device, like 'yggdrasil'
# Third argument: Destination directory
# Fourth argument: Image tag, like 'OTA-16'
# The files created in the destination directory can be pushed to /cache/recovery/ on an Ubuntu Touch device.
@UniversalSuperBox
UniversalSuperBox / AWallpaperResolver.qml
Last active June 3, 2021 21:35
Pure-QML solution to select the first loadable image in a list.
/*
* Copyright 2021 UBports Foundation
*
* MIT License
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of this
* software and associated documentation files (the "Software"), to deal in the Software
* without restriction, including without limitation the rights to use, copy, modify, merge,
* publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons
* to whom the Software is furnished to do so, subject to the following conditions:
@UniversalSuperBox
UniversalSuperBox / gist:07235b6845b7f4bfa796e607ca23a371
Created May 7, 2021 16:25
A quick QML app that renders an icon with the same shape that the Drawer does, then takes a screenshot of it.
//Copyright 2021 Dalton Durst
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@UniversalSuperBox
UniversalSuperBox / debug.patch
Created April 30, 2021 00:39
Patch to print EGL/GL errors around eglSwapBuffers calls in QtUbuntu
diff --git a/src/ubuntumirclient/qmirclientglcontext.cpp b/src/ubuntumirclient/qmirclientglcontext.cpp
index 3c67461..5f78e59 100644
--- a/src/ubuntumirclient/qmirclientglcontext.cpp
+++ b/src/ubuntumirclient/qmirclientglcontext.cpp
@@ -47,6 +47,8 @@
#include <QtEglSupport/private/qeglpbuffer_p.h>
#include <QtGui/private/qopenglcontext_p.h>
+#include <QElapsedTimer>
+
@UniversalSuperBox
UniversalSuperBox / jamf.py
Created August 10, 2020 14:26
A small JPS API wrapper for getting mobile device details and setting mobile device extension attributes.
# Copyright (c) 2020 Dalton Durst
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
@UniversalSuperBox
UniversalSuperBox / BLEDebug.swift
Created September 3, 2019 20:47
Find and print out lots of information about nearby BLE devices in Swift
//Copyright 2019 Dalton Durst
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@UniversalSuperBox
UniversalSuperBox / BLEFinder.swift
Created August 30, 2019 23:12
The minimal stuff you need to search for BLE devices in macOS
//Copyright 2019 Dalton Durst
//
//Permission is hereby granted, free of charge, to any person obtaining a copy
//of this software and associated documentation files (the "Software"), to deal
//in the Software without restriction, including without limitation the rights
//to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//copies of the Software, and to permit persons to whom the Software is
//furnished to do so.
//
//THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
@UniversalSuperBox
UniversalSuperBox / ubuntu-touch-gps.rst
Created July 4, 2019 19:54
Excerpt about GPS in Ubuntu Touch

The following is a short discussion on GPS "fixing" or "locking" and the different states that a GPS device may be in when trying to get its first fix. I wrote it for the UBports documentation but it just didn't seem to fit anywhere in the article I was writing. Maybe I'll use it later.

Most GPS hardware in mobile devices does not directly state its expected TTFF or its progress toward acheiving its first fix. To make matters worse, Ubuntu Touch does not currently use a Wi-Fi positioning system or cell-site multilateration. For this reason, it can seem that Ubuntu Touch takes a very long time to receive location data.

Cold fix

If GPS hardware is not used for a while or the device's battery dies, it may need to aquire a "Cold" fix. This means that the hardware does not know the position or velocity of any positioning satellites (the `almanac <https://en.wikipedia.org/wiki/GPS_signals

@UniversalSuperBox
UniversalSuperBox / fake-libvirtd-computer-model.md
Last active July 1, 2019 16:43
Fake your computer model using libvirtd

Sometimes you want to test how an operating system will behave if you act like you're using a different computer model than you really are. For those cases, libvirtd with KVM comes in handy. We can change the model of our computer (the one returned by wmic csproduct get name, specifically) very easily. This can be used with machines created in virt-manager, but the application itself does not provide this configuration for us.

First, open up your configuration with the following command:

virsh edit [VM name]

Now we only need to add a few lines of configuration to the file. Inside the <os> tag, add the following: