Skip to content

Instantly share code, notes, and snippets.

View UniversalSuperBox's full-sized avatar

Dalton Durst UniversalSuperBox

View GitHub Profile
@UniversalSuperBox
UniversalSuperBox / pre-start.sh
Last active June 19, 2018 19:51
Halium Android pre-start.sh replacement for halium-boot
#!/bin/sh
for mountpoint in /android/*; do
mount_name=`basename $mountpoint`
desired_mount=$LXC_ROOTFS_PATH/$mount_name
# Remove symlinks, for example bullhead has /vendor -> /system/vendor
[ -L $desired_mount ] && rm $desired_mount
[ -d $desired_mount ] || mkdir $desired_mount
@UniversalSuperBox
UniversalSuperBox / cause-panic.conf
Created March 9, 2018 22:01
Upstart job to cause a kernel panic accidentally on purpose
start on startup
script
sleep 30
echo 1 > /proc/sys/kernel/sysrq
echo c > /proc/sysrq-trigger
end script
@UniversalSuperBox
UniversalSuperBox / standalonedaynametest.qml
Last active April 30, 2018 15:22
Test of standaloneDayName giving incorrect values
import QtQuick 2.6
import QtQuick.Controls 1.4
Rectangle {
id: root;
Label {
font.pointSize: 32;
anchors.horizontalCenter: parent.horizontalCenter;
text: Qt.locale().name + ":" + Qt.locale(Qt.locale().name).standaloneDayName((0), Locale.ShortFormat);
@UniversalSuperBox
UniversalSuperBox / small-calendar.qml
Created April 30, 2018 15:31
A test of the QML Calendar
import QtQuick 2.6
import QtQuick.Controls 1.4
Rectangle {
id: root;
Calendar {
}
}
@UniversalSuperBox
UniversalSuperBox / Unattended-security-upgrades-rhel-7.md
Last active June 18, 2024 15:48
Automatic security update and reboot of RHEL 7 servers

On Ubuntu, it's stupidly easy to enable automatic security updates. If you didn't do it in the installer:

sudo apt install unattended-upgrades
sudo dpkg-reconfigure unattended-upgrades

You can also make the server reboot automatically at a scheduled time by setting the following settings in /etc/apt/apt.conf.d/50unattended-upgrades:

@UniversalSuperBox
UniversalSuperBox / wipe.sh
Last active January 27, 2021 01:54
Script to wipe all of the SATA storage media in a computer
#!/bin/bash
# Script to wipe all of the SATA storage media in a computer
# Absolutely, positively, do not run this script unless you want all of your data
# to be gone.
# 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
[Desktop Entry]
Encoding=UTF-8
Name=Nuke
Comment=Destroy data permanently
Exec=xfce4-terminal --command /home/xubuntu/wipe.sh
Terminal=true
Type=Application
@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:

@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 / 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