Skip to content

Instantly share code, notes, and snippets.

Just some notes and references for myself.

  • In bash, you can access your C:\ drive via /mnt/c/
  • ~ = C:\Users\MLM\AppData\Local\lxss\home\mlm and is different from your Windows user directory C:\Users\MLM

How to google things

@MadLittleMods
MadLittleMods / write_log.txt
Last active August 9, 2023 07:07
Example log for https://github.com/MadLittleMods/vga-simulator - Log format: `current_sim_time time_units: hs vs red green blue`
This file has been truncated, but you can view the full file.
10 ns: U U UUU UUU UU
30 ns: U U UUU UUU UU
50 ns: 1 1 000 000 00
70 ns: 1 1 000 000 00
90 ns: 1 1 000 000 00
110 ns: 1 1 000 000 00
130 ns: 1 1 000 000 00
150 ns: 1 1 000 000 00
170 ns: 1 1 000 000 00
190 ns: 1 1 000 000 00

When using a small frequency value with analogWrite(pinString, dutyCycle, frequencyHz, callback), the following error can be thrown.

var b = require('bonescript');
b.pinMode('P9_14', b.OUTPUT);
b.analogWrite('P9_14', 0.5, 10, function(res) { console.log(JSON.stringify(res)); });
@MadLittleMods
MadLittleMods / GenerateCustomFontWindow.cs
Last active March 1, 2023 16:30
Unity Editor Window script to generate fonts. See: http://gamedev.stackexchange.com/a/91936/16587
using UnityEngine;
using UnityEditor;
using System.Collections;
using System.Collections.Generic;
using System.Xml;
using System;
using System.Reflection;
// This Unity Editor window was created for this GD.SE question: http://gamedev.stackexchange.com/a/91936/16587
// The XML->Font is from the question asker, Almo
@MadLittleMods
MadLittleMods / fix-hallmark-card-studio-on-windows-10.md
Last active December 23, 2022 04:48
Fix Hallmark Card Studio failing to launch on Windows 10 - Exception: Unable to load the native components of SQL Server Compact

Problem

If you have an old version of Hallmark Card Studio and recently upgraded to Windows 10, you might be running into the following error when launching the program. The specific program I ran into this with was Hallmark Home Card Studio version 22/hcs.

A problem was encountered accessing the SQL database. Exception: Unable to load the native components of SQL Server Compact corresponding to the ADO.NET provider of version 8080. Install the correct version of SQL Server Compact. Refer to KB article 974247 for more details

@MadLittleMods
MadLittleMods / oc-cross-project-logs.md
Created September 1, 2022 18:49
View logs across projects in Red Hat OpenShift

With Red Hat OpenShift, here's how to view logs of a pod in a different project than the one currently active:

oc logs -n <project> <pod>

Option as documented but obscure and hard to follow because the option is namespace but oc always references them as projects everywhere else:

@MadLittleMods
MadLittleMods / sort-google-photos-dump.md
Last active July 29, 2022 03:08
Fix photos sorted in maddening wrong order by date

Problem

We were dealing with an out of order dump of photos from a Google photos album and wanting to upload to Facebook. It consisted of jpg and heic photos from a iPhone 8 and Pixel 4a so the metadata was different.

Sorting by Date Created in the macOS finder was out of order and Facebook seemed to sort in the same way. It didn't make any sense because we were seeing 4:55am photos sorted below 4:56pm photos (same day). Regardless of Italian timezone, they shouldn't be sorting like that (it's only GMT+2 vs my local GMT-6) which is an 8 hour difference compared the 12 hour difference shown in the photo date/times. Even looking at the exif metadata, it didn't make any sense what it was pulling from to make it sort that way.

Solution

This uses exiftool to read and do the file manipulation.

@MadLittleMods
MadLittleMods / CharacterDriver.cs
Last active March 15, 2022 09:24
Unity Character Driver/Controller for Movement, Jumping, and Gravity
using UnityEngine;
using System.Collections;
[RequireComponent (typeof(CharacterController))]
public class CharacterDriver : MonoBehaviour {
public class CharacterState
{
public Vector3 position = new Vector3();