Skip to content

Instantly share code, notes, and snippets.

@ntjess
ntjess / git-graph.typ
Last active November 1, 2024 23:06
Generate git graphs in typst
#import "@preview/cetz:0.2.0"
#let d = cetz.draw
#let offset(anchor, x: 0, y: 0) = {
(v => cetz.vector.add(v, (x, y)), anchor)
}
#let default-colors = (red, orange, yellow, green, blue, purple, fuchsia, gray)
#let color-boxed(..args) = {
set text(0.8em)
box(
@Julynx
Julynx / 15_python_tips.md
Last active December 19, 2025 18:01
15 Python Tips To Take Your Code To The Next Level!
@eyalk11
eyalk11 / fuzzyloc.ps1
Last active June 30, 2023 09:33
Go into visited locations by fuzzy search
# Depends on FZF
# Remove the default cd alias
Remove-Alias cd
# Create a new cd function
function MyCD {
Set-Location @args
$curtime =$(Get-Date -Format "yyyy-MM-dd HH:mm:ss")
$dict = @{
Id = "30"
@m516
m516 / publish-latex.yml
Last active December 23, 2025 13:57
GitHub Action: LaTeX -> GitHub Release (PDF), GitHub Pages (HTML)
# This Action autogenerates PDFs and standalone HTML
# out of your Overleaf projects (or any LaTeX-live project).
#
# PDF generator: pdflatex
# HTML generator: htlatex
#
# Both tools come from LaTeX Live and are executed on
# the latest version of Ubuntu.
#
# Given:
@mzechmeister
mzechmeister / desmos_load_data_file.js
Last active June 16, 2023 18:53
desmos load data file
// insert everything in the browser console and a "file" button will appear in the submenu
function addfilebutton() {
if (document.querySelector("#file2xy") || // exists already
!document.querySelector(".dcg-action-newimage")) // unclick case
return
pic = document.querySelector(".dcg-action-newimage").parentNode
var div = document.createElement('div');
div.innerHTML = '<style>.dcg-calculator-api-container .dcg-icon-new-file::before { content: "\\e205";}</style><div class="dcg-new-item dcg-action-newfile" onclick="file2tab.click()"><i class="dcg-icon-new-file dcg-expression-icon" aria-hidden="true"></i>Datei2tab</div><input id="file2tab" type="file" style="display: none" onchange="tabFromFile()"></div>'
pic.after(div)
@DrLeucine
DrLeucine / thesis-eisvogel
Created December 2, 2022 12:45
An adaptation of https://github.com/Wandmalfarbe/pandoc-latex-template but for academic thesis with minor changes to the layout
%%
% Copyright (c) 2017 - 2021, Pascal Wagler;
% Copyright (c) 2014 - 2021, John MacFarlane
%
% All rights reserved.
%
% Redistribution and use in source and binary forms, with or without
% modification, are permitted provided that the following conditions
% are met:
%
@AnubisNekhet
AnubisNekhet / !Description.md
Last active May 15, 2023 04:19
Capacities-like sidebars

Preview

image

Caveats

Since the snippet utilises callouts, the sidebar disappears after a note is scrolled enough for the callout to be outside rendering range, i.e. it's best used for smaller notes. Smaller sidebar sizes are better in this case because there's more scroll area.

Usage

Use the capacities-sidebars.css as a snippet and paste the markdown into a new note.

@itsmeadarsh2008
itsmeadarsh2008 / win32.ps1
Created October 9, 2022 13:22
A text-to-speech conversion using Powershell. Use ./win32.ps1 <text> <rate>
param(
[Parameter()]
[String]$text,
[Int]$rate
)
Add-Type -AssemblyName System.speech
$speak = New-Object System.Speech.Synthesis.SpeechSynthesizer
$speak.SpeakSsml(($text))
$speak.Rate = $rate

MD5 Collision with CRC32 Preimage

Here's the scenario: We want to craft two different messages with the same MD5 hash, and a specific CRC32 checksum, simultaneously.

In other words, we want an MD5 collision attack and a CRC32 preimage attack.

This might seem like a contrived scenario, but it's exactly the one I faced while producing my PNG hashquine (Yes OK maybe that's also a contrived scenario, cut me some slack).

On its own, a CRC32 preimage attack is trivial. You can craft a 4-byte suffix that gives any message a specific checksum, calculated using a closed-form expression (which I am too lazy to derive, not even with assistance from Z3). It's not an attack per-se, since CRC32 was never meant to be cryptograpically secure in the first place.