Skip to content

Instantly share code, notes, and snippets.

@LowByteFox
LowByteFox / readme.md
Last active November 19, 2023 11:06
Compiling bun on FreeBSD
  1. Install FreeBSD 13.2 in a VM and create dummy account, call it bun for example
  2. Install these packages as root using pkg install

ccache cmake git go libiconv libtool gmake ninja pkgconf python rust unzip ruby automake bash llvm16 llvm17 gcc13-dev npm icu libsysinfo

  1. Change bun's shell to /usr/local/bin/bash using chsh ( I recommend installing neovim and running the command as EDITOR=nvim chsh )

now always login as bun user

  1. Clone these repos - there is space between urls, git clone each one separately

https://github.com/Bun-BSD/codegen.git https://github.com/oven-sh/WebKit.git https://github.com/ziglang/zig.git https://github.com/Bun-BSD/bun.git Now we will compile all deps, make sure you are in home directory each time

  1. Building WebKit
    1. In your home directory create webkit.sh and write this into it
const std = @import("std");
pub fn Trie(comptime T: type) type {
return struct {
data: ?T,
childs: []?*Trie(T),
pub fn init(allocator: std.mem.Allocator) !*Trie(T) {
var trie = try allocator.create(Trie(T));
trie.childs = try allocator.alloc(?*Trie(T), 95);
@LowByteFox
LowByteFox / index.ts
Created April 7, 2023 08:46
Bun bun bundling files and being node_modulesless
// code extracted from https://github.com/Fire-The-Fox/buchta/blob/master/src/bundler.ts
// Show it some ❤️ by giving it a ⭐
import { spawnSync } from "bun";
import { existsSync, readFileSync, unlinkSync, writeFileSync } from "fs";
import { dirname, relative } from "path";
// run as bun ./index.ts a.ts b.ts ...
const a = process.argv
a.shift()
a.shift()
@LowByteFox
LowByteFox / Dockerfile
Created April 3, 2023 15:41
Docker image with alpine and bun
# Bun docker container running on alpine linux
# Dockerfile based on https://github.com/oven-sh/bun/blob/main/dockerhub/Dockerfile-alpine
FROM frolvlad/alpine-glibc AS build
WORKDIR /tmp/
RUN apk update && apk upgrade && apk add unzip
ADD https://github.com/oven-sh/bun/releases/latest/download/bun-linux-x64.zip bun-linux-x64.zip
RUN unzip bun-linux-x64.zip
@LowByteFox
LowByteFox / index.js
Last active February 25, 2023 08:15
Dynmap player notifier
// Dynmap player notifier
// Execute the javascript in the console of running dynmap website and let yourself be notified
// when someone enters/leaves your base so you would know when they may be stealing your stuff
// Copyright (C) Ján Gajdoš 2023
// change these
const discordWebhook = ""; // discord webhook url
const pos = [StartX, StartZ, EndX, EndZ]; // positions of your base
const ignore = []; // player names to ignore
const alarmMode = false; // if set to true, the webhook won't stop notifing