Skip to content

Instantly share code, notes, and snippets.

@benglewis
benglewis / Pixi-alpine.Dockerfile
Last active May 22, 2024 09:58
Use `woahbase/alpine-glibc` for `pixi`
FROM --platform=$TARGETPLATFORM woahbase/alpine-glibc
RUN echo "@testing https://dl-cdn.alpinelinux.org/alpine/edge/testing" >> /etc/apk/repositories && apk update && apk add pixi@testing
@benglewis
benglewis / Pixi-alpine.Dockerfile
Created May 20, 2024 13:08
An Alpine based Dockerfile for Pixi
ARG PIXI_VERSION=0.22.0
ARG BASE_IMAGE=frolvlad/alpine-glibc:alpine-3.19
ARG PIXI_USER=pixi
FROM --platform=linux/amd64 $BASE_IMAGE AS builder
ARG PIXI_VERSION
RUN apk update && apk add --no-cache curl
RUN curl -Ls \
"https://github.com/prefix-dev/pixi/releases/download/v${PIXI_VERSION}/pixi-$(uname -m)-unknown-linux-musl" \
-o /pixi && chmod +x /pixi
@benglewis
benglewis / frameRateMonitor.js
Created November 8, 2021 23:32
Cesium frameRateMonitor
const viewer = new Cesium.Viewer("cesiumContainer");
const frameRateMonitor = new Cesium.FrameRateMonitor({
scene: viewer.scene,
minimumFrameRateDuringWarmup: 100,
minimumFrameRateAfterWarmup: 200
});
frameRateMonitor.lowFrameRate.addEventListener((scene, lowFrameRate) => console.warn('Low frame rate!', frameRateMonitor, lowFrameRate));
@benglewis
benglewis / symbol_performance_improvements.rb
Created May 3, 2017 22:28
Ruby BSON symbol performance improvements
require 'benchmark/ips'
unless ((defined?(RUBY_ENGINE) && RUBY_ENGINE == 'jruby') || RUBY_VERSION < "2.1")
require 'memory_profiler'
end
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
require 'bson'
var newDiv = document.createElement("div");
var newContent = document.createTextNode("Hi there and greetings!");
newDiv.style.textAlign = "center";
newDiv.style.position = "absolute";
newDiv.style.height = "50px";
newDiv.style.width = "500px";
newDiv.style.top = "50%";
newDiv.style.left = "50%";
newDiv.style.marginTop = "-25px";
newDiv.style.marginLeft = "-250px";
import nltk
string = '''
I hate waiting in hospitals
Car parking is very expensive
I keep hearing your voice
Someone bought chocoolate and didn't give me any
The sound of Rosie's voice makes me want to cry
Kevin has stopped laughing because he lost his voice
The water is too wet