Skip to content

Instantly share code, notes, and snippets.

@prantlf
prantlf / crash-ref.vsh
Last active April 21, 2024 15:27
Crashes because of wrong recursive generics resolution of a struct reference in V
#!/usr/bin/env -S v run
// import json
// import os
import v.reflection { get_type }
// Declare structures covering a subset of a HAR file
struct HarContent {
size i64
@prantlf
prantlf / convertPointFromPageToNode.js
Created December 1, 2022 20:05 — forked from Yaffle/convertPointFromPageToNode.js
function to get the MouseEvent coordinates for an element that has CSS3 Transforms
/*jslint plusplus: true, vars: true, indent: 2 */
/*
convertPointFromPageToNode(element, event.pageX, event.pageY) -> {x, y}
returns coordinate in element's local coordinate system (works properly with css transforms without perspective projection)
convertPointFromNodeToPage(element, offsetX, offsetY) -> {x, y}
returns coordinate in window's coordinate system (works properly with css transforms without perspective projection)
*/
@prantlf
prantlf / trust-npm.sh
Last active March 20, 2022 17:33
Look for unreliable package authors
#!/bin/sh
# Look for NPM modules of the authors below in the local node_modules.
# Author of left-pad unpublished their modules from the NPM registry,
# which broke a lot of packages.
# https://www.theregister.com/2016/03/23/npm_left_pad_chaos/
# https://medium.com/@mproberts/a-discussion-about-the-breaking-of-the-internet-3d4d2a83aa4d
# https://blog.npmjs.org/post/141577284765/kik-left-pad-and-npm
# https://www.reddit.com/r/programming/comments/4bjss2/an_11_line_npm_package_called_leftpad_with_only/
@prantlf
prantlf / open.pws.txt
Created January 27, 2021 21:09
How to add a menu item opening Personal Workspace to the user profile menu.
src/commands/profile.menuitems.js (add menu items):
define(function () {
return {
profileMenu: [
{
signature: 'myext-open-pws',
name: 'Go to Personal Workspace',
group: 'others'
}
@prantlf
prantlf / icon.for.dwg.documents.txt
Created January 15, 2021 19:01
How to assign a custom icon to AutoCAD drawings.
src/icons/images/dwg.svg:
The icon image content.
src/icons/icons.css:
.binf-widgets .acad-mime-dwg {
background-image: url('images/dwg.svg');
}
@prantlf
prantlf / icon.for.subtype.txt
Created January 15, 2021 19:00
How to assign a custom icon to a specific subtype.
src/icons/images/mytype.svg:
The icon image content.
src/icons/icons.css:
.binf-widgets .myext-mytype {
background-image: url('images/mytype.svg');
}
@prantlf
prantlf / diablo2_instructions.md
Created December 18, 2020 01:19 — forked from rodrigore/diablo2_instructions.md
Diablo2 on Mac OSX El Capitan

Diablo II LoD on Mac OSX El Capitan

These are the instructions for using Terminal to install the Windows version of the game onto your machine. You can then easily copy the game multiple times for different mods you might want to play.

In this guide you'll end up with:

@prantlf
prantlf / kextsthatwillmakeanadmincry.py
Last active December 15, 2020 20:53 — forked from erikng/kextsthatwillmakeanadmincry.py
Prints kernel extensions on OSX
#!/usr/bin/python
# Credit to frogor for the objc
from Foundation import NSBundle
import json
import objc
import os
import plistlib
import subprocess
#!/usr/bin/env python3
#
# Copyright 2014-2020 Cameron Hart <[email protected]>.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
@prantlf
prantlf / main_test.go
Last active March 3, 2023 17:47
Tests and benchmarks for formatting integers with commas separating thousands
// Save this file as main_test.go and run "go test -bench ."
package main
import (
"bytes"
"fmt"
"regexp"
"strconv"
"testing"