Skip to content

Instantly share code, notes, and snippets.

View primaryobjects's full-sized avatar

Kory Becker primaryobjects

View GitHub Profile
@primaryobjects
primaryobjects / chrome-version.py
Last active March 22, 2024 12:04
Detect the version of Chrome installed on Windows, Linux, Mac. Cross-platform using Python, native OS detection, does not require Selenium.
#
# Programmatically detect the version of the Chrome web browser installed on the PC.
# Compatible with Windows, Mac, Linux.
# Written in Python.
# Uses native OS detection. Does not require Selenium nor the Chrome web driver.
#
import os
import re
from sys import platform
@primaryobjects
primaryobjects / ff2-utility.au3
Last active February 25, 2024 21:28
Automatic Level 16 Spells in Final Fantasy II using Emulator for PS1
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$count = 125
$label = 0
$button = 0
Func _WriteErrorLog($ErrorMessage)
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage)
@primaryobjects
primaryobjects / autility.au3
Last active February 20, 2024 20:43
AutoIt utility for easier SendKey, commands. Automate Final Fantasy II 2 level-up, ff2
#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$count = 125
$label = 0
$button = 0
Func _WriteErrorLog($ErrorMessage)
FileWriteLine(@ScriptDir & "\" & @ScriptName & ".log", @HOUR & ":" & @MIN & ":" & @SEC & ": " & $ErrorMessage)
@primaryobjects
primaryobjects / content.js
Last active February 20, 2024 02:59
How to download multiple files and images in a Chrome extension.
// in your extension's background script
chrome.browserAction.onClicked.addListener(function(tab) {
// inject the content script to the current tab
chrome.tabs.executeScript(tab.id, {file: 'content.js'});
});
// listen for messages from the content script
chrome.runtime.onMessage.addListener(function(message, sender, sendResponse) {
if (message.action == 'getImages') {
// message.data is an array of image urls
@primaryobjects
primaryobjects / logic.py
Created July 31, 2021 15:16
Quantum Computing logic gates for XOR, AND, NAND, OR using Qiskit.
from qiskit import qiskit, QuantumCircuit
def execute(func):
print('0 0: {}'.format(func(0, 0)))
print('0 1: {}'.format(func(0, 1)))
print('1 0: {}'.format(func(1, 0)))
print('1 1: {}'.format(func(1, 1)))
def xor(a, b):
"""
@primaryobjects
primaryobjects / readme.md
Last active January 31, 2024 19:43
How to remote desktop from Linux Mint to Windows 10 with AzureAD Azure AD login

How to remote desktop from Linux Mint to Windows 10 with AzureAD

The following steps detail how to connect over Remote Desktop from Linux Mint or Ubuntu to Windows 10 with an AzureAD username and password login account.

  1. In Windows 10, right-click This PC or My Computer and select Properties.
  2. Click Remote Settings.
  3. Check the option Allow remote connections to this computer.
  4. Uncheck the option Allow connections only from computers running Remote Desktop with Network Level Authentication.
  5. Click OK.
@primaryobjects
primaryobjects / HomeController.cs
Created January 29, 2024 04:18
Example of reversing a linked list in ASP .NET MVC.
using System.Diagnostics;
using Microsoft.AspNetCore.Mvc;
using ReverseLinkedListApp.Models;
namespace ReverseLinkedListApp.Controllers;
public class HomeController : Controller
{
private readonly ILogger<HomeController> _logger;
@primaryobjects
primaryobjects / data.py
Last active January 27, 2024 15:18
LLM ChatGPT prompt engineering accuracy statistics. Using F-score and accuracy to measure effectiveness of prompts for classification. https://learn.deeplearning.ai/chatgpt-prompt-eng/lesson/1/introduction
messages = [
{'content': 'I hate this food.', 'truth': 1},
{'content': 'This movie is terrible.', 'truth': 1},
{'content': 'I really like this play.', 'truth': 0},
{'content': 'I am just not sure.', 'truth': 0},
{'content': 'I can\'t believe you would do something like that!', 'truth': 1},
{'content': 'This is absolutely unacceptable!', 'truth': 1},
{'content': 'I am so angry right now, I can\'t even think straight.', 'truth': 1},
{'content': 'How could you be so thoughtless?', 'truth': 1},
{'content': 'You have no idea how much you\'ve hurt me.', 'truth': 1},
function birthday1(s, d, m) {
// Naive approach, O(n^2)
let count = 0;
if (s && s.length) {
for (let i=0; i<s.length - m + 1; i++) {
// Find all contiguous groups of m-length from this point.
let sum = 0;
for (let j=i; j<i+m; j++) {
/**
* const PriorityQueue = require('priority-queue-js');
*/
class Solution {
/**
* @param {number} n
* @param {number[][]} edges
* @param {number} src
* @returns {Object}