Skip to content

Instantly share code, notes, and snippets.

@karlseguin
karlseguin / test_runner.zig
Last active April 19, 2024 00:44
Custom Zig Test Runner
// in your build.zig, you can specify a custom test runner:
// const tests = b.addTest(.{
// .target = target,
// .optimize = optimize,
// .test_runner = "test_runner.zig", // add this line
// .root_source_file = .{ .path = "src/main.zig" },
// });
const std = @import("std");
const builtin = @import("builtin");
@Artefact2
Artefact2 / README.md
Last active April 19, 2024 00:44
GGUF quantizations overview

Which GGUF is right for me? (Opinionated)

Good question! I am collecting human data on how quantization affects outputs. See here for more information: ggerganov/llama.cpp#5962

In the meantime, use the largest that fully fits in your GPU. If you can comfortably fit Q4_K_S, try using a model with more parameters.

llama.cpp feature matrix

See the wiki upstream: https://github.com/ggerganov/llama.cpp/wiki/Feature-matrix

@Susensio
Susensio / property_inheritance.md
Last active April 19, 2024 00:42
Inherit property setter in python 3.7

Python @property inheritance the right way

Given a Parent class with value property, Child can inherit and overload the property while accessing Parent property getter and setter.

Although we could just reimplement the Child.value property logic completely without using Parent.value whatsover, this would violate the DRY principle and, more important, it wouldn't allow for proper multiple inheritance (as show in the example property_inheritance.py bellow).

Two options:

  • Child redefines value property completely, both getter and setter.
@abdullahkhalids
abdullahkhalids / mdnb.el
Last active April 19, 2024 00:40
Markdown-notebook minor mode for emacs
;; markdown-notebook mode
;; Helps you to insert python code blocks and execute their results
;; and place output back inside the document.
;; Install
;; Put this file somewhere and then add the following line to your emacs.el
;; (load-file "~/path/to/mdnb.el")
;; Help
;; Load the minor mode with M-x markdown-notebook-mode
@hekmon
hekmon / README.md
Last active April 19, 2024 00:40
EDF Time based Tempo prices

Simply include the file within your configuration.yaml file like this:

# ...
template: !include templates.yaml
# ...

You will need prices input number from this gist and the RTE Tempo extension.

@EvanMcBroom
EvanMcBroom / lsa-whisperer.md
Last active April 19, 2024 00:36
LSA Whisperer

LSA Whisperer

Thank you to SpecterOps for supporting this research, to Elad for helping draft this blog, and to Sarah, Daniel, and Adam for proofreading and editing! Crossposted on the SpecterOps Blog.

What follows is the culmination of two years of research with funding by SpecterOps and contributions from many of my coworkers.

Special thanks are needed to Elad, Lee, Will, Daniel, and Kai. Elad, Lee, and Will have contributed several ideas to the project, which are documented here, and have each spent multiple days testing the tool. Daniel has answered all of my inevitable questions about AzureAD (whoops, now Ent

@francois-rozet
francois-rozet / flow_matching.py
Last active April 19, 2024 00:36
Flow Matching in 100 LOC
#!/usr/bin/env python
import math
import matplotlib.pyplot as plt
import torch
import torch.nn as nn
from sklearn.datasets import make_moons
from torch import Tensor
from tqdm import tqdm
@Narsil
Narsil / pure_torch.py
Created November 10, 2022 15:06
Loading a safetensors file with pure torch only
import mmap
import torch
import json
import os
from huggingface_hub import hf_hub_download
def load_file(filename, device):
with open(filename, mode="r", encoding="utf8") as file_obj:
with mmap.mmap(file_obj.fileno(), length=0, access=mmap.ACCESS_READ) as m:
@GizmoTheMoonPig
GizmoTheMoonPig / Materials.md
Last active April 19, 2024 00:36
Materials: where did they go?

Starting in 1.20, the Material class has completely disappeared and has been replaced with a series of properties that are chained to BlockBehavior.Properties.of. This list exists so you can easily figure out which propeties to use to replace the old materials.

Every Material here gives its default MapColor (previously known as MaterialColor), regardless of if it had one or not. It also defines which properties to use to replicate the exact behavior used previously.

The very bottom of this file defines the more complicated replacements to certain material properties.

  • AIR - No MapColor, replaceable
  • STRUCTURAL_AIR - No MapColor, replaceable
  • PORTAL - No MapColor, PushReaction.BLOCK
  • CLOTH_DECORATION - MapColor.WOOL, ignitedByLava
@Heipry
Heipry / atajos-VSCode.md
Last active April 19, 2024 00:35
Atajos globales y personalizados de VSCode para teclado uk y es

Vscode Atajos

  • Mover linea - Alt + ↑ / ↓
  • Copiar linea - Shift + Alt + ↑ / ↓
  • Seleccionar siguiente aparición - Ctrl + D
  • Seleccionar todas las apariciones - Ctrl + Shift + L
  • Crear múltiples cursores - Ctrl + Alt+ ↑ / ↓
  • Selección multiple - Alt + Click
  • Mover bloque - Seleccionar . Alt + ↑ / ↓
  • Copiar bloque - Seleccionar . Shift + Alt + ↑ / ↓