Skip to content

Instantly share code, notes, and snippets.

@t3knoid
t3knoid / macbook_retina_2017_on_Ubuntu_24.md
Last active January 25, 2026 16:37
Fixed audio and bluetooth issue of Ubuntu 24 installation on a Macbook Retina 2017

Ubuntu 24.04 on Macbook Retina 2017

The following documents what had to be done to fixed Bluetooth and Sound issues when Ubuntu 24.

System

Apple Inc. MacBook10.1 Intel® Core™ i7-7Y75 × 4

Audio

@t3knoid
t3knoid / ByteListComparer.cs
Created March 11, 2022 15:48
Use this comparer to sort a list of bytes,
///
/// Usage listBytes.Sort(new ByteListComparer());
///
public class ByteListComparer : IComparer<IList<byte>>
{
public int Compare(IList<byte> x, IList<byte> y)
{
int result;
for (int index = 0; index < Math.Min(x.Count, y.Count); index++)
{
@t3knoid
t3knoid / ConsoleProgressBar.cs
Created February 11, 2022 14:32
An example of emulating a progress bar in console application using c#
# Copied from https://www.codeproject.com/Tips/5255878/A-Console-Progress-Bar-in-Csharp
using System;
namespace CU
{
static class ConsoleUtility
{
const char _block = '■';
const string _back = "\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b\b";
@t3knoid
t3knoid / Renderers.cs
Created November 5, 2020 14:02
This is an example on how to use a toolstrip render. This example shows by making a ToolStripButton object non-clickable by changing the background colors to match the system colors in every case.
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace CustomRenders
{
@t3knoid
t3knoid / JenkinsDynamicChoiceParameterFromFolder
Last active April 3, 2021 08:30
Create a Jenkins Dynamic Choice Parameter using values from a given folder
import groovy.io.FileType
def builds = []
def versions = []
def folder= "" // Define folder where to enumerate
def dir = new File(folder)
dir.eachFile (FileType.DIRECTORIES) {
if (!it.name.startsWith('_')) {
// Parse out version number
// format of folder is "2020-03-06 v 1.0.0.448 Daily"
@t3knoid
t3knoid / JiraSelectIssue.groovy
Created March 6, 2020 21:34
Jenkins Dynamic Choice Parameter script that displaces JIRA tickets to choose from
// Displays a Jira issue to select
import groovy.json.JsonSlurper
import hudson.model.*
import jenkins.model.*
import hudson.AbortException
def jiraRoot = ""
def jirauserName = ""
def jirapassword = ""
def searchAPI = "${jiraRoot}/rest/api/2/search?jql" // Use this base URL to perform a JQL search. Make sure to URL encode the search string
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Data;
using System.Data.SqlClient;
namespace DatabaseProject
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using kCura.Relativity.Client.DTOs;
using DTOs = kCura.Relativity.Client.DTOs;
using Relativity.Services.ServiceProxy;
@t3knoid
t3knoid / ProjectInstaller.cs
Created April 29, 2019 20:19
Modify Windows service registry key so that we can pass parameters.
private void serviceInstaller1_AfterInstall(object sender, System.Configuration.Install.InstallEventArgs e)
{
try
{
RegistryKey servicesKey = Registry.LocalMachine.OpenSubKey(@"System\CurrentControlSet\Services\");
RegistryKey serviceKey = servicesKey.OpenSubKey(serviceInstaller1.ServiceName, true);
serviceKey.SetValue("ImagePath", (string)serviceKey.GetValue("ImagePath") + " dispatcher= " + Context.Parameters["dispatcher"]);
}
catch (System.Exception ex)
{
@t3knoid
t3knoid / SQLite.cs
Last active October 7, 2019 19:31
A handy class to interface with SQLite databases
using System;
using System.Data.SQLite;
using System.Text;
class SQLite {
static string connectionFormat = "Data Source={0};Version=3; FailIfMissing=True; Foreign Keys=True;";
static public SQLiteResponse Select(string databasePath, string sql) {
string connectionString = String.Format(connectionFormat, databasePath);
SQLiteResponse sqliteResponse = new SQLiteResponse();