Here is a simple fragment shader with uniform buffers:
const std = @import("std");
const gpu = std.gpu;
const UBO = extern struct {
object_color: @Vector(4, f32),
light_color: @Vector(4, f32),
const std = @import("std"); | |
pub fn main() !void { | |
var gpa = std.heap.GeneralPurposeAllocator(.{}){}; | |
const allocator = gpa.allocator(); | |
defer { | |
const deinit_status = gpa.deinit(); | |
if (deinit_status == .leak) @panic("TEST FAIL"); | |
} |
import tarfile | |
import hashlib | |
import os | |
import sys | |
import requests | |
import io | |
def compute_hash(tar_path, is_url=False): | |
if is_url: | |
response = requests.get(tar_path) |
You can find this feature in Settings > Download Twitter Archive. It might take 24 hours to receive.
Unzip the file and open the data
folder in your terminal:
cd ~/Downloads/twitter-archive-zip-you-downloaded/data
(I have seen reports that this function may no longer be working, so this guide is mostly useful to those who were lucky enough to already have downloaded their archive.)
import { suite } from "@thi.ng/bench"; | |
const w = 640; | |
const h = 480; | |
const idata = new ImageData(w, h); | |
// exposed u8clampedarray | |
const u8 = idata.data; | |
// rewrap same memory as u32 | |
const u32 = new Uint32Array(u8.buffer); |
/** | |
* General-purpose NodeJS CLI/API wrapping the Stable-Diffusion python scripts. | |
* | |
* Note that this uses an older fork of stable-diffusion | |
* with the 'txt2img.py' script, and that script was modified to | |
* support the --outfile command. | |
*/ | |
var { spawn, exec } = require("child_process"); | |
var path = require("path"); |
For work I have an Intel Core i5 MacBook. With the Docker Desktop license changes I looked into minikube and Multipass but both failed when I got on our VPN with Cisco AnyConnect due to bridged networking in hyperkit (see links at bottom).
I realized I would be happy SSHing into a local Linux VM but passed on VirtualBox to avoid depending on legacy system extensions. I landed on libvirt for the VM, then realized I could remove libvirt from the equation to finally end up at this quick, simple setup for an Ubuntu VM on macOS with QEMU.
First, install QEMU (see https://wiki.qemu.org/Hosts/Mac for other o
### | |
### [2023-06-19] UPDATE: Just tried to use my instructions again on a fresh install and it failed in a number of places. | |
###. Not sure if I'll update this gist (though I realise it seems to still have some traffic), but here's a list of | |
###. things to watch out for: | |
### - Check out the `nix-darwin` instructions, as they have changed. | |
### - There's a home manager gotcha https://github.com/nix-community/home-manager/issues/4026 | |
### | |
# I found some good resources but they seem to do a bit too much (maybe from a time when there were more bugs). | |
# So here's a minimal Gist which worked for me as an install on a new M1 Pro. |
This shows how to build a nontrivial program using Zig+Emscripten or C+Emscripten.
In both cases Emscripten is only used as a linker, that is the frontend is either zig
or clang
.
"Nontrivial" here means the program uses interesting Emscripten features:
/* You can aslo add */ | |
canvas { | |
image-rendering: optimizeSpeed; | |
image-rendering: -moz-crisp-edges; | |
image-rendering: -webkit-optimize-contrast; | |
image-rendering: optimize-contrast; | |
-ms-interpolation-mode: nearest-neighbor; | |
} |