Skip to content

Instantly share code, notes, and snippets.

View lundman's full-sized avatar

Jorgen Lundman lundman

View GitHub Profile
@lundman
lundman / notarytool_remote.sh
Created December 9, 2023 04:51
xcrun notarytool replacement for macOS 10.14 using ssh
#!/bin/bash
#
# Replacement commandline tool of "notarytool" for 10.14.
# Will ssh to host specified and run "xcrun notarytool" on
# that server.
#
# Arguments are copied as is, and expects the last argument to
# be the filename.
#
# notarytool_remote.sh submit --wait
@lundman
lundman / details.md
Last active July 12, 2023 14:21
Attempting IP6 with auひかり using EdgeRouter

au HIKARI is DUID-LL and should be represented as "00:03:00:01:xx:xx:xx:xx:xx:xx"

So using MAC address aa:bb:cc:dd:ee:ff

My WAN is eth1

configure
set interfaces ethernet eth1 dhcpv6-pd duid "00:03:00:01:aa:bb:cc:dd:ee:ff"
@lundman
lundman / Win FS events monitoring
Last active June 6, 2023 06:06
Monitoring filesystem events/changes with powershell
* Load PowerShell
PS C:\WINDOWS\system32>
$watcher = New-Object System.IO.FileSystemWatcher
$watcher.IncludeSubdirectories = $true
$watcher.Path = 'E:\'
$watcher.EnableRaisingEvents = $true
$action =
{
$path = $event.SourceEventArgs.FullPath
@lundman
lundman / test.S
Last active March 1, 2023 10:30
Testing macros in clang
.macro bytereg reg
.if \reg == %r8 || \reg == %r9 || \reg == %r10 || \reg == %r11 || \reg == %r12 || \reg == %r13 || \reg == %r14 || \reg == %r15
.set breg, \reg\()b
.elseif \reg == %rax
.set breg, %al
.elseif \reg == %rcx
.set breg, %cl
.elseif \reg == %rdx
.set breg, %dl
@lundman
lundman / asm.S
Created February 2, 2023 06:01
M1 ARM64 assembler
// Changes needed to assemble on macOS (from Linux) on M1/ARM64e
/*
* semi-colon is comment, so use secret %%
* M1 is 64 bit only
* and needs "_" prepended
*/
#define ENTRY(x) \
@lundman
lundman / wrapper.c
Last active November 18, 2022 08:48
inline assembly to call sysv_abi from ms_abi
/* Update 3 - experimenting with explicit first, all args look correct */
void XXXzfs_blake3_compress_xof_sse2(const uint32_t cv[8],
const uint8_t block[BLAKE3_BLOCK_LEN], uint8_t block_len,
uint64_t counter, uint8_t flags, uint8_t out[64])
{
long ret;
__asm__ (
"mov %[p6], %%r9 \n\t"
"mov %[p5], %%r8 \n\t"
@lundman
lundman / github.md
Last active April 21, 2022 08:02
github collapsable comments

<details>
<summary> code diff </summary>
<p>

```
text
```
\

@lundman
lundman / patch.diff
Created April 13, 2022 05:53
Working around expired certificate with OmniOS pkg
For output like:
Framework error: code: 60 reason: SSL certificate problem: certificate has expir
ed
URL: 'http://pkg.omniti.com/omnios/r151022'
Whilst trying to update 151016 OmniOS TI to CE, and unable to find certificates both still valid, and not too-new.
/usr/lib/python2.6/vendor-packages/pkg/client/transport# dtff -rub engine.py orig-engine.py
--- engine.py Wed Apr 13 12:02:48 2022
@lundman
lundman / time.h
Last active May 13, 2023 17:11
time.h style timers for macOS
#include <sys/stdtypes.h>
#include <stdbool.h>
#include <mach/boolean.h>
#include <sys/errno.h>
#include <stdlib.h>
#include <dispatch/dispatch.h>
#if !defined(MAC_OS_X_VERSION_10_12) || \
(MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_12)
@lundman
lundman / lfswatcher.c
Created December 3, 2020 06:42
Small tool using libfswatcher to read a list of files to monitor - requires patched libfswatcher for watch_access method.
/*
* Quick & Dirty libfswatch wrapper
*
* gcc -o lfswatch lfswatch.c -I/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/c -L/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/.libs -R/export/home/lundman/fswatch-1.15.0/libfswatch/src/libfswatch/.libs -lfswatch
*
* - lundman
*/
#include <stdio.h>
#include <unistd.h>