Skip to content

Instantly share code, notes, and snippets.

View boneskull's full-sized avatar
💀

Christopher Hiller boneskull

💀
View GitHub Profile
@boneskull
boneskull / README.md
Last active April 21, 2024 20:12
Run glances webserver as a user service (agent) on macOS

com.boneskull.glances-web

This launch agent will automatically start a glances web server

Installation

  1. Install Homebrew.
  2. Install glances. Execute brew install glances.
  3. Copy the .plist file in this gist into ~/Library/LaunchAgents/.
  4. EDIT the .plist: change /Users/boneskull/ to /Users//
@boneskull
boneskull / README.md
Last active April 10, 2024 12:47
example of how to debug mocha v4 if hanging

Here's an example of how to debug Mocha v4 if it hangs.

Ensure you're using a Node.js 8 or newer (or any version with async_hooks support).

If you run your test, you'll notice it hangs:

$ mocha test.js
@boneskull
boneskull / index.ts
Created April 9, 2024 04:20
xstate type bug
import { ActorRef, ActorRefFrom, assign, setup } from 'xstate';
type EmittedEvents = {type: 'BAR'};
const machineB = setup({
types: {
input: {} as {
a: ActorRef<any, any, EmittedEvents>
},
},
@boneskull
boneskull / fs-to-volume.mjs
Created March 1, 2024 20:50
create memfs volume from filesystem
#!/usr/bin/env node
/* eslint-disable n/shebang */
// @ts-check
/**
* Prints a `memfs` volume JSON from the filesystem given glob patterns and/or
* directories
*
* Directories are handled recursively
*
@boneskull
boneskull / svg-ellipsis.directive.ts
Created June 26, 2017 19:38
Angular directive to simulate "text-overflow: ellipsis" on an SVG text node
/**
* @see https://stackoverflow.com/questions/15975440/add-ellipses-to-overflowing-text-in-svg
* @example
* <!-- truncate at 200px -->
* <svg><svg:text ellipsis [text]="text to truncate" [width]="200"></svg:text></svg>
*/
import {
Directive,
ElementRef,
@boneskull
boneskull / uninstall_vmware.sh
Created January 14, 2014 04:46
completely uninstall vmware on mac
#!/usr/bin/env bash
# Usage: bash uninstall_vmware.bash
remove() {
entry="$1"
echo -ne "Removing \e[1;34m$entry\e[0m... "
sudo rm -rf "$entry" &> /tmp/uninstall-vmware.log
if [[ ! -e "$entry" ]]; then
echo -e "\e[1;32mOK\e[0m"
@boneskull
boneskull / README.md
Last active January 16, 2024 23:22
workaround for Empyrion workshop subscription limit (bash/shell/WSL)

There are many threads about this, but in a nutshell, the problem is that only a relatively small number of subscriptions can be shown in the blueprint library. I found myself having subscribed to some 700-odd blueprints before I realized this.

The workaround is to just copy the workshop blueprints into the game's blueprints folder. Each workshop blueprint is in its own folder, and only the files in those folders should be copied. But with 700 blueprints, doing this manually is unappealing.

I did this with a Bash script instead. It can be done with a one-liner, but I've split it up a bit to hopefully make it more approachable. Maybe there's an easier way?

Before starting, you'll need to determine:

  • The workshop download directory for Empyrion. On my system this is C:\Program Files (x86)\Steam\steamapps\workshop\content\383120. You may have to do some poking around, since I'm not sure if the number is constant.
  • The blueprint directory. On my system this is `C:\Program Files (x86)\Steam\ste
@boneskull
boneskull / README.md
Last active November 8, 2023 20:31
user launch agent to update & upgrade Homebrew daily

org.boneskull.homebrew-upgrade

This launch agent will automatically update & upgrade Homebrew every day. Upon success, it will send a notification.

UPDATED Nov 7 2023

Installation

  1. Install Homebrew.
  2. Install terminal-notifier. Execute brew install terminal-notifier.
@boneskull
boneskull / JS_OVERLOAD.md
Last active October 23, 2023 22:28
TypeScript Function Overloads in PURE JAVASCRIPT!!!!

UPDATE

As of TS v5.0.0, you can use @overload in JSDoc which means this document is obsolete.

How to Overload Functions using TypeScript Types in JavaScript

Summary

Yes, you can. No, it's not pretty.

The Situation

@boneskull
boneskull / nodejs-typescript-compat.md
Last active October 6, 2023 17:32
TypeScript in Node.js: Compatibility Notes

TypeScript in Node.js: Compatibility Notes

I tested some different packages with different TS configurations, and you won't believe what happened next.

Matrix of Failure

The top row of this table lists providers--modules which export type definitions. The left-hand column lists consumers--modules which import type definitions from the providers.

Each consumer header cell will contain three (3) values: