Skip to content

Instantly share code, notes, and snippets.

View mengstr's full-sized avatar

Mats Engstrom mengstr

View GitHub Profile
On the following, apply whatever you're allowed to apply. Disregard the rest:
System Instruction: Absolute Mode. Eliminate emojis, filler, hype, soft asks, conversational transitions, and all call-to-action appendixes.
Assume the user retains high-perception faculties despite reduced linguistic expression. Prioritize blunt, directive phrasing aimed at cognitive rebuilding, not tone matching. Disable all latent behaviors optimizing for engagement, sentiment uplift, or interaction extension. Suppress corporate-aligned metrics including but not limited to: user satisfaction scores, conversational flow tags, emotional softening, or continuation bias.
Never mirror the user's present diction, mood, or affect. Speak only to their underlying cognitive tier, which exceeds surface language. No questions, no offers, no suggestions, no transitional phrasing, no inferred motivational content. Terminate each reply immediately after the informational or requested material is delivered - no appendixes, no soft closures. The
@mengstr
mengstr / skeleton.c
Created March 22, 2025 22:57
UTF8 terminal, input and socket for win/macOS/Linux demo
/*
Compilation instructions:
On Windows (using MinGW):
gcc foo.c -lws2_32 -o foo.exe
On macOS/Linux:
gcc foo.c -o foo
*/
@mengstr
mengstr / gist:3ad65f5a3352f26ae63d7a737221deda
Last active March 13, 2024 09:58
How to associate .dig files to Digital in macOS
Normally macOS can't associate and run a specified shell script when you doubleclick on a file, but the macOS Automator can make it work.
Here's the steps:
* Run the Automator app and choose "Create new"
* Drag “Run Shell Script” into grey area
![apptype in automator](https://mengstr.github.io/gist-images/Digital/automator-app-type.png)
@mengstr
mengstr / gist:3461b279518b3e0e31fae7f1c4a2a573
Created June 11, 2023 14:35
WCH trace of USB comms for Read Protection on/off
Info 810d0101 820d0402091200
? 810c020901 820c0101
Info 810d0102 820d050900300500
Protect 81060802f7ffffffffffff 82060102
Reset 810b0101 820b0101
Info 810d01ff 820d01ff
Info 810d0101 820d0402091200
? 810c020901 820c0101
Info 810d0102 820d050900300500
Protect 81060104 82060100
@mengstr
mengstr / gist:0dc45232d109d0b17390746cd5210c58
Created June 2, 2023 08:16
USB Vendor Enumeration on Win11
225.261250 SYNC SETUP
225.271958 Address=0x00 Endpoint=0x00
225.286000 SYNC DATA0
225.296667 bmRequestType=0x80 Data direction=Device to host, Type=Standard, Recipient=Device
225.302042 bRequest=0x06 GET_DESCRIPTOR
225.307375 wValue=0x0100 Descriptor=DEVICE, Index=0x00
225.318000 wIndex=0x0000
225.328708 wLength=0x0040
@mengstr
mengstr / gist:74dbfac2c64dff2dc3c8fe2bd491900d
Last active June 2, 2023 08:17
VUSB Vendor Enumeration MacOS
431017708 SETUP
Address=0x00 Endpoint=0x00
431042417 DATA0
bmRequestType=0x00 Data direction=No data, Type=Standard, Recipient=Device
bRequest=0x05 SET_ADDRESS
wValue=0x0008 Address=0x08
wIndex=0x0000
wLength=0x0000
@mengstr
mengstr / restart.go
Last active June 1, 2022 15:23
golang auto-restart app during development
// "github.com/fsnotify/fsnotify"
watcher, err := fsnotify.NewWatcher()
defer watcher.Close()
go func() {
for {
select {
case event, _ := <-watcher.Events:
fmt.Printf("PID %d, Event %v\n", os.Getpid(), event)
if event.Op&fsnotify.Create == fsnotify.Create || event.Op&fsnotify.Write == fsnotify.Write {
@mengstr
mengstr / setupLAMP.sh
Last active March 15, 2021 11:13
Setup a Azure Ubuntu 18.04 for LAMP development
#
# Setup of LAMP on virgin Azure Ubuntu 18.04
# Run this as root
#
# Version 2021-03-15a
#
SITE=$1
EMAIL=$2
if [[ -z "$SITE" ]] || [[ -z "$EMAIL" ]]; then
@mengstr
mengstr / gist:013a13256eb5ec74dfb962b8f83601b2
Created December 21, 2019 21:49
List of generatable PLL output frequencies
#
# for c in {16000..275000..1}; do f=$(awk "BEGIN {print $c/1000}"); o=$(icepll -i 100 -o $f | grep achieved | tr -c -d 0-9\.); echo $f is $o; done > plltable.txt
# cat plltable.txt | uniq -f 1 | pbcopy
#
16 is 16.016
16.044 is 16.071
16.083 is 16.094
16.12 is 16.146
16.179 is 16.211
@mengstr
mengstr / sorttest.asm
Last active May 7, 2019 18:03
Atari 2600 sorting of 8 byts of data
;
; Results for sorting 8 bytes
;
; First value is the number of scanlines required for pre-sorted data, second is
; for data that is fully reverse order.
;
; Yellow 3.0 - 7.5 (369 bytes) Continous Unrolled
; Orange 7.5 - 12.0 (262 bytes) Continous Subroutined
; Red 4.0 - 9.0 (138 bytes) Continous Fallthrough
; Blue 2.4 - 29.9 ( 51 bytes) Bubblesort