Skip to content

Instantly share code, notes, and snippets.

@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 + ↑ / ↓
@brson
brson / gist:9dec4195a88066fa42e6
Last active April 19, 2024 00:34
A Rust Syntax Guide

A Guide to Rust Syntax

A very brief guide to Rust syntax. It assumes you are already familiar with programming concepts.

This was written in 2014. It is not a good reference for Rust today, though the content is still correct.

cheats.rs looks like a good alternative.

Assert macro

MIFARE Classic

Here are the steps to follow in order to read your cards. Your goal is to find as many keys as possible. The keys unlock sections of your card for the Flipper to read them - you must have a card. Once you read enough sections, you can use an emulated or cloned card at the original card reader to unlock it (sometimes even without finding all of the keys!).

Reading the card

Steps:

  1. Dictionary attack: Try to scan your MIFARE Classic card with NFC -> Read. It will try a dictionary attack of default keys to unlock your card, as well as any keys you may have found through other methods. Do not interrupt the dictionary attack, it may take a while! If it finds 32/32 keys (or 80/80) with 16/16 sectors (or 40/40), congratulations and proceed to "Emulation". If not, continue to step 2.
  2. Mfkey32 attack (): If you have only a few keys found or no keys found, you can get mor
@ednisley
ednisley / Kicad-to-HAL.py
Created April 1, 2021 14:56
Python source code and Kicad libary: convert Kicad schematic into LinuxCNC HAL configuration file
# Parse Kicad schematic netlist into a LinuxCNC HAL configuration file
#
# Ed Nisley - KE4ZNU
# 2021-04
import argparse
from pathlib import Path
import sys
from lxml import etree
@reluce
reluce / prepare_ubuntu_template.sh
Last active April 19, 2024 00:31
Prepare Ubuntu 22.04 Cloud Image and Template for Proxmox
# All commands will be executed on a Proxmox host
sudo apt update -y && sudo apt install libguestfs-tools -y
wget https://cloud-images.ubuntu.com/jammy/current/jammy-server-cloudimg-amd64.img
# Install qemu-guest-agent on the image. Additional packages can be specified by separating with a comma.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --install qemu-guest-agent
# Read and set root user password from file.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --root-password file:password_root.txt
# Create an additional user.
sudo virt-customize -a jammy-server-cloudimg-amd64.img --run-command "useradd -m -s /bin/bash myuser"
# Set password for that user.