Skip to content

Instantly share code, notes, and snippets.

{"shape": [1], "dtype": "torch.float32", "nbytes": 4, "stats": {"before": {"active.all.allocated": 0, "active.all.current": 0, "active.all.freed": 0, "active.all.peak": 0, "active.large_pool.allocated": 0, "active.large_pool.current": 0, "active.large_pool.freed": 0, "active.large_pool.peak": 0, "active.small_pool.allocated": 0, "active.small_pool.current": 0, "active.small_pool.freed": 0, "active.small_pool.peak": 0, "active_bytes.all.allocated": 0, "active_bytes.all.current": 0, "active_bytes.all.freed": 0, "active_bytes.all.peak": 0, "active_bytes.large_pool.allocated": 0, "active_bytes.large_pool.current": 0, "active_bytes.large_pool.freed": 0, "active_bytes.large_pool.peak": 0, "active_bytes.small_pool.allocated": 0, "active_bytes.small_pool.current": 0, "active_bytes.small_pool.freed": 0, "active_bytes.small_pool.peak": 0, "allocated_bytes.all.allocated": 0, "allocated_bytes.all.current": 0, "allocated_bytes.all.freed": 0, "allocated_bytes.all.peak": 0, "allocated_bytes.large_pool.allocated": 0, "alloca
def generate_toc(notebook_path, show: bool = False, indent_char=" "):
"""
```python
exec(__import__("requests").get("https://gist.githubusercontent.com/Marco-Christiani/2fde58273045a4699ae27fd5fed8682c/raw/nbutils.py").text)
print(generate_toc("notebook.ipynb"))
```
"""
import json
import urllib.parse
from pathlib import Path
const std = @import("std");
pub const Array = struct {
data: []u32,
shape: [2]usize,
strides: [2]usize,
backstrides: [2]usize,
offset: usize,
alloc: std.mem.Allocator,
import sys
from pygments import highlight
import pygments.token as ptoken
from pygments.lexer import RegexLexer, bygroups
from pygments.lexers.zig import ZigLexer
from pygments.formatters import Terminal256Formatter
from pygments.styles.default import DefaultStyle
File = ptoken.String.Other
LineNo = ptoken.Number.Integer
@Marco-Christiani
Marco-Christiani / tmux.conf
Last active March 26, 2025 16:29
minimal tmux for servers
# git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
# alias ta='tmux list-sessions &> /dev/null && tmux attach || tmux'
# ~/.tmux-minimal.sh >>>>>>>>>>>>>>
##!/usr/bin/env bash
#
#get_tmux_option() {
# local option=$1
# local default_value="$2"
# local option_value=$(tmux show-options -gqv "$option")
# if [ -n "$option_value" ]; then
/// Basic length prefixed messaging, written as of 0.13.0
const std = @import("std");
const MSG_LIMIT = 1024 * 1024 * 10; // 10 MB limit
const slog = std.log.scoped(.server);
const clog = std.log.scoped(.client);
pub fn main() !void {
const port: u16 = 12345;
var gpa = std.heap.GeneralPurposeAllocator(.{}){};
@Marco-Christiani
Marco-Christiani / test_mnist_mlx.py
Created November 21, 2024 23:00
Zigrad MLX MNIST benchmarking
# TODO:configurable precision
import os
import platform
import time
from enum import StrEnum, auto
from pathlib import Path
import numpy as np
import mlx.core as mx
import mlx.nn as nn
import logging
import sys
from collections import deque
from functools import wraps
from threading import Lock
class ScrollBuffer:
"""Singleton scrolling buffer that handles terminal output.
// ==UserScript==
// @name Floating TOC
// @author Me, also see below
// @license MIT
// @description A floating table of content widget
// @version 1.9.7
// @match *://www.jianshu.com/p/*
// @match *://cdn2.jianshu.io/p/*
// @match *://zhuanlan.zhihu.com/p/*
// @match *://www.zhihu.com/pub/reader/*
@Marco-Christiani
Marco-Christiani / init.vim
Last active August 25, 2023 16:35
.vimrc for old vim installs
let mapleader = " "
syntax enable
filetype on
set completeopt=menu,menuone,noselect
set clipboard=unnamedplus
set guicursor=
set cursorline
set nu
set relativenumber