Skip to content

Instantly share code, notes, and snippets.

View benkant's full-sized avatar

Ben Giles benkant

View GitHub Profile
@benkant
benkant / browser.md
Last active March 19, 2024 02:31
Debugging Chromium on Linux

Use the following to get runtime logs:

browser() {
    chromium-browser --ozone-platform=wayland --enable-features=UseOzonePlatform,VaapiVideoDecoder --allow-sandbox-debugging --enable-logging=stderr --v=1 "$@"
}

After enabling coredumps (see instructions here), test chromium dumps cores to /var/coredumps:

@benkant
benkant / download_mp4s.sh
Created January 31, 2024 05:42
Download MP4s follow redirects
#!/bin/bash
#
# Downloads MP4 files from a specified webpage URL provided as a command-line argument,
# following redirects. It requires 'curl' for operation. If 'curl' is not found, it
# advises the user to install it.
#
# Usage:
# ./download_mp4s.sh <URL>
check_for_curl() {
@benkant
benkant / ChromeOS_third_party_support.md
Created January 20, 2024 04:11
ChromeOS business software support

Supported:

  • Google Meet
  • Zoom (Basic features via ChromeOS app)
  • Microsoft Teams (Web-based version)
  • Microsoft Office (Office Online)
  • Adobe Creative Cloud (Web-based versions)
  • Tableau (Web access to Tableau Server/Online)

Limited Support:

  • Zoom (Full desktop client not available)
@benkant
benkant / nvim_cef.sh
Created January 18, 2024 02:49
Basic nvim config for CEF/Chromium work
#!/bin/bash
# WARNING: installs nvim and ALE
# Install nvim plugins suitable for working with Chromium/CEF codebase:
# - shfmt
# - clang-format
# - eslint
# - yapf (PEP 8)
set -euo pipefail
@benkant
benkant / setup_vm_mnt.sh
Created January 18, 2024 02:06
Setup VMWare shared folders in guest
#!/bin/bash
# After sharing /tmp on the host to the guest in VMWare Fusion
# - add a mount point
# - allow my user acess
# - add it to /etc/fstab for persistence
set -euo pipefail
readonly MOUNT_POINT="/mnt/tmp"
readonly SHARED_FOLDER=".host:/tmp"
@benkant
benkant / detective_conan.py
Created June 28, 2023 12:18
Example conanfile.py with CMake, Google Sandbox API, Luau, raylib.
from conans import ConanFile, CMake
class MyProject(ConanFile):
name = "my_project"
version = "0.1"
settings = "os", "compiler", "build_type", "arch"
generators = "cmake"
requires = [
"sandboxed-api/1.0.0",
@benkant
benkant / simplevm.c
Created June 19, 2023 08:45 — forked from imbushuo/simplevm.c
Demonstrates Hypervisor.Framework usage in Apple Silicon
// simplevm.c: demonstrates Hypervisor.Framework usage in Apple Silicon
// Based on the work by @zhuowei
// @imbushuo - Nov 2020
// To build:
// Prepare the entitlement with BOTH com.apple.security.hypervisor and com.apple.vm.networking WHEN SIP IS OFF
// Prepare the entitlement com.apple.security.hypervisor and NO com.apple.vm.networking WHEN SIP IS ON
// ^ Per @never_released, tested on 11.0.1, idk why
// clang -o simplevm -O2 -framework Hypervisor -mmacosx-version-min=11.0 simplevm.c
// codesign --entitlements simplevm.entitlements --force -s - simplevm
@benkant
benkant / rndmac.sh
Created July 12, 2022 01:57
Set en0 to a random MAC address on macOS
#!/usr/bin/env bash
# Set en0 to a random MAC address on macOS
sudo /System/Library/PrivateFrameworks/Apple80211.framework/Versions/Current/Resources/airport -z
openssl rand -hex 6 | sed 's!\.!!g;s!\(..\)!\1:!g;s!:$!!' | xargs -t -0 sudo ifconfig en0 lladdr
sudo ifconfig en0 up
@benkant
benkant / UtilityFunctions.bcf
Created February 18, 2022 13:13
Calculate nett income after tax and Medicare for Australia 2021-2022 via Excel UDF
Option Explicit
Function INCOMENETTAU(ByVal gross As Double, Optional monthly = False) As Double
' (AU) Return the nett income after tax and Medicare Levy for the given gross income, optionally for a single month
Dim tax As Double
Dim medicareLevy As Double
Dim nett As Double
medicareLevy = gross * 0.02
@benkant
benkant / install-powershell.ps1
Created October 25, 2021 06:46
Install the latest PowerShell - run as Administrator
iex "& { $(irm https://aka.ms/install-powershell.ps1) } -UseMSI"