Skip to content

Instantly share code, notes, and snippets.

@jason-s
jason-s / typst-vscode-quickstart.typ
Last active April 5, 2023 16:10
Typst VSCode quickstart
#set page(width: 20cm, height:auto)
#set heading(numbering: "1.")
= Fun with typst
The typst program is pretty neat!
- Extremely fast incremental recompile
- Easier syntax
- Markup includes a well-designed scripting language
@jason-s
jason-s / math-rosetta.md
Last active March 23, 2023 03:52
LaTeX -> typst migration guide
LaTeX (render) typst (render)
$$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ $$\sum_{i=0}^n i^2 = \frac{(n^2+n)(2n+1)}{6}$$ sum_(i=0)^n i^2 = ((n^2+n)(2n+1))/6
\lim_{\Delta x \to 0} \frac{\sin (x + \Delta x) - \sin x}{\Delta x} = \frac{d}{dx} \sin x = \cos x $$\lim_{\Delta x \to 0} \frac{\sin (x + \Delta x) - \sin x}{\Delta x} = \frac{d}{dx} \sin x = \cos x$$ lim_(Delta x->0) (sin (x + Delta x) - sin(x))/(Delta x) = d/(d x) sin x = cos x
\mathbf{T}(\theta) = \begin{bmatrix}\cos\theta & -\sin\theta \\ \sin\theta & \cos\theta \end{bmatrix} (won't render in this form in GitHub Markdown math in a table) #let bf(x) = $upright(bold(#x))
#set math.mat(delim: "[")
bf(T)(theta) = mat(cos theta, -sin theta; sin theta, cos theta)
@jason-s
jason-s / html-table-border-test
Created January 4, 2023 17:24
Table border test for possible Chrome bug
<!DOCTYPE html>
<html>
<head>
<style type="text/css">
body {
font-family: 'Segoe UI', 'Lucida Grande'
}
table {
border: 1px solid black;
border-collapse: collapse;
@jason-s
jason-s / README.md
Created June 29, 2022 13:52
MathJax in SVG

SVG_MathJax

This replaces MathJax inline markup in an <svg> element with SVG-rendered MathJax.

Usage is easy:

<html>
    <head>
 
@jason-s
jason-s / quepland-bonuses.txt
Last active April 14, 2022 03:15
Quepland 2 notes
Food side-effects
Jerky Bonus Cul Arts Hunting
-----
Rabbit +5 Knifesmanship 1 1
Deer +5 Archery 5 5 (18 Buck)
Bear +5 Hammership 30 50
Moose +5 Swordsmanship 45 65
Boar +5 Mining 35 43
Pigeon +5 Axemanship 1 1
import numpy as np
import scipy.linalg
# see http://eprints.maths.ox.ac.uk/926/1/NA-10-03.pdf
# and http://www.chebfun.org/examples/approx/CF30.html
def rcf(Fx,m,n,nfft,K,domain=(-1,1)):
# CONTROL PARAMETERS
dim = K+n-m
nfft2 = nfft//2
@jason-s
jason-s / a1w.jpg
Last active December 24, 2021 21:57
a1w.jpg
@jason-s
jason-s / hilbertcurve.html
Created December 15, 2014 17:39
Hilbert curve generator using Javascript + SVG
<html>
<head>
<script type="text/javascript">
function createSVG(e)
{
return document.createElementNS("http://www.w3.org/2000/svg",e);
}
function left(v)
{
x = v[0];
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# based on
# https://qt.gitorious.org/pyside/pyside-examples/source/060dca8e4b82f301dfb33a7182767eaf8ad3d024:examples/itemviews/simpletreemodel/simpletreemodel.py
############################################################################
##
## Copyright (C) 2005-2005 Trolltech AS. All rights reserved.
##
@jason-s
jason-s / README.md
Last active April 3, 2021 03:24
Wordpress ate my матрёшка hacker code

I was looking for a motor website and noticed this suspicious looking JavaScript code:

https://web.archive.org/web/20200705182323/http://www.turnigy.com:80/about-us/

It is apparently a 3-level deep obfuscation of some website redirection that failed, because Wordpress faithfully encoded it rather than inserting directly.

  • hack1.js is the code that appears visually in the webpage.
  • hack2.js is the content of variable VWGMMLIBLQ that gets eval()d in hack1.js
  • hack3.js is the content of variable BPCDLVJEMJ that gets eval()d in hack2.js
  • hack4.js is the content of variable dec that gets executed via (new Function(dec))(); in hack3.js