Skip to content

Instantly share code, notes, and snippets.

@ion1
ion1 / pixelate-rectangle.shader
Last active November 8, 2022 02:17
Censor a part of the screen (such as a chat window) by pixelation in obs-shaderfilter
// Censor a part of the screen (such as a chat window) by pixelation in
// obs-shaderfilter.
// https://obsproject.com/forum/resources/obs-shaderfilter.775/
// https://creativecommons.org/publicdomain/zero/1.0/
// To the extent possible under law, ion has waived all copyright and related
// or neighboring rights to obs-pixelate-rectangle. This work is published
// from: Suomi.
// https://gist.github.com/ion1/0e028ad096aa6f375bc9a97334639fa3
@ion1
ion1 / EinsteinsRiddle.hs
Created June 11, 2020 14:30
"Einstein's Riddle" in Ersatz
#!/usr/bin/env stack
{- stack
--resolver lts-15.15
script
--package ersatz
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RecordWildCards #-}
@ion1
ion1 / DragonJoustingRiddle.hs
Last active June 7, 2020 12:03
Dragon Jousting Riddle in Ersatz
#!/usr/bin/env stack
{- stack
--resolver lts-15.15
script
--package ersatz
--package containers
-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE TypeApplications #-}
@ion1
ion1 / Vertex distance from planes.md
Last active April 30, 2020 00:04
Vertex distance from planes

Plane normal dot products

P = [ 1  c ]
    [ c  1 ]

Plane normals

@ion1
ion1 / truncated_icosahedron.m
Last active April 30, 2020 01:09
Truncated icosahedron
clear all;
# The dot products between the symmetry plane normals.
plane_dots = [
1 -cos(pi/3) 0
-cos(pi/3) 1 -cos(pi/5)
0 -cos(pi/5) 1
];
# The dot products of the seed vertices with the symmetry plane normals.
@ion1
ion1 / More unknowns than equations.md
Created April 13, 2020 15:04
More unknowns than equations

Dealing with a system of equations with more unknowns than equations by making some of the unknowns parameters and using Gaussian elimination to solve for the remaining ones.

2a + 3b = 4c
5a + 6b + 42 = 7d

Arbitrarily, make b and d parameters and solve for a and c:

@ion1
ion1 / PushToMute.ahk
Last active April 26, 2023 19:32
Push-to-mute using AutoHotKey
#Warn
#SingleInstance
SetWorkingDir(A_ScriptDir)
Component := ""
Device := "Analogue 1 + 2 (Microphone)"
Mute(State) {
OldState := SoundGetMute(Component, Device)
@ion1
ion1 / ImageToCubeLut.hs
Last active April 18, 2019 08:32
Deuteranomaly simulation with nip2-cli
{-# LANGUAGE FlexibleContexts #-}
module Main where
import Data.Foldable as F
import Data.List (intercalate)
import Data.Massiv.Array as A
import Data.Massiv.Array.IO
import Graphics.ColorSpace
import System.Environment (getArgs)
@ion1
ion1 / index.js
Created March 8, 2019 23:03
Gridsome purgecss-plugin
const fs = require('mz/fs')
const hirestime = require('hirestime')
const Purgecss = require('purgecss')
class PurgecssPlugin {
static defaultOptions () {
return {}
}
constructor (api, originalOptions) {

The provided and unscrambled signals

I made the assumption that most of the adjacent values of the original signal are somewhat close,

x[n] ≈ x[n−1].

If the “encrypted” y[64n+k] = x[64n+k] xor key[k], then

y[64n+k] xor key[k] ≈ y[64n+k−1] xor key[k−1].