Skip to content

Instantly share code, notes, and snippets.

@ion1
ion1 / Farm.md
Last active Jul 10, 2021
Mysticat Sugarcane Farm Optimization
View Farm.md

Mysticat Sugarcane Farm Optimization

Using Z3 to generate a slightly more optimal Minecraft sugarcane/water block layout compared to the farm presented by Mysticat in Top 3 Minecraft Sugarcane Farms at 7:32.

Original (190 sugarcanes):

Mysticat Sugarcane Farm, Original

Optimized (200 sugarcanes):

@ion1
ion1 / weechat-idlerpg.md
Last active Jun 15, 2021
IdleRPG bot login automation with WeeChat
View weechat-idlerpg.md

IdleRPG bot login automation with WeeChat

Log in when joining the channel

/trigger addreplace libera_idlerpg_login_join signal libera,irc_in2_353 "${text} =~ ^. #idlerpg :(.+ )?@idlebot( |$)" "" "/msg -server ${server} idlebot login user password"

Log in when idlebot gains +o

@ion1
ion1 / hash_collision.py
Last active May 29, 2021
Finding a hash collision with z3
View hash_collision.py
from itertools import cycle
from z3 import *
class NameGen:
def __init__(self, prefix):
self.prefix = prefix
self.count = 0
def gen(self):
@ion1
ion1 / dct.gmic
Created Jan 27, 2021
G'MIC code for plotting the DCT of an image
View dct.gmic
to_rgb
dct
abs
log
cut 0,8
normalize 0,255
@ion1
ion1 / pixelate-rectangle.shader
Last active Oct 26, 2020
Censor a part of the screen (such as a chat window) by pixelation in obs-shaderfilter
View pixelate-rectangle.shader
// 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 Jun 11, 2020
"Einstein's Riddle" in Ersatz
View EinsteinsRiddle.hs
#!/usr/bin/env stack
{- stack
--resolver lts-15.15
script
--package ersatz
-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE GeneralizedNewtypeDeriving #-}
{-# LANGUAGE RecordWildCards #-}
@ion1
ion1 / DragonJoustingRiddle.hs
Last active Jun 7, 2020
Dragon Jousting Riddle in Ersatz
View DragonJoustingRiddle.hs
#!/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 Apr 30, 2020
Vertex distance from planes
View Vertex distance from planes.md

Plane normal dot products

P = [ 1  c ]
    [ c  1 ]

Plane normals

@ion1
ion1 / truncated_icosahedron.m
Last active Apr 30, 2020
Truncated icosahedron
View truncated_icosahedron.m
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 Apr 13, 2020
More unknowns than equations
View More unknowns than equations.md

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: