This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// 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(.{}){}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ==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/* |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let mapleader = " " | |
syntax enable | |
filetype on | |
set completeopt=menu,menuone,noselect | |
set clipboard=unnamedplus | |
set guicursor= | |
set cursorline | |
set nu | |
set relativenumber |
NewerOlder