Skip to content

Instantly share code, notes, and snippets.

View wolfv's full-sized avatar
🚀

Wolf Vollprecht wolfv

🚀
View GitHub Profile
@wolfv
wolfv / recipe.yaml
Created April 1, 2024 18:06
DOSBOX recipe for rattler-build
package:
name: dosbox
version: "0.74.0"
source:
url: https://downloads.sourceforge.net/project/dosbox/dosbox/0.74-3/dosbox-0.74-3.tar.gz
sha256: c0d13dd7ed2ed363b68de615475781e891cd582e8162b5c3669137502222260a
build:
number: 0
from pathlib import Path
ltxt = Path("_rclpy_pybind11.dir/link.txt")
cmd = ltxt.read_text().split()
final_cmd = []
for c in cmd:
if c.startswith("@CMakeFiles"):
p = c.removeprefix("@CMakeFiles/")
@wolfv
wolfv / graphql_upload_file.py
Last active January 23, 2023 15:37
Upload a file with Python, Requests and GraphQL
import requests
import json
url = 'http://localhost:3001/api/graphql'
cookies = {}
mutation = '''mutation($file: Upload!) {
uploadEnv(environmentFileUpload: $file) {
id
mkdir -p ~/.local/bin
set PLATFORM=win
set ARCH=64
curl -Ls https://micro.mamba.pm/api/micromamba/%PLATFORM%-%ARCH%/latest | tar -xvj -C ~/.local/bin/ --strip-components=1 Library/bin/micromamba.exe
@wolfv
wolfv / benchmark.md
Created January 17, 2023 13:33
Raw benchmark values for `micromamba` 1.0 vs 1.2 vs `conda-package-handling`

Jaxlib

micromamba 1.2.0

➜ hyperfine "micromamba package extract jaxlib-0.4.1-cpu_py38h6beaf4d_1.conda outmmjaxnew" --warmup 3
Benchmark 1: micromamba package extract jaxlib-0.4.1-cpu_py38h6beaf4d_1.conda outmmjaxnew
  Time (mean ± σ):     227.2 ms ±  17.4 ms    [User: 158.4 ms, System: 52.8 ms]
  Range (min … max):   212.9 ms … 267.5 ms    13 runs
@wolfv
wolfv / progress_bars.cpp
Created January 7, 2023 12:10
Immediate mode rendering progress bars
#include <chrono>
#include <iostream>
#include <string>
#include <thread>
#include <random>
#include <sys/ioctl.h>
namespace cursor
{
class CursorMovementTriple
@wolfv
wolfv / bench_libarchive.cpp
Created January 3, 2023 16:41
Benchmark libarchive .zstd extraction
#include <filesystem>
#include <iostream>
#include <archive.h>
#include <archive_entry.h>
#include <cassert>
#include <fcntl.h> /* For O_RDWR */
#include <unistd.h> /* For open(), creat() */
namespace fs = std::filesystem;
@wolfv
wolfv / bench.cpp
Created December 27, 2022 13:42
Benchmark anaconda repodata downloads with cURL and compression algorithms
#include <iostream>
#include <fstream>
#include <filesystem>
#include <curl/curl.h>
#include <zstd.h>
#include <bzlib.h>
#include <chrono>
namespace fs = std::filesystem;
@wolfv
wolfv / dl_decompress.cpp
Last active December 27, 2022 13:27
Stream decompress a simple `zstd` or `bzip2` compressed file with cURL / libcurl
#include <iostream>
#include <fstream>
#include <filesystem>
#include <curl/curl.h>
#include <zstd.h>
#include <bzlib.h>
namespace fs = std::filesystem;
// constexpr size_t BUFFER_SIZE = 131072;
@wolfv
wolfv / install.ps1
Created November 2, 2022 12:19
Fetch micromamba ps1
curl -Ls https://micro.mamba.pm/api/micromamba/win-64/latest | tar -xvj -C ~/.local/bin/ --strip-components=1 Library/bin/micromamba