Skip to content

Instantly share code, notes, and snippets.

View cecilemuller's full-sized avatar

Cecile Muller cecilemuller

View GitHub Profile
@cecilemuller
cecilemuller / README.md
Last active October 20, 2023 09:42
Docker Compose Watch

Example for compose watch:

  • "watch" requires a "build" section
  • files created at runtime in the host get copied to the container
  • files deleted in the host aren't deleted in the container
  • files created in the container at build time aren't copied back to the host
  • files created in the container at runtime aren't copied back to the host
  • you'd still need a "volume" if the host must access files generated in the container
@fakuivan
fakuivan / dishonored2_cvars.txt
Last active October 7, 2023 22:39
All cvars for Dishonored 2 as of version ``1.77.9.0``, in the format: <cvar struct address> | <cvar name> = <cvar default value> | <cvar int value address> -> <current int value>\n<cvar description>
Dishonored2.exe+3BFC7F0 | aas_subdivisionSize = 64 | Dishonored2.exe+3BFC818 -> 64
the size of subdivisions to use for debug drawing
Dishonored2.exe+340CC20 | achievements_Verbose = 0 | Dishonored2.exe+340CC48 -> 0
debug spam for achievements
Dishonored2.exe+3BFA570 | ai_debugCam = 0 | Dishonored2.exe+3BFA598 -> 0
enable debug camera
Dishonored2.exe+3BFA470 | ai_debugScript = -1 | Dishonored2.exe+3BFA498 -> 4294967295
@scottjehl
scottjehl / noncritcss.md
Last active August 12, 2023 16:57
Comparing two ways to load non-critical CSS

I wanted to figure out the fastest way to load non-critical CSS so that the impact on initial page drawing is minimal.

TL;DR: Here's the solution I ended up with: https://github.com/filamentgroup/loadCSS/


For async JavaScript file requests, we have the async attribute to make this easy, but CSS file requests have no similar standard mechanism (at least, none that will still apply the CSS after loading - here are some async CSS loading conditions that do apply when CSS is inapplicable to media: https://gist.github.com/igrigorik/2935269#file-notes-md ).

Seems there are a couple ways to load and apply a CSS file in a non-blocking manner:

@cecilemuller
cecilemuller / commands.sh
Last active August 2, 2023 13:30
LLM on MacOS
brew install llm
llm install llm-llama-cpp
llm install llama-cpp-python
llm llama-cpp download-model https://huggingface.co/TheBloke/Llama-2-7B-Chat-GGML/resolve/main/llama-2-7b-chat.ggmlv3.q8_0.bin --alias llama2-7b --llama2-chat
llm llama-cpp download-model https://huggingface.co/TheBloke/Llama-2-13B-chat-GGML/resolve/main/llama-2-13b-chat.ggmlv3.q8_0.bin --alias llama2-13b --llama2-chat
llm llama-cpp download-model https://huggingface.co/TheBloke/Wizard-Vicuna-7B-Uncensored-GGML/resolve/main/Wizard-Vicuna-7B-Uncensored.ggmlv3.q4_0.bin --alias wizard-7b --alias autocomplete
llm -m llama2-7b 'Tell me a joke about a bird' --system 'You are funny'
llm -m llama2-13b 'Tell me a joke about a bird' --system 'You are funny'
@cecilemuller
cecilemuller / pwsh.mjs
Last active July 24, 2023 09:44
Run Powershell 7 commands in Node.js
import {exec} from "node:child_process";
/**
* Runs a Powershell 7 command.
* @param {string} command
* @returns {string}
* @example const stdout = await pwsh(`Write-Output "Hello World"`);
* @example const stdout = await pwsh(`Write-Output "Hello"; Write-Output "World"`);
*/
export async function pwsh(command) {
@cecilemuller
cecilemuller / UIView+distort.swift
Created April 9, 2023 07:43
Swift: distort a UIView to fit arbitrary corners
import UIKit
extension UIView {
/// Updates `anchorPoint`, `frame`, and `layer.transform` to fit arbitrary corners.
/// Based on https://stackoverflow.com/questions/9470493/transforming-a-rectangle-image-into-a-quadrilateral-using-a-catransform3d/39981054#39981054
func distort(topLeft tl: CGPoint, topRight tr: CGPoint, bottomLeft bl: CGPoint, bottomRight br: CGPoint) {
// Frame ----------------------------------------------------------- /
let xmin = min(tr.x, tl.x, bl.x, br.x)
let ymin = min(tr.y, tl.y, bl.y, br.y)
let xmax = max(tr.x, tl.x, bl.x, br.x)
@cecilemuller
cecilemuller / gist:3081372
Created July 10, 2012 05:37
PostgreSQL trigger: loop through the columns of NEW record (requires `hstore` extension)
DECLARE
r record;
BEGIN
FOR r IN SELECT (each(hstore(NEW))).*
LOOP
RAISE NOTICE '% value is %', r.key, quote_nullable(r.value);
END LOOP;
RETURN NEW;
END
@cecilemuller
cecilemuller / OrientationDamper.swift
Last active February 16, 2023 13:33
Swift Dampers
import simd
// Interpolate a Quaternion without specifying duration, in the style of Herbert Stocker's X3D OrientationDamper:
// https://www.web3d.org/specifications/java/javadoc/org/web3d/x3d/sai/Followers/OrientationDamper.html
class OrientationDamper {
private(set) var isActive: Bool = false
private(set) var value: simd_quatf
private(set) var destination: simd_quatf
private(set) var tau: Float
private(set) var tolerance: Float
@cecilemuller
cecilemuller / cubemap.bat
Created May 1, 2019 11:32
Generate a DDS cubemap from 6 JPEG images
texassemble cube -w 1024 -h 1024 -o cubemap.dds px.jpg nx.jpg py.jpg ny.jpg pz.jpg nz.jpg
texconv cubemap.dds -m 0 -y -f BC1_UNORM
@cecilemuller
cecilemuller / index.html
Last active January 4, 2023 16:04
Record three.js to WebM video using CCapture.js
<!DOCTYPE HTML>
<html lang="en">
<head>
<title>Record WebGL to WebM (Chrome only)</title>
<meta charset="utf-8">
<link rel="stylesheet" href="styles.css" charset="utf-8">
</head>
<body>
<div class="buttons">