Skip to content

Instantly share code, notes, and snippets.

@thesamesam
thesamesam / xz-backdoor.md
Last active November 17, 2024 13:13
xz-utils backdoor situation (CVE-2024-3094)

FAQ on the xz-utils backdoor (CVE-2024-3094)

This is a living document. Everything in this document is made in good faith of being accurate, but like I just said; we don't yet know everything about what's going on.

Background

On March 29th, 2024, a backdoor was discovered in xz-utils, a suite of software that

@mmozeiko
mmozeiko / _miniperf_readme.md
Last active November 5, 2024 05:53
get PMU counter values with ETW, perf or kperf

MiniPerf

Example of how to capture CPU counters with ETW on Windows, perf on Linux or kperf on Apple.

Using ETW needs somewhat recently updated Windows 10 or 11. Not sure about exact version.

Currently tested on:

  • etw on Qualcomm Snapdragon X Elite, Windows 11, arm64
  • etw on AMD Zen 3, Windows 11 (with virtualization enabled in BIOS)
----------------------------------------------------------------------------------------------------------------
-- AUTOMAGIC TABLES
----------------------------------------------------------------------------------------------------------------
-- There is a well-known "standard" implementation of automagic tables at http://lua-users.org/wiki/AutomagicTables
--
-- Unfortunately, that implementation behaves weirdly in some situations:
-- local a = AutomagicTable()
-- local x = a.b.c
-- local y = a.b.c
-- assert(x == y) -- assertion fails !
@kmizu
kmizu / parsers.nim
Created July 1, 2016 00:51
parser combinator library in Nim
import strutils
import lists
import re
type
Parser[T] = proc(input: string): Maybe[(T, string)]
Maybe*[T] = object
value: T
hasValue: bool
@bishboria
bishboria / springer-free-maths-books.md
Last active October 3, 2024 09:17
Springer made a bunch of books available for free, these were the direct links
@allanmac
allanmac / sha256.cu
Last active November 10, 2023 01:26
A CUDA SHA-256 subroutine using macro expansion
// -*- compile-command: "nvcc -m 32 -arch sm_35 -Xptxas=-v,-abi=no -cubin sha256.cu"; -*-
//
// Copyright 2013 Allan MacKinnon <[email protected]>
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
@allanmac
allanmac / float3 SoA to AoS
Last active June 30, 2018 16:12
A strategy for converting a float3 SoA into AoS without using shared memory.
===============================================================================================
Load three arrays (x, y and z) in SoA order, repack them and store them in AoS order.
Strategy: each warp permutes its load lane with:
(rowNum + (laneId() * 3)) & 31
This will convert SoA into AoS but with x/y/z staggered across rows of registers.
/* PROG1.C */
/* Simple Hashing LZ77 Sliding Dictionary Compression Program */
/* By Rich Geldreich, Jr. October, 1993 */
/* Originally compiled with QuickC v2.5 in the small model. */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
/* set this to 1 for a greedy encoder */