Skip to content

Instantly share code, notes, and snippets.

View AudunVN's full-sized avatar
❄️
Working on space-y web things

Space AudunVN

❄️
Working on space-y web things
View GitHub Profile
@AudunVN
AudunVN / bmp.js
Created June 3, 2025 15:08 — forked from siberex/bmp.js
Create BMP (windows bitmap) file with JavaScript using ArrayBuffer
"use strict";
const fs = require('fs')
, path = require('path')
;
const width = 1000
, height = 1000
, bpp = 24 // Bits per pixel
;
@AudunVN
AudunVN / mass_convert_bz.cmd
Created November 18, 2024 14:09 — forked from hhrhhr/mass_convert_bz.cmd
Subnautica Below Zero map maker
@echo off
rem ==== start of user settings ====
rem minimum level (0...24)
set LEVEL=16
rem input raw files from AssetStudio (https://github.com/Perfare/AssetStudio)
set MESH_DIR=h:\raw
@AudunVN
AudunVN / nixos-install-with-opt-in-state.txt
Created February 8, 2024 12:43 — forked from Quelklef/nixos-install-with-opt-in-state.txt
NixOS installation with opt-in state (darling erasure)
==================================
INSTALLING NIXOS WITH OPT-IN STATE
Based mostly on:
grahamc.com/blog/erase-your-darlings
gist.github.com/mx00s/ea2462a3fe6fdaa65692fe7ee824de3e
nixos.org/manual/nixos/stable/
@AudunVN
AudunVN / btrfs-guide.md
Created January 24, 2024 22:44 — forked from MaxXor/btrfs-guide.md
Btrfs guide to set up an LUKS-encrypted btrfs raid volume with included maintenance & recovery guide

Encrypted Btrfs storage setup and maintenance guide

Initial setup with LUKS/dm-crypt

This exemplary initial setup uses two devices /dev/sdb and /dev/sdc but can be applied to any amount of devices by following the steps with additional devices.

Create keyfile:

dd bs=64 count=1 if=/dev/urandom of=/etc/cryptkey iflag=fullblock
chmod 600 /etc/cryptkey
@AudunVN
AudunVN / telegramRestore.md
Created January 8, 2024 20:23 — forked from avivace/telegramRestore.md
Restore deleted Telegram messages from groups

Restore deleted Telegram messages, medias and files from groups

There's not telegram API method for this, we need to call MTProto methods to retrieve messages from the "Recent Actions" (Admin Log) since deleted messages (and medias) gets moved there for 48 hours before the permanent deletion.

from telethon import TelegramClient, events, sync
from telethon.tl.types import InputChannel, PeerChannel
@AudunVN
AudunVN / _readme.md
Created March 27, 2023 22:17 — forked from stecman/_readme.md
Brother P-Touch PT-P300BT bluetooth driver python

Controlling the Brother P-Touch Cube label maker from a computer

The Brother PTP300BT label maker is intended to be controlled using the official Brother P-Touch Design & Print iOS/Android app. The app has arbitrary limits on what you can print (1 text object and up to 3 preset icons), so I thought it would be a fun challenge to reverse engineer the protocol to print whatever I wanted.

Python code at the bottom if you want to skip the fine details.

Process

Intitially I had a quick peek at the Android APK to see if there was any useful information inside. The code that handles the communication with the printer in Print&Design turned out to be a native library, but the app clearly prepares a bitmap image and passes it to this native library for printing. Bitmaps are definitely something we can work with.

// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@AudunVN
AudunVN / websocket_proxy.js
Created November 10, 2022 17:13 — forked from Checksum/websocket_proxy.js
Intercepting WebSockets in the browser using JavaScript
const WebSocketProxy = new Proxy(window.WebSocket, {
construct(target, args) {
console.log("Proxying WebSocket connection", ...args);
const ws = new target(...args);
// Configurable hooks
ws.hooks = {
beforeSend: () => null,
beforeReceive: () => null
};
# based on https://github.com/amber-sixel/PythonCatPrinter.git
# can be used as a raw postscript printer (a4, one page only) on port 9100
#
# status : curl --location --request GET 'localhost:5000'
#
# curl --location --request POST 'localhost:5000' \
# --form 'image=@"/image.jpg"' \ #optional
# --form 'text="hello world"' \ #optional
# --form 'size="48"' \ #optional
@AudunVN
AudunVN / sample-linux.c
Created November 17, 2016 01:26 — forked from davidzchen/sample-linux.c
Sample C code using the Linux kernel coding style
/*
* Sample file using the Linux kernel coding convention.
*
* https://www.kernel.org/doc/Documentation/CodingStyle
*
* General rules:
* - Indents are tabs and must be 8 spaces wide.
* - Each line must be at most 80 characters long.
* - Use C-style comments.
* - File names should be lower-case.c