Skip to content

Instantly share code, notes, and snippets.

View banasiak's full-sized avatar

Richard Banasiak banasiak

View GitHub Profile
banasiak /
Created November 29, 2022 00:22
Hyper-V Enhanced Session (Ubuntu 22.04 LTS)
# Instructions:
# This Script:
# This script is for Ubuntu 22.04 Jammy Jellyfish to download and install XRDP+XORGXRDP via
# source.
# Major thanks to: for the tips.
View links.php
banasiak / SemanticVersionComparator.kt
Last active May 10, 2022 04:15
A version string comparator that adheres to the SemVer standard (
View SemanticVersionComparator.kt
class SemanticVersionComparator: Comparator<String> {
private val nonDigits: Regex = Regex("[^\\d.]")
private val onPeriods: Regex = Regex("\\.")
override fun compare(currentVersion: String, otherVersion: String): Int {
// remove everything after the "+" character, sanitize non-digits, then split on the periods
val semVerCurrent: MutableList<String> = currentVersion
View BanasiakCat.xml
<scheme name="BanasiakCat" version="142" parent_scheme="Darcula">
<property name="created">2021-11-04T15:11:45</property>
<property name="ide">AndroidStudio</property>
<property name="ideVersion">2020.3.1.24</property>
<property name="modified">2021-11-04T15:11:52</property>
<property name="originalScheme">BanasiakCat</property>
<option name="LOGCAT_ASSERT_OUTPUT">
banasiak /
Created January 16, 2018 22:38
Absolute last chance to log an exception and it's stack trace to logcat for an Android app.
public class MyApplication extends MultiDexApplication {
public void onCreate() {
if(BuildConfig.DEBUG) {
final Thread.UncaughtExceptionHandler handler = Thread.getDefaultUncaughtExceptionHandler();
(t, e) -> {;
handler.uncaughtException(t, e);
banasiak / KotlinEchoServer.kt
Created November 23, 2017 17:28
An example echo server written in Kotlin.
View KotlinEchoServer.kt
import kotlin.concurrent.thread
const val SERVER_PORT = 1337
fun main(args: Array<String>) {
banasiak /
Last active November 23, 2019 17:38
A python script that polls the CheerLights API and sets the LEDs of a Blinkt! hat.
# curl | bash
import blinkt
import requests
from collections import deque
from requests.adapters import HTTPAdapter
from requests.exceptions import ConnectionError
from sys import exit
from time import sleep
# pip3 install RPI.GPIO
# pip3 install adafruit-circuitpython-ads1x15
import board
import busio
import adafruit_ads1x15.ads1115 as ADS
import RPi.GPIO as GPIO
from adafruit_ads1x15.analog_in import AnalogIn
from board import SCL, SDA
from math import floor
View ReplaceNotepadWindows10.bat
@echo off
echo Create Backup copies of the original notepad.exe
copy C:\Windows\notepad.exe C:\Windows\notepad.exe.bak
copy C:\Windows\System32\notepad.exe C:\Windows\System32\notepad.exe.bak
copy C:\Windows\SysWOW64\notepad.exe C:\Windows\SysWOW64\notepad.exe.bak
echo Take Ownership of the files
takeown /F C:\Windows\notepad.exe /A
takeown /F C:\Windows\System32\notepad.exe /A
takeown /F C:\Windows\SysWOW64\notepad.exe /A
private class DebugModeTapListener implements View.OnClickListener {
private int tapCount = 0;
private long lastTap = SystemClock.elapsedRealtime();
public void onClick(final View v) {
final Context context = getApplicationContext();
long currentTap = SystemClock.elapsedRealtime();
if (currentTap - lastTap < 500) {